/* ============================================================
 * AGENDA V3 - CSS PREMIUM
 * ============================================================ */

/* 1. CONFIGURATION DES VARIABLES (LIGHT PAR DÉFAUT) */
:root {
    /* Couleurs principales */
    --v3-accent: #FF6233;
    --v3-gold: #D4AF37;

    /* Variables par défaut (Light) */
    --v3-bg: #ffffff;
    --v3-surface: #ffffff;
    --v3-text: #1a1a1a;
    --v3-muted: #666666;
    --v3-border: #e0e0e0;

    --v3-card-bg: #ffffff;
    --v3-card-border: #eeeeee;

    /* Polices */
    --font-head: 'Montserrat', sans-serif;
    --font-body: 'Lora', serif;
}

/* 2. VOTRE CONFIGURATION DARK MODE (INTEGRATION EXACTE) */
html[data-theme="dark"] body.agenda-v3-page,
html[data-theme="dark"] body.v3-mode {
    --bg: #0b0e14;
    --surface: #151a23;
    --text: #e8edf5;
    --muted: #9aa4b2;
    --border: #2a3241;

    --v3-bg: #0b0e14;
    --v3-surface: #151a23;
    --v3-text: #e8edf5;
    --v3-muted: #9aa4b2;
    --v3-border: #2a3241;

    --v3-card-bg: #151a23;
    --v3-card-border: #2a3241;

    --shadow-1: 0 6px 16px rgba(0,0,0,0.40);
    --shadow-hover: 0 12px 32px rgba(0,0,0,0.60);

    background: var(--bg);
    color: var(--text);
}

/* 3. LAYOUT GLOBAL & FIXES */
body.agenda-v3-page .v3-main-wrapper,
body.v3-mode .v3-main-wrapper {
    padding-top: 0 !important;
    max-width: none !important;
    width: 100% !important;
    overflow-x: clip !important;
}

.v3-main-container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 40px 100px;
    position: relative;
    z-index: 50;
    background: var(--v3-bg);
}

/* 4. HERO SECTION */
.v3-hero-section {
    position: relative;
    width: 100%;
    height: 50vh;
    min-height: 400px;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 60px;
}

.v3-hero-bg-wrapper {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.v3-hero-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.6;
    transition: transform 10s ease;
}

.v3-hero-section:hover .v3-hero-img {
    transform: scale(1.02);
}

.v3-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.2) 0%, rgba(18,18,18,0.9) 100%);
}

.v3-hero-content-layer {
    position: relative;
    z-index: 10;
    text-align: center;
    color: #fff;
    padding: 20px;
    max-width: 900px;
}

.v3-hero-badge {
    display: inline-block;
    font-family: var(--font-head);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: var(--v3-accent);
    font-size: 0.8rem;
    padding: 8px 20px;
    border: 1px solid rgba(255, 98, 51, 0.5);
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    margin-bottom: 20px;
}

.v3-hero-title {
    font-family: var(--font-head);
    font-weight: 700;
    font-size: clamp(1.65rem, 3.5vw, 3.2rem);
    line-height: 1.15;
    margin: 0 0 20px;
    text-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.v3-hero-title::before {
    content: '// ';
    color: var(--v3-accent);
}

.v3-hero-subtitle {
    font-family: var(--font-body);
    font-size: 1.2rem;
    font-style: italic;
    opacity: 0.9;
    max-width: 700px;
    margin: 0 auto;
    font-weight: 400;
}

.v3-scroll-down {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: none;
    border: none;
    cursor: pointer;
    z-index: 20;
    color: rgba(255,255,255,0.6);
}

.v3-scroll-down .mouse {
    display: block;
    width: 24px;
    height: 38px;
    border: 2px solid currentColor;
    border-radius: 20px;
    position: relative;
}

.v3-scroll-down .mouse span {
    display: block;
    width: 4px;
    height: 4px;
    background: currentColor;
    border-radius: 50%;
    position: absolute;
    top: 8px;
    left: 50%;
    margin-left: -2px;
    animation: scrollAnim 2s infinite;
}

@keyframes scrollAnim {
    0% { top: 8px; opacity: 1; }
    100% { top: 20px; opacity: 0; }
}

/* 5. GRILLE PRINCIPALE & STICKY */
.v3-layout-grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 80px;
    align-items: stretch;
}

.v3-aside {
    position: relative;
    height: 100%;
}

.v3-sticky-box {
    position: -webkit-sticky;
    position: sticky;
    top: 120px;
    display: flex;
    flex-direction: column;
    gap: 40px;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
}

/* 6. FEED & CARTES */
.v3-feed-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: 1px solid var(--v3-border);
    padding-bottom: 30px;
    margin-bottom: 50px;
}

.v3-feed-count {
    font-family: var(--font-head);
    font-size: 1rem;
    color: var(--v3-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.v3-feed-count span {
    color: var(--v3-text);
    font-size: 1.5rem;
    font-weight: 700;
    margin-right: 5px;
}

/* DATE DU JOUR HIGH-TECH & HAUT CONTRASTE */
.v3-day-group {
    position: relative;
    z-index: 10;
    margin-bottom: 50px;
}

.v3-day-divider {
    position: -webkit-sticky;
    position: sticky;
    top: 20px;
    z-index: 60;
    background: var(--v3-text);
    color: var(--v3-bg);
    width: max-content;
    max-width: 90vw;
    padding: 8px 24px;
    margin-bottom: 30px;
    border-radius: 30px;
    border-bottom: 3px solid var(--v3-accent);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    font-family: var(--font-head);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: capitalize;
}

html[data-theme="dark"] body.agenda-v3-page .v3-day-divider,
html[data-theme="dark"] body.v3-mode .v3-day-divider {
    background: #000000;
    color: var(--v3-text);
    border: 1px solid var(--v3-border);
    border-bottom: 3px solid var(--v3-accent);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.8);
}

/* CARTE ÉVÉNEMENT */
.v3-card {
    display: grid;
    grid-template-columns: 280px 1fr;
    background: var(--v3-card-bg);
    border: 1px solid var(--v3-border);
    box-shadow: 0 4px 15px rgba(0,0,0,0.06);
    margin-bottom: 40px;
    transition: all 0.3s ease;
    border-radius: 12px;
    overflow: hidden;
}

.v3-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    border-color: var(--v3-accent);
}

.v3-card.is-pro {
    background: #1a1a1a;
    border: 1px solid var(--v3-gold);
    color: #fff;
}

.v3-card.is-pro .v3-card-title { color: #fff; }
.v3-card.is-pro .v3-card-excerpt { color: #ccc; }
.v3-card.is-pro .v3-card-meta { color: var(--v3-gold); }
.v3-card.is-pro .v3-card-link { color: #fff; border-color: var(--v3-gold); }

.v3-card-img-wrap {
    position: relative;
    height: 100%;
    min-height: 240px;
    overflow: hidden;
}

.v3-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.v3-card:hover .v3-card-img {
    transform: scale(1.05);
}

.v3-badge {
    position: absolute;
    top: 20px;
    left: 20px;
    background: #fff;
    color: #000;
    font-family: var(--font-head);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 8px 16px;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 4px;
}

.v3-badge.badge-pro {
    background: var(--v3-gold);
    color: #000;
    box-shadow: 0 5px 15px rgba(212, 175, 55, 0.3);
}

.v3-badge.badge-sponsor {
    background: var(--v3-gold);
    color: #000;
    top: auto;
    bottom: 20px;
    font-size: 0.6rem;
}

.v3-card-body {
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.v3-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 15px;
    font-family: var(--font-head);
    font-size: 0.8rem;
    color: var(--v3-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.v3-card-meta i {
    color: var(--v3-accent);
    margin-right: 5px;
}

.v3-card-title {
    font-family: var(--font-head);
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0 0 15px;
    color: var(--v3-text);
    line-height: 1.2;
}

.v3-card-excerpt {
    font-family: var(--font-body);
    font-size: 1.05rem;
    color: var(--v3-muted);
    margin-bottom: 25px;
    line-height: 1.6;
}

.v3-card-link {
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--v3-text);
    text-transform: uppercase;
    letter-spacing: 2px;
    border-bottom: 2px solid var(--v3-accent);
    display: inline-block;
    padding-bottom: 5px;
    text-decoration: none;
    align-self: flex-start;
}

/* 7. WIDGETS & CALENDRIER */
.v3-widget-cal {
    border-bottom: 1px solid var(--v3-border);
    padding-bottom: 30px;
}

.v3-cal-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

#agx-cal-title {
font-family: var(--font-head);
font-weight: 700;
text-transform: uppercase;
font-size: 1rem;
letter-spacing: 1px;
color: var(--v3-text);
}

.v3-cal-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 0.75rem;
    color: var(--v3-muted);
    margin-bottom: 15px;
    font-family: var(--font-head);
}

.v3-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

.v3-cal-cell {
    aspect-ratio: 1/1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: var(--font-head);
    font-size: 0.9rem;
    color: #ccc;
    cursor: default;
    border: none;
    background: none;
    position: relative;
    border-radius: 8px;
}

.v3-cal-cell.has-event {
    color: var(--v3-text);
    font-weight: 700;
    cursor: pointer;
    border: 1px solid var(--v3-card-border);
    background: var(--v3-surface);
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

.v3-cal-cell.has-event:hover {
    border-color: var(--v3-accent);
}

.v3-cal-cell.is-selected {
    background: var(--v3-accent);
    color: #fff;
    border-color: var(--v3-accent);
}

.v3-cal-count {
    position: absolute;
    bottom: 2px;
    right: 2px;
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--v3-accent);
}

.v3-cal-cell.is-selected .v3-cal-count {
    color: #fff;
}

.v3-label {
    display: block;
    font-family: var(--font-head);
    font-size: 0.75rem;
    color: var(--v3-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
    font-weight: 700;
}

.v3-search {
    position: relative;
    margin-bottom: 0;
}

.v3-search i {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    color: var(--v3-text);
}

.v3-search input {
    width: 100%;
    padding: 10px 0;
    border: none;
    border-bottom: 1px solid var(--v3-border);
    background: transparent;
    font-family: var(--font-body);
    font-size: 1.1rem;
    outline: none;
    color: var(--v3-text);
}

.v3-search input:focus {
    border-color: var(--v3-accent);
}

.v3-toggles {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.v3-chip {
    border: 1px solid var(--v3-border);
    background: var(--v3-card-bg);
    padding: 8px 18px;
    cursor: pointer;
    color: var(--v3-text);
    font-family: var(--font-head);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: 0.2s;
    border-radius: 30px;
}

.v3-chip:hover {
    border-color: var(--v3-text);
}

.v3-chip.active {
    background: var(--v3-text);
    color: var(--v3-bg);
    border-color: var(--v3-text);
}

.v3-btn-reset {
    background: none;
    border: none;
    text-decoration: underline;
    color: var(--v3-muted);
    cursor: pointer;
    font-size: 0.8rem;
    font-family: var(--font-head);
}

/* 🚨 LIGHTBOX STYLES */
.v3-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(10, 15, 20, 0.95);
    backdrop-filter: blur(8px);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    padding: 20px;
}

.v3-lightbox.active {
    opacity: 1;
    pointer-events: auto;
}

.v3-lightbox-img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    margin-bottom: 25px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.v3-lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: rgba(255,255,255,0.7);
    font-size: 2.5rem;
    cursor: pointer;
    border: none;
    background: none;
    transition: color 0.2s;
}

.v3-lightbox-close:hover {
    color: #fff;
}

.v3-lightbox-cta {
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 0.85rem;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 2px;
    border-bottom: 2px solid var(--v3-accent);
    display: inline-block;
    padding-bottom: 5px;
    text-decoration: none;
    transition: color 0.3s, border-color 0.3s;
}

.v3-lightbox-cta:hover {
    color: var(--v3-accent);
}

.v3-lightbox-cta i {
    margin-left: 5px;
    transition: transform 0.3s;
}

.v3-lightbox-cta:hover i {
    transform: translateX(4px);
}

.v3-fab-cal, .v3-sidebar-close {
    display: none;
}

/* 8. MODULE D'AFFICHAGE : LISTE / COMPACT / GRILLE / TEXTE */
.v3-view-toggles {
    display: flex;
    gap: 8px;
}

.v3-view-btn {
    background: var(--v3-card-bg);
    border: 1px solid var(--v3-border);
    color: var(--v3-muted);
    width: 38px;
    height: 38px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 1rem;
}

.v3-view-btn:hover {
    border-color: var(--v3-text);
    color: var(--v3-text);
}

.v3-view-btn.active {
    background: var(--v3-text);
    color: var(--v3-bg);
    border-color: var(--v3-text);
}

/* Classes utilitaires d'affichage */
.desktop-only { display: flex; }
.mobile-only { display: none; }

/* Vue Compacte (PC) */
.v3-cards-stack.view-compact .v3-card {
    grid-template-columns: 160px 1fr;
    min-height: 140px;
    margin-bottom: 20px;
}

.v3-cards-stack.view-compact .v3-card-img-wrap {
    min-height: 140px;
}

.v3-cards-stack.view-compact .v3-card-body {
    padding: 20px;
}

.v3-cards-stack.view-compact .v3-card-title {
    font-size: 1.3rem;
    margin-bottom: 5px;
}

.v3-cards-stack.view-compact .v3-card-meta {
    margin-bottom: 10px;
}

.v3-cards-stack.view-compact .v3-card-excerpt {
    display: none;
}

/* Vue Grille (PC) */
.v3-cards-stack.view-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
}

.v3-cards-stack.view-grid .v3-card {
    grid-template-columns: 1fr;
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
}

.v3-cards-stack.view-grid .v3-card-img-wrap {
    min-height: 180px;
    max-height: 200px;
}

.v3-cards-stack.view-grid .v3-card-body {
    padding: 25px;
    flex-grow: 1;
}

.v3-cards-stack.view-grid .v3-card-title {
    font-size: 1.3rem;
    margin-bottom: 10px;
}

.v3-cards-stack.view-grid .v3-card-excerpt {
    font-size: 0.95rem;
    margin-bottom: 20px;
}

/* 9. RESPONSIVE & MOBILE MAGIC */
@media (max-width: 1024px) {
    .v3-main-container {
        padding: 0 20px 100px;
    }

    .v3-layout-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    /* Gestion de la vue Mobile Globale */
    .v3-card {
        grid-template-columns: 1fr;
        margin-bottom: 30px !important; /* 🚨 Cartes parfaitement décollées */
    }

    .v3-card-img-wrap {
        min-height: 250px;
        max-height: 350px;
    }

    .v3-card-body {
        padding: 25px;
    }

    /* 🚨 Vue Mobile "Texte sans Image" */
    .v3-cards-stack.view-text .v3-card-img-wrap {
        display: none !important; /* Disparition totale de l'image */
    }

    .v3-cards-stack.view-text .v3-card-body {
        padding: 20px;
    }

    /* Nettoyage des classes "PC" qui pourraient rester coincées */
    .v3-cards-stack.view-grid,
    .v3-cards-stack.view-compact {
        display: block;
    }

    /* Le FAB (Bouton Flottant) */
    .v3-fab-cal {
        display: flex;
        position: fixed;
        bottom: 30px;
        right: 20px;
        width: 60px;
        height: 60px;
        background: var(--v3-accent);
        color: #fff;
        border-radius: 50%;
        align-items: center;
        justify-content: center;
        font-size: 1.5rem;
        z-index: 90;
        border: none;
        box-shadow: 0 4px 20px rgba(255,98,51,0.5);
        cursor: pointer;
        transition: transform 0.2s;
    }

    .v3-fab-cal:active {
        transform: scale(0.9);
    }

    /* Sidebar transformée en Drawer Mobile */
    .v3-aside {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--v3-surface);
        z-index: 100;
        transform: translateY(100%);
        transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        overflow-y: auto;
        padding: 80px 30px 120px;
        margin: 0;
    }

    .v3-aside.is-open {
        transform: translateY(0);
    }

    .v3-sidebar-close {
        display: block;
        background: none;
        border: none;
        color: var(--v3-text);
        font-size: 2.5rem;
        position: absolute;
        top: 20px;
        right: 30px;
        cursor: pointer;
    }

    .v3-sticky-box {
        position: static;
        max-height: none;
        overflow: visible;
    }

    /* Calendrier Mobile affiné */
    .v3-cal-cell {
        aspect-ratio: auto;
        height: 38px;
        font-size: 0.85rem;
        border-radius: 6px;
    }

    .v3-cal-grid {
        gap: 4px;
    }

    .v3-widget-cal {
        padding-bottom: 15px;
    }

    .v3-filter-group {
        margin-top: 20px !important;
    }

    /* Affichage des boutons mobile / masquer les boutons PC */
    .desktop-only { display: none !important; }
    .mobile-only { display: flex !important; }
    .v3-view-toggles { display: flex; } /* On s'assure que le conteneur reste visible */
}

/* 10. INTEGRATION SEO & SEMANTIQUE */
.v3-intro-text {
    margin: 30px 0 40px;
    padding-left: 15px;
    border-left: 3px solid var(--v3-accent);
    color: var(--v3-text);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.6;
}

.v3-seo-section {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid var(--v3-border);
    width: 100%;
}

.v3-seo-inner {
    width: 100%;
    max-width: 100%;
}

.v3-seo-title {
    font-family: var(--font-head);
    font-size: 1.25rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 20px;
    color: var(--v3-text);
    display: flex;
    align-items: center;
    gap: 10px;
}

.v3-seo-title i {
    color: var(--v3-accent);
}

.v3-seo-content {
    font-family: var(--font-body);
    color: var(--v3-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    column-count: 2;
    column-gap: 40px;
    text-align: justify;
}

.v3-seo-note {
    display: block;
    margin-top: 15px;
    font-size: 0.85em;
    opacity: 0.7;
    font-style: italic;
    break-inside: avoid;
}

.v3-seo-tags {
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.v3-tag-pill {
    background: var(--v3-surface);
    padding: 4px 12px;
    border-radius: 4px;
    font-family: var(--font-head);
    font-size: 0.75rem;
    color: var(--v3-text);
    border: 1px solid var(--v3-border);
    text-transform: uppercase;
}

@media (max-width: 768px) {
    .v3-seo-content {
        column-count: 1;
        text-align: left;
    }
    .v3-seo-section {
        padding-top: 20px;
        margin-top: 30px;
    }
}
