/**
 * SensFlow - Thèmes de page de réservation
 *
 * Thèmes disponibles :
 * - default : Thème standard (pas de classe spéciale)
 * - galerie : Style Airbnb avec hero fullbleed et carte overlap
 */

/* ==========================================================================
   THEME GALERIE (Style Airbnb)
   ========================================================================== */

/* --- Reset du layout par défaut --- */
.theme-galerie .public-main {
    max-width: 100%;
    padding: 0;
}

/* Le header SensFlow reste visible mais simplifié */
.theme-galerie .sf-header-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: transparent;
    border-bottom: none;
}

/* --- Hero Gallery (Photos full-bleed) --- */
.theme-galerie .hero-gallery {
    position: relative;
    width: 100%;
    height: 50vh;
    min-height: 280px;
    max-height: 420px;
    overflow: hidden;
    background: var(--sf-sand);
}

/* === Mobile : Slider horizontal === */
.theme-galerie .hero-gallery-slider {
    display: flex;
    width: 100%;
    height: 100%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
    touch-action: pan-x;
    -webkit-overflow-scrolling: touch;
}

.theme-galerie .hero-gallery-slider::-webkit-scrollbar {
    display: none;
}

.theme-galerie .hero-gallery-slide {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    scroll-snap-align: start;
    touch-action: pan-x;
}

.theme-galerie .hero-gallery-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
    -webkit-touch-callout: none;
    touch-action: pan-x;
}

/* === Desktop : Grille style Airbnb === */
.theme-galerie .hero-gallery-grid {
    display: none;
}

@media (min-width: 768px) {
    .theme-galerie .hero-gallery {
        height: auto;
        max-height: none;
        min-height: auto;
        padding: 24px 16px;
        background: transparent;
        max-width: 680px;
        margin: 0 auto;
    }

    /* Masquer le slider mobile sur desktop */
    .theme-galerie .hero-gallery-slider,
    .theme-galerie .hero-gallery-counter,
    .theme-galerie .hero-gallery-dots {
        display: none;
    }

    /* Afficher la grille sur desktop */
    .theme-galerie .hero-gallery-grid {
        display: grid;
        grid-template-columns: 2fr 1fr 1fr;
        grid-template-rows: 1fr 1fr;
        gap: 8px;
        height: 280px;
        border-radius: var(--sf-radius-lg);
        overflow: hidden;
    }

    .theme-galerie .hero-gallery-grid-item {
        position: relative;
        overflow: hidden;
        cursor: pointer;
        background: var(--sf-sand);
    }

    .theme-galerie .hero-gallery-grid-item:first-child {
        grid-row: span 2;
    }

    .theme-galerie .hero-gallery-grid-item img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: transform 0.3s ease;
    }

    .theme-galerie .hero-gallery-grid-item:hover img {
        transform: scale(1.05);
    }

    /* Overlay sur hover (pointer-events: none pour permettre le clic) */
    .theme-galerie .hero-gallery-grid-item::after {
        content: '';
        position: absolute;
        inset: 0;
        background: rgba(0,0,0,0);
        transition: background 0.3s ease;
        pointer-events: none;
    }

    .theme-galerie .hero-gallery-grid-item:hover::after {
        background: rgba(0,0,0,0.1);
    }

    /* Overlay "+X photos" sur la dernière image si plus de 5 photos */
    .theme-galerie .hero-gallery-grid-item.has-more::before {
        content: attr(data-more);
        position: absolute;
        inset: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(0,0,0,0.5);
        color: #fff;
        z-index: 2;
    }

    /* Variantes selon le nombre de photos */
    /* 1 photo : pleine largeur */
    .theme-galerie .hero-gallery-grid[data-count="1"] {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr;
    }

    .theme-galerie .hero-gallery-grid[data-count="1"] .hero-gallery-grid-item:first-child {
        grid-row: span 1;
    }

    /* 2 photos : 50/50 */
    .theme-galerie .hero-gallery-grid[data-count="2"] {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: 1fr;
    }

    .theme-galerie .hero-gallery-grid[data-count="2"] .hero-gallery-grid-item:first-child {
        grid-row: span 1;
    }

    /* 3 photos : grande + 2 petites */
    .theme-galerie .hero-gallery-grid[data-count="3"] {
        grid-template-columns: 2fr 1fr;
        grid-template-rows: 1fr 1fr;
    }

    /* 4 photos : grande + 3 petites (1 en haut, 2 en bas à droite) */
    .theme-galerie .hero-gallery-grid[data-count="4"] {
        grid-template-columns: 2fr 1fr 1fr;
        grid-template-rows: 1fr 1fr;
    }

    .theme-galerie .hero-gallery-grid[data-count="4"] .hero-gallery-grid-item:nth-child(2) {
        grid-column: span 2;
    }
        font-size: 18px;
        font-weight: 600;
        z-index: 1;
    }
}

/* Fallback : photo de profil ou placeholder */
.theme-galerie .hero-gallery-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(139,168,136,0.2) 0%, rgba(212,168,83,0.15) 100%);
}

.theme-galerie .hero-gallery-fallback-photo {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #fff;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.theme-galerie .hero-gallery-fallback-initials {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: var(--sf-sage);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    font-weight: 700;
    color: #fff;
    border: 4px solid #fff;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

/* Compteur de photos (style Airbnb) - mobile uniquement */
.theme-galerie .hero-gallery-counter {
    position: absolute;
    bottom: 40px;
    right: 16px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    backdrop-filter: blur(4px);
    z-index: 5;
}

/* Indicateurs de navigation (dots) */
.theme-galerie .hero-gallery-dots {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
}

.theme-galerie .hero-gallery-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transition: all 0.2s;
}

.theme-galerie .hero-gallery-dot.active {
    background: #fff;
    transform: scale(1.2);
}

/* --- Carte de contenu (overlap sur l'image) --- */
.theme-galerie .content-card {
    position: relative;
    background: #fff;
    border-radius: 20px 20px 0 0;
    margin-top: -24px;
    padding: 24px;
    min-height: calc(100vh - 50vh + 24px);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
}

/* --- En-tête praticien : avatar + infos + bouton CTA desktop --- */
.theme-galerie .galerie-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 20px;
}

/* Bouton CTA desktop (masqué sur mobile) */
.theme-galerie .galerie-header-cta {
    display: none;
}

@media (min-width: 768px) {
    .theme-galerie .galerie-header-cta {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        padding: 12px 20px;
        background: var(--sf-sage);
        color: #fff;
        border: none;
        border-radius: 10px;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s;
        margin-left: auto;
        align-self: center;
    }

    .theme-galerie .galerie-header-cta:hover {
        background: var(--sf-sage-dark, #8a9e86);
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(139,168,136,0.3);
    }
}

.theme-galerie .galerie-avatar {
    flex-shrink: 0;
}

.theme-galerie .galerie-avatar-img {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.theme-galerie .galerie-avatar-initials {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--sf-sage);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 600;
    color: #fff;
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.theme-galerie .galerie-info {
    flex: 1;
    min-width: 0;
}

.theme-galerie .galerie-name {
    font-size: 22px;
    font-weight: 700;
    color: var(--sf-ink);
    margin: 0 0 4px 0;
    line-height: 1.2;
}

.theme-galerie .galerie-specialty {
    font-size: 15px;
    color: var(--sf-sage);
    font-weight: 500;
    margin: 0 0 8px 0;
}

.theme-galerie .galerie-addresses {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.theme-galerie .galerie-address {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 14px;
    color: var(--sf-muted);
    margin: 0;
    line-height: 1.4;
}

.theme-galerie .galerie-address-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    margin-top: 1px;
    color: var(--sf-muted);
}

.theme-galerie .galerie-address-secondary {
    padding-left: 22px;
}

.theme-galerie .galerie-address-secondary .galerie-address-icon {
    display: none;
}

/* --- Badges inline (sous la spécialité) --- */
.theme-galerie .galerie-inline-badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

/* Style identique à la page classique */
.theme-galerie .hero-google-reviews {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: #fff;
    border: 1px solid var(--sf-border);
    border-radius: 9999px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.theme-galerie .hero-google-reviews:hover {
    background: var(--sf-linen);
    border-color: #d1d5db;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.theme-galerie .hero-reviews-stars {
    display: flex;
    gap: 1px;
}

.theme-galerie .hero-reviews-stars .star {
    font-size: 11px;
    color: var(--sf-muted);
}

.theme-galerie .hero-reviews-stars .star.full,
.theme-galerie .hero-reviews-stars .star.half {
    color: #fbbf24;
}

.theme-galerie .hero-reviews-score {
    font-size: 11px;
    font-weight: 600;
    color: var(--sf-ink);
}

.theme-galerie .hero-reviews-google {
    width: 12px;
    height: 12px;
    margin-left: 1px;
}

/* Badge certification */
.theme-galerie .hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 13px;
    font-weight: 500;
}

.theme-galerie .hero-badge svg {
    width: 16px;
    height: 16px;
}

.theme-galerie .hero-badge.certified {
    background: linear-gradient(135deg, rgba(139,168,136,0.15) 0%, rgba(165,178,159,0.2) 100%);
    color: var(--sf-sage);
}

.theme-galerie .hero-badge.verified {
    background: linear-gradient(135deg, rgba(212,168,83,0.2) 0%, rgba(198,170,118,0.25) 100%);
    color: #9a7b2c;
}

/* --- Section Adresses --- */
.theme-galerie .galerie-addresses-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px 0;
    border-top: 1px solid var(--sf-border);
    margin-bottom: 8px;
}

.theme-galerie .galerie-address-block {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.theme-galerie .galerie-address-icon-wrap {
    width: 40px;
    height: 40px;
    background: rgba(139,168,136,0.12);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.theme-galerie .galerie-address-icon-wrap .galerie-address-icon {
    width: 20px;
    height: 20px;
    color: var(--sf-sage);
}

.theme-galerie .galerie-address-content {
    flex: 1;
    min-width: 0;
}

.theme-galerie .galerie-address-text {
    font-size: 14px;
    color: var(--sf-ink);
    line-height: 1.5;
}

.theme-galerie .galerie-address-sub {
    font-size: 13px;
    color: var(--sf-muted);
    margin-top: 2px;
}

.theme-galerie .galerie-address-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
    font-size: 13px;
    color: var(--sf-sage);
    text-decoration: none;
    font-weight: 500;
}

.theme-galerie .galerie-address-link:hover {
    text-decoration: underline;
}

.theme-galerie .galerie-address-link svg {
    flex-shrink: 0;
}

/* --- Sections : À propos, Contact, Paiement --- */
.theme-galerie .galerie-section {
    padding: 20px 0;
    border-top: 1px solid var(--sf-border);
}

.theme-galerie .galerie-section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--sf-ink);
    margin: 0 0 12px 0;
}

/* À propos / Bio */
.theme-galerie .galerie-bio-container {
    position: relative;
}

.theme-galerie .galerie-bio {
    font-size: 14px;
    line-height: 1.6;
    color: var(--sf-muted);
    margin: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.theme-galerie .galerie-bio.collapsed {
    max-height: 4.8em; /* 3 lignes */
    position: relative;
}

.theme-galerie .galerie-bio.collapsed::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1.6em;
    background: linear-gradient(transparent, #fff);
}

.theme-galerie .galerie-bio-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    padding: 0;
    background: none;
    border: none;
    color: var(--sf-sage);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
}

.theme-galerie .galerie-bio-toggle:hover {
    text-decoration: underline;
}

.theme-galerie .galerie-bio-toggle svg {
    transition: transform 0.2s;
}

.theme-galerie .galerie-bio-toggle.expanded svg {
    transform: rotate(180deg);
}

/* Spécialités / Diplômes */
.theme-galerie .galerie-specialties {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.theme-galerie .galerie-specialty-tag {
    padding: 6px 14px;
    background: rgba(139,168,136,0.12);
    color: var(--sf-sage-dark, #7a9a77);
    border-radius: 9999px;
    font-size: 13px;
    font-weight: 500;
}

/* Infos pratiques (Contact + Paiement) - Style inline compact */
.theme-galerie .galerie-infos-pratiques {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.theme-galerie .galerie-info-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.theme-galerie .galerie-info-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--sf-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.theme-galerie .galerie-info-items {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.theme-galerie .galerie-info-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: var(--sf-linen);
    border-radius: 6px;
    color: var(--sf-ink);
    text-decoration: none;
    font-size: 13px;
    transition: all 0.2s;
}

.theme-galerie .galerie-info-link:hover {
    background: var(--sf-sand);
    color: var(--sf-sage);
}

.theme-galerie .galerie-info-link svg {
    color: var(--sf-sage);
    flex-shrink: 0;
}

.theme-galerie .galerie-info-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 10px;
    background: var(--sf-linen);
    border-radius: 9999px;
    font-size: 13px;
    color: var(--sf-ink);
}

.theme-galerie .galerie-info-badge svg {
    width: 14px;
    height: 14px;
    color: var(--sf-sage);
}

/* --- Footer sticky (bouton RDV) --- */
.theme-galerie .sticky-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid var(--sf-border);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

.theme-galerie .sticky-footer-info {
    display: flex;
    flex-direction: column;
}

.theme-galerie .sticky-footer-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--sf-ink);
}

.theme-galerie .sticky-footer-rating {
    font-size: 13px;
    color: var(--sf-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.theme-galerie .sticky-footer-rating svg {
    width: 14px;
    height: 14px;
    fill: var(--sf-ink);
}

.theme-galerie .sticky-footer-btn {
    background: var(--sf-sage);
    color: #fff;
    border: none;
    padding: 14px 24px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.theme-galerie .sticky-footer-btn:hover {
    background: var(--sf-sage-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139,168,136,0.3);
}

/* Espace pour le footer sticky */
.theme-galerie .content-card {
    padding-bottom: 100px;
}

/* --- Masquer les éléments du thème default --- */
.theme-galerie .booking-hero,
.theme-galerie .welcome-banner,
.theme-galerie .booking-gallery {
    display: none !important;
}

/* --- Booking wizard dans le thème galerie --- */
.theme-galerie .galerie-wizard {
    max-width: 100%;
    padding: 0;
}

.theme-galerie .galerie-wizard .card {
    border: none;
    box-shadow: none;
    border-radius: 0;
    margin-bottom: 0;
    border-top: 1px solid var(--sf-border);
    padding-top: 24px;
}

/* Stepper dans la card + ligne de séparation */
.theme-galerie .galerie-wizard .stepper {
    margin-bottom: 16px;
}

.theme-galerie .galerie-wizard .stepper-divider {
    height: 1px;
    background: var(--sf-border);
    margin: 0 -24px 20px -24px;
}

@media (max-width: 640px) {
    .theme-galerie .galerie-wizard .stepper-divider {
        margin: 0 -16px 20px -16px;
    }
}

/* --- Responsive --- */
@media (max-width: 640px) {
    .theme-galerie .hero-gallery {
        height: 45vh;
        min-height: 240px;
    }

    .theme-galerie .content-card {
        padding: 20px 16px;
        padding-bottom: 100px;
        border-radius: 16px 16px 0 0;
    }

    .theme-galerie .galerie-header {
        gap: 12px;
    }

    .theme-galerie .galerie-avatar-img,
    .theme-galerie .galerie-avatar-initials {
        width: 60px;
        height: 60px;
        font-size: 24px;
    }

    .theme-galerie .galerie-name {
        font-size: 20px;
    }

    .theme-galerie .galerie-specialty {
        font-size: 14px;
    }

    .theme-galerie .galerie-address {
        font-size: 13px;
    }

    .theme-galerie .galerie-badges {
        gap: 8px;
    }

    .theme-galerie .sticky-footer {
        padding: 10px 12px;
    }

    .theme-galerie .sticky-footer-btn {
        padding: 12px 20px;
        font-size: 14px;
    }
}

/* --- Desktop --- */
@media (min-width: 768px) {
    /* Carte centrée alignée avec la galerie de photos */
    .theme-galerie .content-card {
        max-width: 680px;
        margin-left: auto;
        margin-right: auto;
        border-radius: var(--sf-radius-lg);
        margin-top: 0;
        margin-bottom: 40px;
        box-shadow: 0 4px 30px rgba(0,0,0,0.1);
        padding-bottom: 24px;
    }

    /* Masquer le sticky footer en desktop (remplacé par le bouton dans le header) */
    .theme-galerie .sticky-footer {
        display: none;
    }

    /* Calendrier/slots : côte à côte 50/50 */
    .theme-galerie .calendar-slots-wrapper {
        display: flex;
        flex-direction: row;
        gap: 0;
    }

    .theme-galerie .calendar-section {
        flex: 1 1 50%;
        min-width: 0;
    }

    .theme-galerie .slots-section {
        flex: 1 1 50%;
        min-width: 0;
        padding-left: 24px;
        border-left: 1px solid var(--sf-border);
        margin-left: 24px;
        padding-top: 0;
        border-top: none;
    }

    /* Grille slots : 3 colonnes pour tenir dans 50% */
    .theme-galerie .slots-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
