/* ============================================================
   DISCOVERY PAGE — "Que regarder ce soir ?"
   ============================================================ */

#discoverySection {
    display: none;
    min-height: 100vh;
    padding: 0 0 80px;
    animation: fadeIn 0.4s ease;
}

/* ── Header ──────────────────────────────────────────────── */
.discovery-header {
    padding: 32px 0 24px;
    text-align: center;
    position: relative;
}

.discovery-header-back {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.07);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.discovery-header-back:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.06);
    transform: translateY(-50%) scale(1.05);
}

.discovery-header-icon {
    font-size: 36px;
    margin-bottom: 8px;
    display: block;
    filter: drop-shadow(0 0 20px rgba(251,191,36,0.4));
}

.discovery-header h1 {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    margin-bottom: 6px;
}

.discovery-header p {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ── Panneau de filtres ──────────────────────────────────── */
.discovery-filters {
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 20px;
    padding: 28px;
    margin-bottom: 28px;
}

.discovery-filters-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

@media (max-width: 640px) {
    .discovery-filters-grid {
        grid-template-columns: 1fr;
    }
}

/* Groupe de filtre */
.filter-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.filter-group.full-width {
    grid-column: 1 / -1;
}

.filter-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-label-icon {
    font-size: 14px;
}

/* ── Genres — pastilles cliquables ──────────────────────── */
.genre-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.genre-pill-btn {
    padding: 6px 14px;
    border-radius: 20px;
    border: 1.5px solid rgba(255,255,255,0.1);
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-family: inherit;
}

.genre-pill-btn:hover {
    border-color: rgba(99,102,241,0.5);
    color: var(--text-primary);
    background: rgba(99,102,241,0.08);
}

.genre-pill-btn.selected {
    border-color: var(--primary);
    background: rgba(59,130,246,0.18);
    color: var(--primary);
    box-shadow: 0 0 0 1px rgba(59,130,246,0.2);
}

/* ── Sliders ─────────────────────────────────────────────── */
.filter-slider-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-slider-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.filter-slider-value {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
    background: rgba(59,130,246,0.12);
    padding: 2px 10px;
    border-radius: 6px;
    min-width: 60px;
    text-align: center;
}

.filter-slider-range {
    font-size: 11px;
    color: var(--text-muted);
}

input[type="range"].discovery-range {
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 4px;
    background: rgba(255,255,255,0.1);
    outline: none;
    cursor: pointer;
    transition: background 0.2s;
}

input[type="range"].discovery-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.25);
    transition: box-shadow 0.2s;
}

input[type="range"].discovery-range::-webkit-slider-thumb:hover {
    box-shadow: 0 0 0 5px rgba(59,130,246,0.35);
}

input[type="range"].discovery-range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    border: none;
    cursor: pointer;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.25);
}

/* ── Toggles / Chips pour options ───────────────────────── */
.filter-chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-chip {
    padding: 7px 14px;
    border-radius: 10px;
    border: 1.5px solid rgba(255,255,255,0.08);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-chip:hover {
    border-color: rgba(99,102,241,0.4);
    color: var(--text-primary);
}

.filter-chip.selected {
    border-color: var(--primary);
    background: rgba(59,130,246,0.15);
    color: var(--primary);
}

/* ── Bouton "Trouver des films" ──────────────────────────── */
.discovery-cta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-top: 4px;
}

.discovery-search-btn {
    width: 100%;
    max-width: 400px;
    padding: 16px 32px;
    border-radius: 14px;
    border: none;
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 8px 24px rgba(59,130,246,0.35);
    letter-spacing: -0.2px;
}

.discovery-search-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(59,130,246,0.5);
}

.discovery-search-btn:active {
    transform: scale(0.98);
}

.discovery-search-btn.loading {
    opacity: 0.8;
    pointer-events: none;
}

.discovery-search-btn .btn-spinner {
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: discoverySpin 0.8s linear infinite;
    display: none;
}

.discovery-search-btn.loading .btn-spinner {
    display: block;
}

.discovery-search-btn.loading .btn-text-main {
    display: none;
}

.discovery-reset-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    transition: color 0.2s;
    padding: 4px 8px;
}

.discovery-reset-btn:hover {
    color: var(--text-secondary);
}

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

/* ── Divider ─────────────────────────────────────────────── */
.discovery-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 4px 0;
}

.discovery-divider::before,
.discovery-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255,255,255,0.06);
}

.discovery-divider-text {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ── Résultats ───────────────────────────────────────────── */
.discovery-results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.discovery-results-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.discovery-results-count {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.discovery-results-shuffle {
    padding: 7px 14px;
    border-radius: 10px;
    border: 1.5px solid rgba(255,255,255,0.08);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 6px;
}

.discovery-results-shuffle:hover {
    border-color: rgba(99,102,241,0.4);
    color: var(--text-primary);
    transform: translateY(-1px);
}

/* Grille résultats — même que .movies-grid */
#discoveryGrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

@media (max-width: 480px) {
    #discoveryGrid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* État vide */
.discovery-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 24px;
    color: var(--text-muted);
}

.discovery-empty-icon {
    font-size: 52px;
    display: block;
    margin-bottom: 16px;
    opacity: 0.4;
}

.discovery-empty-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.discovery-empty-text {
    font-size: 14px;
    line-height: 1.6;
}

/* ── État initial (avant la première recherche) ──────────── */
.discovery-splash {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.discovery-splash-icon {
    font-size: 56px;
    display: block;
    margin-bottom: 16px;
    opacity: 0.35;
}

.discovery-splash-text {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ── Bouton d'accès depuis la page principale ────────────── */
.discovery-entry-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 12px;
    border: 1.5px solid rgba(251,191,36,0.35);
    background: rgba(251,191,36,0.08);
    color: #f6d860;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: inherit;
    white-space: nowrap;
    letter-spacing: -0.1px;
    flex-shrink: 0;
}

.discovery-entry-btn:hover {
    border-color: rgba(251,191,36,0.6);
    background: rgba(251,191,36,0.14);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(251,191,36,0.2);
}

.discovery-entry-btn:active {
    transform: scale(0.97);
}

.discovery-entry-btn svg {
    flex-shrink: 0;
    transition: transform 0.25s ease;
}

.discovery-entry-btn:hover svg {
    transform: rotate(-15deg) scale(1.1);
}

/* Placement dans la search bar */
.search-bar-wrapper .discovery-entry-btn {
    height: 54px;
    padding: 0 16px;
}

@media (max-width: 480px) {
    .search-bar-wrapper .discovery-entry-btn {
        padding: 0 12px;
        font-size: 0; /* masquer le texte sur très petit écran */
        height: 44px;
        width: 44px;
        justify-content: center;
        border-radius: 12px;
    }
    .search-bar-wrapper .discovery-entry-btn svg {
        font-size: 20px;
    }
    .discovery-entry-btn .btn-label {
        display: none;
    }
}

/* Animation d'entrée des cartes */
#discoveryGrid .movie-card {
    animation: discoveryCardIn 0.35s ease both;
}

@keyframes discoveryCardIn {
    from { opacity: 0; transform: translateY(16px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* stagger delay sur les 12 premières cartes */
#discoveryGrid .movie-card:nth-child(1)  { animation-delay: 0.02s; }
#discoveryGrid .movie-card:nth-child(2)  { animation-delay: 0.04s; }
#discoveryGrid .movie-card:nth-child(3)  { animation-delay: 0.06s; }
#discoveryGrid .movie-card:nth-child(4)  { animation-delay: 0.08s; }
#discoveryGrid .movie-card:nth-child(5)  { animation-delay: 0.10s; }
#discoveryGrid .movie-card:nth-child(6)  { animation-delay: 0.12s; }
#discoveryGrid .movie-card:nth-child(7)  { animation-delay: 0.14s; }
#discoveryGrid .movie-card:nth-child(8)  { animation-delay: 0.16s; }
#discoveryGrid .movie-card:nth-child(9)  { animation-delay: 0.18s; }
#discoveryGrid .movie-card:nth-child(10) { animation-delay: 0.20s; }
#discoveryGrid .movie-card:nth-child(11) { animation-delay: 0.22s; }
#discoveryGrid .movie-card:nth-child(12) { animation-delay: 0.24s; }

/* ── Sentinel lazy loading ───────────────────────────────── */
.disc-lazy-sentinel {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 32px 0 48px;
}

.disc-lazy-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: discoverySpin 0.8s linear infinite;
}