/* 
   ReplayTivi - Design System "Crystal Emerald"
   Separated Vanilla CSS
*/

:root {
    /* Light Theme (Default) */
    --bg: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-light: #f1f5f9;
    --primary: #10b981;
    --primary-hover: #059669;
    --accent: #3b82f6;
    --text: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius: 16px;
    --header-height: 70px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

@media (prefers-color-scheme: dark) {
    :root {
        /* Dark Theme */
        --bg: #0f172a;
        --bg-surface: #1e293b;
        --bg-surface-light: #334155;
        --text: #f8fafc;
        --text-muted: #94a3b8;
        --border: #334155;
        --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    }
}

/* Base */
* { box-sizing: border-box; margin: 0; padding: 0; }

img { max-width: 100%; height: auto; }

/* Force No Horizontal Scroll */
html, body {
    width: 100%;
    overflow-x: hidden;
    position: relative;
}

body {
    font-family: system-ui, -apple-system, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary); }

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 0.75rem;
}

/* Layout */
header {
    height: var(--header-height);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 1.5rem;
    min-width: 0;
}

.logo {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}
.logo b { color: var(--text); }

.channels-nav {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    overflow-x: auto;
    padding: 0.5rem 0;
    scrollbar-width: none;
    flex: 1;
    min-width: 0;
}
.channels-nav::-webkit-scrollbar { display: none; }

.channel-group-container {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.group-separator {
    width: 1px;
    height: 24px;
    background: var(--border);
    margin: 0 0.5rem;
    opacity: 0.5;
}

.channels-nav a {
    width: 32px;
    height: 32px;
    background: white;
    padding: 4px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
    flex-shrink: 0;
    border: 1px solid var(--border);
}
.channels-nav a:hover { transform: scale(1.1); border-color: var(--primary); }
.channels-nav img { max-width: 100%; max-height: 100%; object-fit: contain; }

main {
    padding: 1.5rem 0;
    min-height: calc(100vh - var(--header-height) - 200px);
    background-color: var(--bg);
}

.main-content {
    min-width: 0;
}

footer {
    padding: 4rem 0;
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    margin-top: 4rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

/* Typography Components */
.heading {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
}
.heading h2 {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.heading-line {
    height: 2px;
    background: var(--border);
    flex: 1;
    position: relative;
}
.heading-line.primary {
    background: var(--primary);
    opacity: 0.2;
}
.heading-line::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 100px;
    background: var(--primary);
}

/* UI Elements */
.btn {
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: var(--primary);
    color: white;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
}
.btn:hover { background: var(--primary-hover); transform: translateY(-1px); }

.badge {
    display: inline-block;
    padding: 0.2rem 0.75rem;
    background: rgba(16, 185, 129, 0.1);
    color: var(--primary);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
}

/* Grid Replays */
.grid-replays {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}

/* Horizontal Scroll Variant */
.grid-replays-scroll {
    display: flex;
    overflow-x: auto;
    gap: 1.5rem;
    padding: 1rem 0.5rem 1.5rem 0.5rem;
    margin: 0 -0.5rem;
    scroll-snap-type: x mandatory;
    scroll-padding: 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
}

.grid-replays-scroll::-webkit-scrollbar {
    height: 6px;
}

.grid-replays-scroll::-webkit-scrollbar-track {
    background: var(--bg-surface-light);
    border-radius: 10px;
}

.grid-replays-scroll::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}

.grid-replays-scroll .card-replay {
    flex: 0 0 280px;
    scroll-snap-align: start;
}

/* Replay Cards */
.card-replay {
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: var(--transition);
}
.card-replay:hover {
    transform: translateY(-8px);
    border-color: var(--primary);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}
.card-image {
    position: relative;
    aspect-ratio: 16/9;
    overflow: hidden;
    background: var(--bg-surface-light);
}
.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}
.card-replay:hover .card-image img { transform: scale(1.05); }
.channel-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    background: white;
    padding: 4px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.channel-badge img { width: 100%; height: 100%; object-fit: contain; }
.card-content { padding: 1.25rem; }
.card-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem; }
.card-meta .date { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; }
.card-meta .date-highlight {
    color: var(--primary);
    font-weight: 800;
}
.card-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.card-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.card-description {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.75rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    opacity: 0.85;
}

/* Card Replay List Mode */
.card-replay.list-mode {
    flex-direction: row;
    padding: 1rem;
    gap: 1.5rem;
    align-items: flex-start;
    background: var(--bg-surface-light);
    position: relative;
}
.card-replay.list-mode .card-image-link {
    width: 220px;
    flex-shrink: 0;
    position: relative;
}
.card-replay.list-mode .channel-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    bottom: auto;
    width: 32px;
    height: 32px;
    padding: 4px;
    background: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    z-index: 5;
}
.card-replay.list-mode .card-content {
    padding: 0;
    flex: 1;
}
.list-date {
    display: inline-flex;
    align-items: center;
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--primary);
    background: rgba(16, 185, 129, 0.1);
    padding: 2px 10px;
    border-radius: 4px;
    margin-bottom: 0.6rem;
    text-transform: uppercase;
    margin-top: -3px;
}
.list-date.future {
    background: var(--primary);
    color: white;
}
.card-replay.list-mode .card-title {
    -webkit-line-clamp: 2; /* On autorise 2 lignes pour le titre combiné */
    margin-bottom: 0.5rem;
}
.epi-title-inline {
    font-weight: 500;
    color: var(--text-muted);
}
.title-separator {
    color: var(--border);
    margin: 0 0.25rem;
}
.card-replay.list-mode .card-description {
    -webkit-line-clamp: 6;
    margin-top: 0.5rem;
}
.list-replays {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

@media (max-width: 640px) {
    .card-replay.list-mode {
        flex-direction: column;
        padding: 0;
        gap: 0;
    }
    .card-replay.list-mode .card-image-link {
        width: 100%;
    }
    .card-replay.list-mode .card-content {
        padding: 1rem;
    }
}

/* NEW: Intro Box Style (Spun Content) */
.intro-box {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05) 0%, rgba(59, 130, 246, 0.05) 100%);
    border-left: 4px solid var(--primary);
    padding: 2rem;
    border-radius: 0 var(--radius) var(--radius) 0;
    margin-bottom: 3rem;
    box-shadow: var(--shadow);
}
.intro-box p {
    font-size: 1.15rem;
    line-height: 1.8;
    color: var(--text);
    font-weight: 500;
}
.intro-box strong {
    color: var(--primary);
}

/* Breadcrumb */
.breadcrumb { display: flex; flex-wrap: wrap; gap: 0.75rem; font-size: 0.85rem; font-weight: 600; color: var(--text-muted); margin-bottom: 2rem; }
.breadcrumb .sep { opacity: 0.4; }
.breadcrumb .current { color: var(--text); }

/* Pages specific */
.hero { padding: 4rem 0; text-align: center; max-width: 800px; margin: 0 auto; }
.hero h1 { font-size: 2.5rem; font-weight: 800; margin-bottom: 1rem; letter-spacing: -0.05em; line-height: 1.1; }
.hero p { font-size: 1.1rem; color: var(--text-muted); }

.chaine-header { padding: 3rem 0; border-bottom: 1px solid var(--border); margin-bottom: 3rem; }
.chaine-info { display: flex; gap: 2.5rem; align-items: flex-start; }
.chaine-logo { width: 120px; height: 120px; background: white; padding: 1rem; border-radius: 24px; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow); flex-shrink: 0; }
.chaine-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.chaine-info h1 { font-size: 2.25rem; font-weight: 800; margin-bottom: 0.75rem; letter-spacing: -0.04em; }
.chaine-info .description { font-size: 1.1rem; color: var(--text-muted); max-width: 800px; }
.chaine-info .description p, .description-content p { margin-bottom: 1rem; }
.chaine-info .description p:last-child, .description-content p:last-child { margin-bottom: 0; }

.replay-header { margin-bottom: 1.5rem; }
.replay-header h1 { font-size: 1.8rem; margin: 0; color: var(--text); line-height: 1.2; }

.programme-hero { display: flex; flex-direction: column; gap: 2rem; background: var(--bg-surface); padding: 2rem; border-radius: 24px; border: 1px solid var(--border); box-shadow: var(--shadow); margin-bottom: 4rem; }
.programme-visual { width: 100%; border-radius: 16px; overflow: hidden; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); background: #000; display: flex; align-items: center; justify-content: center; aspect-ratio: 16/9; }
.programme-visual img { width: 100%; height: 100%; object-fit: contain; }
.programme-details { width: 100%; }
.programme-details h1 { font-size: 2.5rem; font-weight: 800; margin: 1rem 0; letter-spacing: -0.04em; }

.replay-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 336px), 1fr)); 
    gap: 1.5rem; 
    align-items: start;
}

/* Replay Page Special */
.replay-description {
    margin-bottom: 1.5rem;
    padding: 1rem;
    line-height: 1.6;
}

.replay-description h2 {
    font-size: 1.2rem;
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--primary);
}

.info-content ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.previews-container {
    margin-bottom: 3rem;
    background: var(--bg-surface-light);
    padding: 1rem;
    border-radius: 12px;
    border: 1px dashed var(--primary);
}

.previews-container .heading h2 {
    color: var(--primary);
}

.badge-preview {
    background: var(--primary);
    color: white;
    font-size: 10px;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-left: 10px;
}

.date-group {
    margin-bottom: 3rem;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 4rem;
    padding: 2rem 0;
    border-top: 1px solid var(--border);
}

.pagination-info {
    font-weight: 600;
    color: var(--text-muted);
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-ghost:hover {
    background: var(--bg-surface-light);
    border-color: var(--primary);
}

.replay-card { background: var(--bg-surface); border-radius: 20px; border: 1px solid var(--border); padding: 1.5rem 0; box-shadow: var(--shadow); height: 100%; }
.info-card { grid-column: 1 / -1; padding: 1.5rem}
.info-content { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }

.ad-card, .action-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.ad-container, .play-vignette {
    width: 100%;
    max-width: 336px;
    height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.replay-card h3 { font-size: 1.1rem; font-weight: 800; margin-bottom: 1.25rem; color: var(--primary); text-transform: uppercase; letter-spacing: 0.05em; width: 100%; }
.replay-card li { margin-bottom: 0.75rem; font-size: 0.95rem; border-bottom: 1px solid var(--border); padding-bottom: 0.75rem; list-style: none; }
.replay-card li:last-child { border: none; }
.replay-card li strong { color: var(--text-muted); font-weight: 600; }

.play-vignette { position: relative; display: block; width: 100%; max-width: 336px; /*aspect-ratio: 16/9;*/ border-radius: 16px; overflow: hidden; background: #000; }
.play-vignette img { width: 100%; height: 100%; object-fit: contain; opacity: 0.7; transition: var(--transition); }

.play-vignette:hover img { transform: scale(1.05); opacity: 0.5; }
.play-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; color: white; gap: 1rem; }
.play-button { width: 80px; height: 80px; background: var(--primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 30px rgba(16, 185, 129, 0.4); transition: var(--transition); }
.play-overlay span { font-weight: 800; font-size: 1.1rem; text-shadow: 0 2px 4px rgba(0,0,0,0.5); }

/* Layout Main with Sidebar */
.content-wrapper {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 2rem;
    align-items: start;
}

/* Sidebar Styling */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    position: sticky;
    top: calc(var(--header-height) + 2rem);
}

.sidebar-section h3 {
    font-size: 1rem;
    font-weight: 800;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-section h3 svg {
    color: var(--primary);
}

.sidebar-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.mini-card {
    display: flex;
    gap: 1rem;
    align-items: center;
    padding: 0.5rem;
    border-radius: 12px;
    transition: var(--transition);
    border: 1px solid transparent;
}

.mini-card:hover {
    background: var(--bg-surface);
    border-color: var(--border);
    box-shadow: var(--shadow);
}

.mini-card-img {
    width: 60px;
    height: 40px;
    border-radius: 6px;
    overflow: hidden;
    background: var(--bg-surface-light);
    flex-shrink: 0;
}

.mini-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mini-card-info {
    flex: 1;
    min-width: 0;
}

.mini-card-title {
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 0.1rem;
}

.mini-card-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 0.2rem;
}

.mini-card-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
}

.genre-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.genre-pill {
    padding: 0.4rem 0.8rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.genre-pill:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(16, 185, 129, 0.05);
}

/* Responsive Adjustments */
@media (min-width: 1024px) {
    .replay-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .info-card { grid-column: span 2; }
}

@media (max-width: 1100px) {
    .content-wrapper { grid-template-columns: 1fr; }
    .sidebar { position: static; }
}

@media (max-width: 1000px) { .logo span { display: none; } }

@media (max-width: 900px) { .programme-hero { padding: 1.5rem; } .programme-details { text-align: center; } }

@media (max-width: 768px) {
    .nav-container { gap: 1rem; }
    .hero h1 { font-size: 2rem; } .hero { padding: 2rem 0; }
    .chaine-info { flex-direction: column; text-align: center; gap: 1.5rem; } .chaine-header { padding: 2rem 0; }
    .info-content { grid-template-columns: 1fr; gap: 0.5rem; }
    .ad-container { width: 100%; height: auto; }
    .intro-box { padding: 1.5rem; font-size: 1rem; }
    .footer-content { flex-direction: column; text-align: center; gap: 1.5rem; }
}

/* Utilities */
.v-marker {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
    border: none;
}

ins { max-width: 100% !important; overflow: hidden; }
