/**
 * Modal V2 - Styles pour le modal interactif avec carrousel et vidéo
 * spotregio.com/anciennes-provinces-de-France/
 * Version: 2.9 - Basé sur le CSS EXACT du serveur
 * 
 * MODIFICATIONS par rapport à l'original (4 changements uniquement) :
 * 1. Header : padding réduit (16px au lieu de 20px, plus de blason)
 * 2. Carrousel : animation -50% (car duplication JS)
 * 3. Section image : align-self stretch (toute hauteur)
 * 4. NOUVEAU : styles pour .modal-blason-column (3ème colonne)
 */

/* ========================================
   OVERLAY DU MODAL
   ======================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(5px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease-out;
}

.modal-overlay.hidden {
    display: none;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* ========================================
   CONTENEUR DU MODAL
   ======================================== */

.modal-container {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 1200px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ========================================
   EN-TÊTE DU MODAL
   ✅ V2.9 : padding réduit (plus de blason dans breadcrumb)
   ======================================== */

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 30px;
    border-bottom: 1px solid #e0e0e0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.modal-breadcrumb {
    font-size: 0.9em;
    font-weight: 500;
}

.breadcrumb-separator {
    margin: 0 8px;
    opacity: 0.7;
}

/* Ancien style blason breadcrumb - conservé pour compatibilité */
.breadcrumb-blason {
    display: none;
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 2em;
    color: white;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ========================================
   CARROUSEL D'ILLUSTRATIONS
   ✅ V2.9 : animation -50% (duplication JS)
   ======================================== */

.modal-carousel {
    width: 100%;
    height: 160px;
    overflow: hidden;
    background: linear-gradient(to bottom, #f9f9f9, #ffffff);
    border-bottom: 2px solid #e0e0e0;
    position: relative;
}

.carousel-track {
    display: flex;
    gap: 20px;
    animation: scroll-carousel 30s linear infinite;
    padding: 10px 0;
}

.carousel-item {
    flex-shrink: 0;
    width: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.carousel-item img {
    width: 180px;
    height: 110px;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s;
}

.carousel-item:hover img {
    transform: scale(1.05);
}

.carousel-caption {
    font-size: 0.85em;
    color: #666;
    text-align: center;
    font-weight: 500;
}

/* ✅ V2.9 : Animation -50% car les images sont dupliquées en JS */
@keyframes scroll-carousel {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* Effet de fondu sur les bords */
.modal-carousel::before,
.modal-carousel::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 50px;
    z-index: 2;
    pointer-events: none;
}

.modal-carousel::before {
    left: 0;
    background: linear-gradient(to right, #f9f9f9, transparent);
}

.modal-carousel::after {
    right: 0;
    background: linear-gradient(to left, #f9f9f9, transparent);
}

/* ========================================
   CORPS DU MODAL
   Layout 2 colonnes par défaut (le JS passe en 3 colonnes si blason)
   ======================================== */

.modal-body {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 30px;
    padding: 30px;
    overflow-y: auto;
    flex: 1;
}

/* ========================================
   SECTION IMAGE/VIDÉO (COLONNE GAUCHE)
   ✅ V2.9 : align-self stretch pour toute hauteur
   ======================================== */

.modal-image-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    align-self: stretch;
}

/* Vidéo d'introduction */
.video-intro-container {
    position: relative;
    width: 100%;
    flex: 1;
    min-height: 300px;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-intro-container.hidden {
    display: none;
}

.guide-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    text-align: center;
    padding: 40px;
}

.video-placeholder h3 {
    font-size: 1.5em;
    margin-bottom: 20px;
}

.video-placeholder p {
    font-size: 1em;
    opacity: 0.8;
    margin-bottom: 10px;
}

.video-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    z-index: 10;
}

.skip-btn {
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 8px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.skip-btn:hover {
    background: white;
    transform: translateY(-2px);
}

.mute-btn {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    font-size: 1.5em;
    cursor: pointer;
    transition: all 0.3s;
}

.mute-btn:hover {
    background: white;
}

/* Section carte */
.map-section {
    position: relative;
    animation: fadeIn 0.5s ease-out;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.map-section.hidden {
    display: none;
}

.modal-image {
    width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    object-fit: contain;
    flex: 1;
}

.modal-image-caption {
    text-align: center;
    font-size: 0.9em;
    color: #666;
    font-style: italic;
    margin-top: 10px;
}

.zoom-map-btn {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.zoom-map-btn:hover {
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

/* ========================================
   INDICATEUR AUDIO (VOIX OFF)
   ======================================== */

.audio-indicator {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 20px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    z-index: 10000;
    cursor: pointer;
    transition: all 0.3s;
}

.audio-indicator.hidden {
    display: none;
}

.audio-indicator:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.audio-wave {
    width: 20px;
    height: 20px;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.7; }
}

/* ========================================
   SECTION CONTENU (COLONNE CENTRE)
   ======================================== */

.modal-content-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.modal-title {
    font-size: 2em;
    font-weight: 700;
    color: #333;
    margin: 0;
    font-family: 'Georgia', serif;
}

/* ========================================
   ✅ NOUVEAU V2.9 : SECTION BLASON (3ÈME COLONNE)
   Créée dynamiquement par le JS
   ======================================== */

.modal-blason-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 10px;
}

.blason-column-image {
    width: auto;
    height: 200px;
    max-width: 150px;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.15));
    image-rendering: -webkit-optimize-contrast;
    transition: transform 0.3s;
}

.blason-column-image:hover {
    transform: scale(1.05);
}

/* ========================================
   ONGLETS
   ======================================== */

.modal-tabs {
    display: flex;
    gap: 10px;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 10px;
}

.modal-tab {
    background: transparent;
    border: none;
    padding: 10px 20px;
    font-size: 1em;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-tab:hover {
    background: #f5f5f5;
    color: #333;
}

.modal-tab.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.tab-icon {
    font-size: 1.2em;
}

/* ========================================
   CONTENU DES ONGLETS
   ======================================== */

.modal-tab-content {
    flex: 1;
    overflow-y: auto;
}

.tab-pane {
    animation: fadeIn 0.3s ease-out;
}

.tab-pane.hidden {
    display: none;
}

/* Support des deux classes : tab-content et tab-pane */
.tab-content {
    animation: fadeIn 0.3s ease-out;
}

.tab-content:not(.active) {
    display: none;
}

.modal-text {
    font-size: 1em;
    line-height: 1.8;
    color: #444;
    font-family: 'Georgia', serif;
}

.modal-text p {
    margin-bottom: 1em;
}

.modal-text h3 {
    font-size: 1.3em;
    font-weight: 600;
    color: #333;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}

.modal-text ul {
    margin-left: 1.5em;
    margin-bottom: 1em;
}

.modal-text li {
    margin-bottom: 0.5em;
}

/* ========================================
   LIENS VERS D'AUTRES PAGES
   ======================================== */

.modal-links {
    display: flex;
    gap: 15px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.modal-link {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 500;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.modal-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.link-icon {
    font-size: 1.3em;
}

/* ========================================
   PIED DE PAGE DU MODAL
   ======================================== */

.modal-footer {
    display: flex;
    justify-content: space-between;
    padding: 20px 30px;
    border-top: 1px solid #e0e0e0;
    background: #f9f9f9;
}

.modal-nav-btn {
    padding: 12px 24px;
    background: white;
    border: 2px solid #667eea;
    color: #667eea;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-nav-btn:hover {
    background: #667eea;
    color: white;
}

.modal-nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========================================
   RESPONSIVE - MOBILE & TABLETTE
   ======================================== */

@media (max-width: 768px) {
    .modal-body {
        grid-template-columns: 1fr !important;
    }
    
    .modal-blason-column {
        order: -1;
        flex-direction: row;
        justify-content: center;
    }
    
    .blason-column-image {
        height: 100px;
    }
    
    .modal-tabs {
        flex-wrap: wrap;
    }
    
    .modal-tab {
        font-size: 0.9em;
        padding: 8px 12px;
    }
    
    .modal-links {
        flex-direction: column;
    }
    
    .modal-footer {
        flex-direction: column;
        gap: 10px;
    }
    
    .carousel-item {
        width: 150px;
    }
    
    .carousel-item img {
        width: 140px;
        height: 80px;
    }
    
    .video-intro-container {
        min-height: 250px;
    }
    
    .modal-title {
        font-size: 1.5em;
    }
    
    .audio-indicator {
        bottom: 20px;
        right: 20px;
        padding: 10px 16px;
        font-size: 0.9em;
    }
}

@media (max-width: 480px) {
    .modal-container {
        max-height: 95vh;
        border-radius: 12px;
    }
    
    .modal-header {
        padding: 15px 20px;
    }
    
    .modal-breadcrumb {
        font-size: 0.8em;
    }
    
    .modal-body {
        padding: 20px;
        gap: 20px;
    }
    
    .modal-carousel {
        height: 120px;
    }
    
    .carousel-item {
        width: 120px;
    }
    
    .carousel-item img {
        width: 110px;
        height: 70px;
    }
    
    .video-intro-container {
        min-height: 200px;
    }
    
    .skip-btn {
        padding: 10px 18px;
        font-size: 0.9em;
    }
    
    .mute-btn {
        width: 40px;
        height: 40px;
        font-size: 1.2em;
    }
    
    .blason-column-image {
        height: 80px;
    }
}
/* Indicateur POI sur les images du carrousel */
.carousel-poi-indicator {
    position: absolute;
    bottom: 40px;
    right: 10px;
    background: rgba(102, 126, 234, 0.95);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.carousel-item[data-poi-id]:hover .carousel-poi-indicator {
    opacity: 1;
}

.carousel-item[data-poi-id] {
    position: relative;
}

.carousel-item[data-poi-id]:hover {
    transform: scale(1.02);
    transition: transform 0.3s;
}

.carousel-item[data-poi-id]::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to top, rgba(102, 126, 234, 0.3) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.carousel-item[data-poi-id]:hover::after {
    opacity: 1;
}