/* ===========================================================================
   Funambules Grille CAC v2
   La GRILLE est rendue par le plugin v2 (do_shortcode). On embarque ici une
   COPIE du CSS de la grille de v2 pour que l'affichage (et surtout les images)
   fonctionne même si le style.css de v2 sur le serveur est une version plus
   ancienne. Règles identiques à celles de funambules-grille-v2/style.css.
   Le reste = le drawer (basé sur le mockup). Couleurs : #1C3654, #D56766.
   =========================================================================== */

/* ===== Pleine largeur automatique =====
   Le shortcode s'étend seul sur toute la largeur de la page (full-bleed), sans
   qu'il faille régler le bloc en « pleine largeur » dans l'éditeur. Scopé à ce
   plugin (n'affecte donc pas la page a-laffiche-2 qui utilise v2 directement). */
.funambules-cac-fullwidth {
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    padding-left: clamp(1rem, 4vw, 4rem);
    padding-right: clamp(1rem, 4vw, 4rem);
    box-sizing: border-box;
}

/* Contrôles de filtres CAC : toutes les « cases » à la même hauteur (scopé CAC) */
.funambules-cac-fullwidth .grid-filters select,
.funambules-cac-fullwidth .grid-filters input,
.funambules-cac-fullwidth .cac-filter-reset {
    height: 2.5rem;
    padding: 0 0.75rem;
    box-sizing: border-box;
    border-radius: 6px;
    font-size: 0.9rem;
    vertical-align: middle;
    line-height: normal;
}

/* Bouton « Réinitialiser » : couleurs de la charte (corail), pas de jaune du thème.
   !important pour battre un éventuel style de bouton imposé par le thème. */
.funambules-cac-fullwidth .cac-filter-reset {
    background: #D56766 !important;
    color: #fff !important;
    border: none !important;
    font-weight: 600;
    cursor: pointer;
}
.funambules-cac-fullwidth .cac-filter-reset:hover {
    background: #c4544f !important;
    color: #fff !important;
}
/* Au cas où le « jaune » serait un focus du thème sur les filtres */
.funambules-cac-fullwidth .grid-filters select:focus,
.funambules-cac-fullwidth .grid-filters input:focus {
    outline: 2px solid #D56766;
}
/* Masquer les options de filtre devenues indisponibles (certains navigateurs
   ignorent l'attribut hidden sur <option>) */
.grid-filters select option[hidden] { display: none; }

/* ===== Grille calendrier CAC (copie de v2, pour autonomie d'affichage) ===== */
.calendar-grid-cac {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-top: 1rem;
    width: 100%;
}
@media (max-width: 1400px) { .calendar-grid-cac { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 992px)  { .calendar-grid-cac { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px)  { .calendar-grid-cac { grid-template-columns: 1fr; } }

.cac-projection {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
}
.cac-projection__date {
    background: #000;
    color: #fff;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.9rem;
    padding: 0.6rem 0.75rem;
    text-align: center;
    letter-spacing: 0.05em;
    border-radius: 6px;
    margin-bottom: 0.25rem;
    flex-shrink: 0;
}
@media (max-width: 768px) {
    .cac-projection__date { font-size: 1rem; padding: 0.65rem 0.75rem; }
}
.cac-projection__poster {
    display: block;
    text-decoration: none;
    color: inherit;
    flex: 1;
}
.cac-projection__image {
    width: 100%;
    aspect-ratio: 2/3;
    background-size: cover;
    background-position: center;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}
.cac-projection__overlay {
    position: absolute;
    inset: 0;
    border-radius: 6px;
    background: transparent;
    transition: background 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}
.cac-projection:hover .cac-projection__overlay {
    background: linear-gradient(to bottom,
        rgba(0,0,0,0) 0%,
        rgba(0,0,0,0) 55%,
        rgba(0,0,0,0.85) 100%
    );
}
.cac-projection__info {
    padding: 0.75rem;
    opacity: 0;
    transform: translateY(8px);
    transition: all 0.4s ease-in-out;
    color: #fff;
}
.cac-projection:hover .cac-projection__info { opacity: 1; transform: translateY(0); }
.cac-projection__info .movie-title {
    font-weight: bold;
    font-size: 1.1rem;
    margin: 0 0 0.2rem;
}
.cac-projection__info .movie-directors {
    font-size: 0.95rem;
    margin: 0 0 0.3rem;
    opacity: 0.85;
}
.cac-projection__info .movie-directors a { color: #fff; }
.cac-projection__info .entry-summary {
    font-size: 0.75rem;
    opacity: 0.8;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.cac-projection .projection-place {
    padding: 0.4rem 0.75rem 0.5rem;
    color: rgba(255,255,255,0.75);
    font-size: 0.75rem;
    text-align: right;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}
.cac-projection .projection-place p { margin: 0; }
.cac-projection .movie-tags {
    font-size: 0.78rem;
    margin-top: 0.3rem;
    background: none;
    padding: 0;
}
.cac-projection .movie-tags a { color: var(--wp--style--color--link); }

/* Nom de la salle : badge visible en permanence sur la carte (comme le mockup).
   Scopé à ce plugin (.funambules-cac-fullwidth) pour ne pas toucher a-laffiche-2. */
.funambules-cac-fullwidth .cac-projection .projection-place {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 2;
    background-color: rgba(0, 0, 0, 0.8);          /* fond noir ~80 % (comme la grille d'origine) */
    color: #91B2AC;                                 /* turquoise du site (codé en dur, comme l'ancien v2) */
    padding: 0.15rem 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: right;
    text-shadow: none;
    max-width: 100%;
    overflow: hidden;
}
.funambules-cac-fullwidth .cac-projection .projection-place p { margin: 0; }
.funambules-cac-fullwidth .cac-projection .projection-place a {
    color: #91B2AC;
    text-decoration: none;
}

/* ===== Drawer (basé sur le mockup) ===== */

/* Carte active (sélection) */
.cac-projection.is-active {
    outline: 2px solid #D56766;
    outline-offset: 1px;
}
.cac-projection__poster {
    cursor: pointer;
}

/* ── Overlay ──────────────────────────────────────────────────────────── */
.cac-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 9998; /* sous le menu du site, cohérent avec les autres drawers */
    opacity: 0;
    transition: opacity 0.25s ease;
}
.cac-drawer-overlay.is-open {
    opacity: 1;
}

/* ── Drawer ───────────────────────────────────────────────────────────── */
.cac-drawer {
    position: fixed;
    top: calc(var(--wp-admin--admin-bar--height, 0px) + 50px); /* démarre sous le menu (comme les fiches) */
    right: 0;
    bottom: 0;
    width: 380px;
    max-width: 100%;
    background: #fff;
    z-index: 9999; /* sous le menu du site, cohérent avec les autres drawers */
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.18);
}
.cac-drawer.is-open {
    transform: translateX(0);
}
body.cac-drawer-open {
    overflow: hidden;
}

/* ── Header ───────────────────────────────────────────────────────────── */
.cac-drawer__header {
    background: #1C3654;
    color: #fff;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex-shrink: 0;
}
.cac-drawer__poster {
    width: 84px;
    height: 120px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    background: #495e76;
}
.cac-drawer__heading {
    flex: 1;
    padding-right: 4px;
}
.cac-drawer__title {
    font-size: 22px;
    font-weight: 600;
    line-height: 1.25;
    margin: 0 0 4px;
    color: #fff;
}
.cac-drawer__director {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
}
.cac-drawer__close {
    position: relative;
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 7px !important; /* !important : le thème CAC force sinon des coins carrés sur les <button> */
    background: #fff !important;
    border: 1px solid rgba(0, 0, 0, 0.12);
    cursor: pointer;
    padding: 0;
    font-size: 0 !important; /* masque tout glyphe &times; résiduel (le thème force sinon un font-size) */
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}
.cac-drawer__close::before,
.cac-drawer__close::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 22px;
    height: 3.5px;
    background: #1C3654; /* couleur du drawer CAC en dur (le --site-accent-color du site CAC vaut du blanc) */
    border-radius: 1px;
}
.cac-drawer__close::before { transform: translate(-50%, -50%) rotate(45deg); }
.cac-drawer__close::after  { transform: translate(-50%, -50%) rotate(-45deg); }
.cac-drawer__close:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* ── Body ─────────────────────────────────────────────────────────────── */
.cac-drawer__body {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
}
.cac-drawer__row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 0.5px solid #eee;
}
.cac-drawer__row:last-child {
    border-bottom: none;
}
.cac-drawer__icon {
    color: #D56766;
    font-size: 22px;
    flex-shrink: 0;
    margin-top: 1px;
}
/* Icône lieu cliquable → Google Maps */
.cac-drawer__iconlink {
    display: inline-flex;
    text-decoration: none;
    cursor: pointer;
    flex-shrink: 0;
}
.cac-drawer__iconlink:hover .cac-drawer__icon {
    opacity: 0.7;
}
.cac-drawer__rowtext {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.cac-drawer__label {
    font-size: 13px;
    color: #888;
}
.cac-drawer__value {
    font-size: 16px;
    color: #1C3654;
    word-wrap: break-word;
}
.cac-drawer__address {
    font-size: 14px;
    color: #888;
}
.cac-drawer__value a {
    color: #D56766;
}

/* ── Footer ───────────────────────────────────────────────────────────── */
.cac-drawer__footer {
    flex-shrink: 0;
    padding: 1rem 1.25rem;
    border-top: 0.5px solid #eee;
    display: flex;
    gap: 8px;
}
.cac-drawer__btn {
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 14px;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
}
.cac-drawer__btn--tickets {
    flex: 1;
    background: #D56766;
    color: #fff;
    border: 1px solid #D56766;
    font-weight: 500;
}
.cac-drawer__btn--tickets:hover {
    color: #fff;
    opacity: 0.92;
}
.cac-drawer__btn--more {
    background: none;
    color: #1C3654;
    border: 1px solid #1C3654;
    white-space: nowrap;
}
.cac-drawer__btn--more:hover {
    background: #1C3654;
    color: #fff;
}

/* ── Partenaires ──────────────────────────────────────────────────────── */
.cac-drawer__partners {
    flex-shrink: 0;
    padding: 0.75rem 1.25rem 0;
}
.cac-drawer__partners-label {
    display: block;
    font-size: 12px;
    color: #888;
    margin-bottom: 8px;
}
.cac-drawer__partners-logos {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}
.cac-drawer__partners-logos img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 130px;
    object-fit: contain;
    border-radius: 6px;
}

/* ── Mobile : pleine largeur ──────────────────────────────────────────── */
@media (max-width: 480px) {
    .cac-drawer {
        width: 100%;
    }
}
