/**
 * Styles complets pour le plugin Cinema Programmation
 * Version avec largeurs fixes pour alignement précis des quarts d'heure
 */

/* ==========================================================================
   CONFIGURATION TIMELINE - Largeurs fixes
   ========================================================================== */

   :root {
    --timeline-hour-width: 66px;
    --timeline-quarter-width: 16.5px; /* 66px / 4 */
    --timeline-total-width: 990px; /* 15 heures × 66px */
    --timeline-height: 46px;
}

/* ==========================================================================
   TIMELINE PRINCIPALE
   ========================================================================== */

.cinema-timeline {
    position: relative;
    background-color: #f9fafb;
    padding: 16px;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 2rem;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    box-sizing: border-box;
}

.cinema-timeline.timeline-empty {
    opacity: 0.6;
    background-color: #f5f5f5;
}

/* ==========================================================================
   EN-TÊTE DE LA TIMELINE
   ========================================================================== */

.cinema-header {
    display: flex;
    min-width: 160px;
    flex-direction: column;
    flex-shrink: 0;
}

.cinema-header h3 {
    font-size: 14px;
    font-weight: bold;
    margin: 0 0 4px 0;
    line-height: 1.2;
}

.cinema-header h4 {
    font-size: 12px;
    margin: 0 0 8px 0;
    line-height: 1.2;
}

.venue-stats {
    font-size: 10px;
    color: #6b7280;
}

.event-count {
    background: #e5e7eb;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 9px;
}

/* ==========================================================================
   CONTAINER TIMELINE - Largeur fixe calculée
   ========================================================================== */

.timeline-container {
    display: flex;
    position: relative;
    width: var(--timeline-total-width);
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
    box-sizing: border-box;
    flex-shrink: 0;
}

.timeline-container::-webkit-scrollbar {
    height: 6px;
}

.timeline-container::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.timeline-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.timeline-container::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ==========================================================================
   INTERVALS DE TEMPS - Largeur fixe
   ========================================================================== */

.time-interval {
    flex: 0 0 var(--timeline-hour-width);
    position: relative;
    box-sizing: border-box;
    width: var(--timeline-hour-width);
}

.hour-label {
    font-size: 12px;
line-height: 2.2;
    text-align: left;
    color: #6b7280;
    font-weight: 500;
    white-space: nowrap;
}

.interval-grid {
    display: flex;
    height: var(--timeline-height);
    width: 100%;
    box-sizing: border-box;
    border-right: 1px solid rgba(0, 5, 72, 0.3);
}

.grid-row {
    flex: 1;
    box-sizing: border-box;
    border-right: 1px dashed rgba(0, 5, 72, 0.2);
    position: relative;
    width: var(--timeline-quarter-width);
}

.grid-row:last-child {
    border-right: none;
}

/* Classe de debug pour visualiser les quarts d'heure */
.debug-quarters .grid-row {
    background: repeating-linear-gradient(
        to right,
        transparent,
        transparent calc(var(--timeline-quarter-width) - 1px),
        rgba(255, 0, 0, 0.1) calc(var(--timeline-quarter-width) - 1px),
        rgba(255, 0, 0, 0.1) var(--timeline-quarter-width)
    );
}

/* ==========================================================================
   CONTAINER DES FILMS
   ========================================================================== */

.movies-container {
    position: absolute;
    top: 6px;
    left: 0px;
    right: 0px;
    width: 100%;
    box-sizing: border-box;
}

/* ==========================================================================
   CARTES DE FILMS/ÉVÉNEMENTS
   ========================================================================== */

.movie-card {
    position: absolute;
    height: var(--timeline-height);
    top: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid rgba(0,0,0,0.1);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    box-sizing: border-box;
    animation: slideIn 0.3s ease-out;
}

.movie-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    z-index: 10;
}

.movie-card:focus {

}

/* Types de films */
.movie-card.film {
    background: linear-gradient(135deg, #fcd34d 0%, #f59e0b 100%);
    border-color: #d97706;
    color: #1f2937;
}

.movie-card.hommage {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border-color: #b91c1c;
    color: white;
}

.movie-card.autre {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-color: #047857;
    color: white;
}

.movie-card .movie-time {
    display: none;
    position: absolute;
    font-size: 8px;
    opacity: .7;
    left: 0px;
}
.movie-card .movie-time > div{
background: rgba(0,0,0,0.1);
padding: 1px 3px;
border-radius: 2px;
}


/* Contenu des cartes */
.movie-title {
    font-size: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    max-width: 100%;
}

.movie-card.hommage .movie-title,
.movie-card.autre .movie-title {
    color: white;
}

.movie-title-text {
    font-weight: bold;
    line-height: 1.1;
    margin-bottom: 1px;
}

.movie-subtitle {
    font-size: 8px;
    opacity: 0.8;
    line-height: 1;
}

.movie-info {
    position: absolute;
    bottom: 2px;
    right: 4px;
    font-size: 7px;
    opacity: 0.7;
}

.movie-duration {
    background: rgba(0,0,0,0.1);
    padding: 1px 3px;
    border-radius: 2px;
}

/* ==========================================================================
   ÉTATS VIDES
   ========================================================================== */

.no-events {
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    height: var(--timeline-height);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #9ca3af;
    font-style: italic;
}

.no-schedule,
.no-venues {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
    background: #f9fafb;
    border-radius: 8px;
    margin: 20px auto;
    max-width: 1200px;
}

/* ==========================================================================
   TITRES ET SECTIONS
   ========================================================================== */

.day-title {
    font-size: 18px;
    margin: 2rem 0 1rem 0;
    font-weight: bold;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    text-transform: capitalize;
}

.programme {
    padding: 2rem 0;
}

.programmation-annuelle {
    max-width: 1200px;
    margin: 0 auto;
}

.programmation-annuelle h3 {
    font-size: 16px;
    line-height: 1;
    margin: 0rem;
    text-transform: uppercase;
}

.programmation-annuelle h4 {
    font-size: 10px;
    margin: 0rem;
}

.jour-programmation {
    margin-bottom: 3rem;
}

/* ==========================================================================
   NAVIGATION ENTRE JOURS
   ========================================================================== */

#day-navigation {
    position: sticky;
    top: 20px;
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    text-align: center;
    z-index: 100;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.day-nav-btn {
    background: #e5e7eb;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    color: #374151;
}

.day-nav-btn:hover {
    background: #d1d5db;
}

.day-nav-btn.active {
    background: #1e3a8a;
    color: white;
}

/* ==========================================================================
   TOOLTIPS
   ========================================================================== */

.cinema-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    z-index: 1000;
    pointer-events: none;
    max-width: 250px;
    line-height: 1.3;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.cinema-custom-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    z-index: 1000;
    pointer-events: none;
    max-width: 250px;
    line-height: 1.3;
    display: none;
}

.tooltip-title {
    font-weight: bold;
    margin-bottom: 2px;
}

.tooltip-subtitle {
    color: #d1d5db;
    font-size: 11px;
    margin-bottom: 4px;
}

.tooltip-time {
    color: #fbbf24;
    font-size: 11px;
    font-weight: 500;
}

.cinema-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border: 5px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
}

/* ==========================================================================
   MODAL
   ========================================================================== */

.event-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 8px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.modal-header {
    padding: 20px 20px 10px 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.modal-header h3 {
    margin: 0;
    color: #1e3a8a;
    font-size: 18px;
    line-height: 1.3;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    margin-left: 15px;
    flex-shrink: 0;
}

.modal-close:hover {
    color: #374151;
}

.modal-body {
    padding: 20px;
}

.event-type {
    color: #1e3a8a;
    font-weight: 600;
    margin: 0 0 8px 0;
    font-size: 14px;
}

.event-subtitle {
    color: #6b7280;
    margin: 0 0 15px 0;
    font-size: 14px;
}

.event-schedule {
    background: #f9fafb;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid #1e3a8a;
}

.event-duration {
    color: #6b7280;
    margin-left: 10px;
}

/* ==========================================================================
   SÉANCES DE FILM
   ========================================================================== */

.film-seances {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.film-seances h3 {
    font-size: 18px;
    margin: 0;
    margin-bottom: 20px;

}

.seances-jour {
    margin-bottom: 25px;
}

.seances-date {
    color: #374151;
    font-size: 16px;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e5e7eb;
    text-transform: capitalize;
}

.seance-item {
    display: flex;
    align-items: flex-start;
    padding: 10px;
    border-bottom: 1px solid #f3f4f6;
    gap: 20px;
    transition: background-color 0.2s;
}

.seance-item:last-child {
    border-bottom: none;
}

.seance-item:hover {
    background-color: #f9fafb;
}

.seance-heure {
    min-width: 120px;
    font-size: 16px;
    color: #1e3a8a;
    flex-shrink: 0;
}

.seance-heure strong {
    font-weight: 600;
}

.heure-fin {
    color: #6b7280;
    font-size: 14px;
    margin-left: 5px;
}

.seance-lieu {
    flex: 1;
    color: #374151;
    font-size: 14px;
}

.cinema-name {
    font-weight: 600;
    font-size: 13px;
    line-height: 1;
    text-transform: uppercase;
    margin-bottom: 0;
}

.salle-name {
    font-size: 12px;
    text-transform: uppercase;
    color: #6b7280;
    font-weight: 500;
    margin-bottom: 6px;
}

.cinema-adresse {
    font-size: 11px;
    color: #9ca3af;
    margin-bottom: 4px;
    line-height: 1.3;
}

.salle-places {
    font-size: 10px;
    color: #6b7280;
    margin-bottom: 4px;
}

.salle-equipements {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.equipement-tag {
    background: #e5e7eb;
    color: #374151;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 9px;
    font-weight: 500;
}

.seance-actions {
    min-width: 150px;
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}

.btn-voir-programme,
.btn-voir-plan,
.btn-telephone {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 30px;
    text-decoration: none;
    font-size: 11px;
    text-align: center;
    transition: background 0.2s;
    font-weight: 500;
}

.btn-voir-programme {
    background: #1e3a8a;
    color: white;
}

.btn-voir-programme:hover {
    background: #1e40af;
    color: white;
    text-decoration: none;
}

.btn-voir-plan {
    background: #059669;
    color: white;
}

.btn-voir-plan:hover {
    background: #047857;
    color: white;
    text-decoration: none;
}

.btn-telephone {
    background: #6b7280;
    color: white;
}

.btn-telephone:hover {
    background: #4b5563;
    color: white;
    text-decoration: none;
}

/* ==========================================================================
   ÉTATS DE CHARGEMENT
   ========================================================================== */

.timeline-loading {
    text-align: center;
    padding: 40px;
    color: #6b7280;
}

.timeline-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #e5e7eb;
    border-top-color: #1e3a8a;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

/* ==========================================================================
   ADMIN WORDPRESS
   ========================================================================== */

.acf-field[data-name="cinema_taxonomy"] select,
.acf-field[data-name="salle_taxonomy"] select,
.acf-field[data-name="type_evenement"] input {
    margin-bottom: 10px;
}

.acf-field[data-name="evenements"] .acf-row {
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 15px;
    padding: 15px;
    background: #fafafa;
}

.acf-field[data-name="evenements"] .acf-row:nth-child(even) {
    background-color: #f5f5f5;
}

.column-date_prog,
.column-nb_events,
.column-cinema {
    width: 12%;
}

/* Message d'absence de séances */
.film-seances p {
    color: #6b7280;
    font-style: italic;
    text-align: center;
    padding: 20px 0;
}

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================================================
   RESPONSIVE DESIGN - Desktop > 1200px (Défaut)
   ========================================================================== */

/* Les variables par défaut sont déjà définies pour desktop */

/* ==========================================================================
   RESPONSIVE DESIGN - Tablette 680px - 1200px
   ========================================================================== */

@media screen and (max-width: 1200px) {
    :root {
        --timeline-hour-width: 55px;
        --timeline-quarter-width: 13.75px;
        --timeline-total-width: 825px; /* 15 × 55px */
    }
    
    .cinema-timeline {
        padding: 12px;
        gap: 0.75rem;
    }
    
    .cinema-header {
        min-width: 140px;
    }
    
    .cinema-header h1 {
        font-size: 13px;
    }
    
    .cinema-header h2 {
        font-size: 11px;
    }
    
    .hour-label {
        font-size: 11px;
    }
    
    .movie-title {
        font-size: 9px;
    }
    
    .movie-subtitle {
        font-size: 7px;
    }
    
    #day-navigation {
        padding: 12px;
        gap: 6px;
    }
    
    .day-nav-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
}

/* ==========================================================================
   RESPONSIVE DESIGN - Mobile < 680px
   ========================================================================== */

@media screen and (max-width: 680px) {
    :root {
        --timeline-hour-width: 44px;
        --timeline-quarter-width: 11px;
        --timeline-total-width: 660px; /* 15 × 44px */
    }
    
    .cinema-timeline {
        flex-direction: column;
        gap: 0.5rem;
        padding: 10px;
        position: relative;
    }
    
    .cinema-header {
        min-width: auto;
        width: 100%;
        text-align: center;
        margin-bottom: 10px;
    }
    
    .cinema-header h1 {
        font-size: 12px;
    }
    
    .cinema-header h2 {
        font-size: 10px;
    }
    
    .timeline-container {
        width: 100% !important;
        overflow: hidden;
        -webkit-overflow-scrolling: touch;
    }

    .time-interval {
        display: none;
    }

    .movies-container {
        position: relative;
        top: 0;
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: .5rem;
    }

    .movie-card .movie-time {
        display: block;
    }

    .movie-card {
        position: relative;
        width: 100%!important;
        left: 0!important;
        top:0!important;
    }
    
    .hour-label {
        font-size: 10px;
    }
    
   
    
    .day-title {
        font-size: 16px;
        margin: 1.5rem 0 0.75rem 0;
    }
    
    .programme {
        padding: 1.5rem 0;
    }
    
    #day-navigation {
        padding: 10px;
        gap: 4px;
    }
    
    .day-nav-btn {
        padding: 6px 10px;
        font-size: 11px;
    }
    
    /* Séances responsive */
    .seance-item {
        flex-direction: column;
        gap: 10px;
    }
    
    .seance-heure {
        min-width: auto;
    }
    
    .seance-actions {
        min-width: auto;
        text-align: left;
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .btn-voir-programme,
    .btn-voir-plan,
    .btn-telephone {
        flex: 1;
        min-width: 120px;
    }
    
    .modal-content {
        margin: 10px;
        max-height: 90vh;
    }
    
    .modal-header {
        padding: 15px;
    }
    
    .modal-body {
        padding: 15px;
    }
}

/* ==========================================================================
   RESPONSIVE DESIGN - Très petit écran < 480px
   ========================================================================== */

@media screen and (max-width: 480px) {
    :root {
        --timeline-hour-width: 36px;
        --timeline-quarter-width: 9px;
        --timeline-total-width: 540px; /* 15 × 36px */
    }
    
    .cinema-timeline {
        padding: 8px;
        margin-bottom: 1.5rem;
    }
    
    .cinema-header h1 {
        font-size: 11px;
    }
    
    .cinema-header h2 {
        font-size: 9px;
    }
    
    
    .day-nav-btn {
        padding: 4px 8px;
        font-size: 10px;
    }
    
    .film-seances {
        padding: 15px;
    }
    
    .seance-actions {
        gap: 4px;
    }
    
    .btn-voir-programme,
    .btn-voir-plan,
    .btn-telephone {
        font-size: 10px;
        padding: 5px 10px;
        min-width: 100px;
    }
}

/* ==========================================================================
   PRINT STYLES
   ========================================================================== */

@media print {
    .cinema-timeline {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .movie-card {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .day-nav-btn {
        display: none;
    }
    
    .timeline-container {
        overflow: visible;
    }
}

/* ==========================================================================
   ACCESSIBILITÉ
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .movie-card,
    .timeline-loading::after {
        animation: none;
    }
    
    .movie-card:hover {
        transform: none;
    }
    
    * {
        transition: none !important;
    }
}

@media (prefers-contrast: high) {
    .cinema-timeline {
        border: 2px solid #000;
    }
    
    .movie-card {
        border: 2px solid #000;
    }
    
    .grid-row {
        border-right: 1px solid #000;
    }
    
    .interval-grid {
        border-right: 2px solid #000;
    }
}

/* Focus visible pour la navigation au clavier */
.movie-card:focus-visible {
    outline: 3px solid #1e3a8a;
    outline-offset: 2px;
}

.day-nav-btn:focus-visible {
    outline: 2px solid #1e3a8a;
    outline-offset: 2px;
}