/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --red: #b1282e;
    --red-dark: #8b1f23;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-400: #9ca3af;
    --gray-600: #4b5563;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --white: #ffffff;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.12);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1200px; margin: 0 auto; padding: 24px 16px; flex: 1; }

/* === Header === */
.header { background: var(--red); color: var(--white); box-shadow: var(--shadow-lg); }
.nav { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; flex-wrap: wrap; gap: 8px; }
.nav-logo { color: var(--white); font-size: 1.25rem; font-weight: 700; }
.nav-logo:hover { text-decoration: none; }
.nav-links { display: flex; gap: 20px; align-items: center; }
.nav-links a { color: var(--white); opacity: 0.9; }
.nav-links a:hover { opacity: 1; text-decoration: none; }

/* === Footer === */
.footer { background: var(--gray-800); color: var(--gray-400); text-align: center; padding: 16px; font-size: 0.85rem; margin-top: auto; }

/* === Buttons === */
.btn { display: inline-block; padding: 8px 20px; border-radius: var(--radius); font-weight: 600; font-size: 0.9rem; border: none; cursor: pointer; text-decoration: none; transition: background 0.2s; }
.btn:hover { text-decoration: none; }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-lg { padding: 12px 28px; font-size: 1rem; }
.btn-primary { background: var(--red); color: var(--white); }
.btn-primary:hover { background: var(--red-dark); }
.btn-secondary { background: var(--gray-800); color: var(--white); }
.btn-secondary:hover { background: var(--gray-900); }

/* === Hero === */
.hero { text-align: center; padding: 60px 20px 40px; }
.hero h1 { font-size: 3rem; color: var(--red); margin-bottom: 8px; }
.hero p { font-size: 1.25rem; color: var(--gray-600); margin-bottom: 32px; }
.hero-actions { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

/* === Stats Bar === */
.stats-bar { display: flex; justify-content: center; gap: 48px; padding: 32px 0; margin-bottom: 16px; border-bottom: 1px solid var(--gray-200); }
.stat { text-align: center; }
.stat-num { display: block; font-size: 2rem; font-weight: 700; color: var(--red); }
.stat-label { font-size: 0.85rem; color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.05em; }

/* === Home Sections === */
.home-section { margin-bottom: 40px; }
.home-section h2 { margin-bottom: 16px; }
.home-section h2 a { color: var(--gray-800); }
.home-section h2 a:hover { color: var(--red); }
.section-link { text-align: center; margin-top: 16px; }

/* === Grid === */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; }

/* === Card === */
.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; transition: box-shadow 0.2s; display: block; }
.card:hover { box-shadow: var(--shadow-lg); text-decoration: none; color: inherit; }
.card-img { height: 300px; background-size: cover; background-position: center; background-color: var(--gray-200); }
.card-body { padding: 12px; }
.card-body h3 { font-size: 0.95rem; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-meta { font-size: 0.8rem; color: var(--gray-400); display: block; }
.card-date { font-size: 0.8rem; color: var(--red); display: block; margin-top: 4px; }
.card-full { height: auto; }

/* === Search === */
.search-bar { display: flex; gap: 8px; margin-bottom: 24px; }
.search-bar input { flex: 1; padding: 10px 16px; border: 1px solid var(--gray-200); border-radius: var(--radius); font-size: 1rem; }
.search-bar input:focus { outline: 2px solid var(--red); border-color: transparent; }

/* === Forms === */
.form-container { max-width: 420px; margin: 60px auto; }
.form-container h2 { margin-bottom: 20px; }
.form { display: flex; flex-direction: column; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group label { font-weight: 600; font-size: 0.9rem; }
.form-group input, .form-group select { padding: 10px 14px; border: 1px solid var(--gray-200); border-radius: var(--radius); font-size: 1rem; }
.form-group input:focus { outline: 2px solid var(--red); border-color: transparent; }
.form-footer { margin-top: 16px; font-size: 0.9rem; color: var(--gray-600); }
.form-wide { max-width: 600px; }
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }

/* === Alerts === */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 0.9rem; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* === Film Detail === */
.back-link { display: inline-block; margin-bottom: 20px; font-size: 0.9rem; }
.film-backdrop { width: 100%; height: 300px; background-size: cover; background-position: center top; position: relative; border-radius: var(--radius); overflow: hidden; margin-bottom: -60px; }
.film-backdrop-overlay { position: absolute; inset: 0; background: linear-gradient(transparent 40%, rgba(17,24,39,0.85) 100%); }
.film-detail { display: flex; gap: 32px; position: relative; }
.film-detail-with-backdrop { padding-top: 180px; }
.film-poster { width: 280px; max-height: 450px; object-fit: contain; border-radius: var(--radius); box-shadow: var(--shadow-lg); flex-shrink: 0; }
.film-info h1 { margin-bottom: 4px; }
.film-subtitle { color: var(--gray-400); font-style: italic; margin-bottom: 4px; }
.film-meta { margin: 16px 0; border-collapse: collapse; }
.film-meta td { padding: 4px 16px 4px 0; font-size: 0.9rem; }
.film-meta td:first-child { font-weight: 600; color: var(--gray-600); }
.film-synopsis { margin-top: 16px; line-height: 1.8; }
.film-synopsis h3 { margin-bottom: 6px; font-size: 0.95rem; color: var(--gray-600); }
.film-actions-top { display: flex; gap: 8px; margin: 12px 0; }

/* === Film Dates === */
.film-dates-section { margin-top: 28px; }
.film-dates-section h3 { margin-bottom: 12px; font-size: 1rem; color: var(--gray-600); }
.film-dates-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.film-date-item { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 8px 14px; text-align: center; min-width: 120px; }
.film-date-item.film-date-highlight { border-color: var(--red); background: #fef2f2; }
.film-date-country { display: block; font-size: 0.75rem; color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.03em; }
.film-date-value { display: block; font-weight: 600; font-size: 0.95rem; margin-top: 2px; }

/* === Film Posters Row === */
.film-posters-section { margin-top: 28px; }
.film-posters-section h3 { margin-bottom: 12px; font-size: 1rem; color: var(--gray-600); }
.film-posters-scroll { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.film-poster-thumb { position: relative; flex-shrink: 0; cursor: pointer; }
.film-poster-thumb img { width: 120px; max-height: 180px; object-fit: contain; border-radius: 6px; box-shadow: var(--shadow); transition: transform 0.2s; }
.film-poster-thumb img:hover { transform: scale(1.05); }
.film-poster-thumb .poster-label { position: absolute; top: 4px; left: 4px; background: rgba(0,0,0,0.7); color: #fff; font-size: 0.65rem; padding: 2px 6px; border-radius: 4px; font-weight: 600; }
.film-poster-thumb.film-poster-active { outline: 3px solid var(--red); border-radius: 8px; }

/* === Film Trailers === */
.film-trailers-section { margin-top: 28px; }
.film-trailers-section h3 { margin-bottom: 12px; font-size: 1rem; color: var(--gray-600); }
.film-trailers-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.film-trailer-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.film-trailer-embed { position: relative; padding-top: 56.25%; }
.film-trailer-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: none; }
.film-trailer-info { padding: 10px 14px; display: flex; align-items: center; gap: 8px; font-size: 0.85rem; }

/* === Pagination === */
.pagination { display: flex; gap: 4px; margin-top: 24px; justify-content: center; flex-wrap: wrap; }
.page { padding: 6px 12px; border-radius: var(--radius); font-size: 0.85rem; border: 1px solid var(--gray-200); }
.page.active { background: var(--red); color: var(--white); border-color: var(--red); }
.page:hover { background: var(--gray-100); text-decoration: none; }

/* === Tables === */
.table { width: 100%; border-collapse: collapse; margin-bottom: 16px; }
.table th, .table td { padding: 8px 12px; border-bottom: 1px solid var(--gray-200); text-align: left; font-size: 0.9rem; }
.table th { font-weight: 600; color: var(--gray-600); background: var(--gray-100); }
.table tbody tr:hover { background: var(--gray-50); }

/* === CPL Section === */
.cpl-section { margin-top: 32px; border-top: 2px solid var(--gray-200); padding-top: 24px; }
.cpl-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.cpl-header h2 { display: flex; align-items: center; gap: 8px; }
.badge { background: var(--gray-200); color: var(--gray-600); font-size: 0.75rem; padding: 2px 8px; border-radius: 12px; font-weight: 600; }
.cpl-table-wrap { overflow-x: auto; }
.cpl-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.cpl-table th, .cpl-table td { padding: 8px 10px; border-bottom: 1px solid var(--gray-200); text-align: left; }
.cpl-table th { font-weight: 600; color: var(--gray-600); background: var(--gray-100); }
.cpl-table tbody tr:hover { background: var(--gray-50); }
.cpl-name { font-weight: 600; max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cpl-ok { color: #166534; font-weight: 600; }
.cpl-ko { color: #991b1b; font-weight: 600; }
.cpl-comment-row td { background: var(--gray-50); font-size: 0.8rem; color: var(--gray-600); font-style: italic; border-bottom: 2px solid var(--gray-200); }

/* === Fieldset === */
.form-fieldset { border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 16px; margin-bottom: 8px; }
.form-fieldset legend { font-weight: 600; font-size: 0.9rem; padding: 0 8px; color: var(--gray-600); }
.form-actions { display: flex; gap: 12px; align-items: center; }
.form-group textarea { padding: 10px 14px; border: 1px solid var(--gray-200); border-radius: var(--radius); font-size: 1rem; font-family: inherit; resize: vertical; }
.form-group textarea:focus { outline: 2px solid var(--red); border-color: transparent; }
.form-row-3 { display: flex; gap: 16px; }
.form-row-3 .form-group { flex: 1; }

/* === Poster Edit Grid === */
.film-posters-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-top: 8px; }
.poster-field { display: flex; flex-direction: column; gap: 4px; }
.poster-field label { font-weight: 600; font-size: 0.85rem; }
.poster-field input[type="url"] { padding: 8px 10px; border: 1px solid var(--gray-200); border-radius: var(--radius); font-size: 0.85rem; }
.poster-preview img, .backdrop-preview img { width: 100%; max-width: 200px; max-height: 300px; object-fit: contain; border-radius: 6px; box-shadow: var(--shadow); margin-bottom: 4px; }
.backdrop-preview img { max-width: 100%; max-height: 150px; object-fit: cover; }

/* === Danger Button === */
.btn-danger { background: #991b1b; color: var(--white); }
.btn-danger:hover { background: #7f1d1d; }

/* === Form Inline === */
.form-inline { flex-direction: row; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.form-inline .form-group { flex: none; }
.form-inline select, .form-inline input[type="text"] { padding: 8px 12px; border: 1px solid var(--gray-200); border-radius: var(--radius); font-size: 0.9rem; }

/* === TV Pages === */
.tv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.tv-section { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.tv-section h3 { margin-bottom: 12px; color: var(--red); }

/* === TMDB Tabs === */
.tmdb-tabs { display: flex; gap: 0; margin-bottom: 16px; border-bottom: 2px solid var(--gray-200); }
.tmdb-tab { padding: 10px 20px; font-weight: 600; font-size: 0.9rem; color: var(--gray-400); border-bottom: 2px solid transparent; margin-bottom: -2px; text-decoration: none; transition: color 0.2s, border-color 0.2s; }
.tmdb-tab:hover { color: var(--gray-800); text-decoration: none; }
.tmdb-tab.active { color: var(--red); border-bottom-color: var(--red); }

/* === TMDB Results === */
.tmdb-results { display: flex; flex-direction: column; gap: 12px; }
.tmdb-card { display: flex; gap: 16px; background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.tmdb-card.tmdb-exists { opacity: 0.55; }
.tmdb-poster img { width: 70px; border-radius: 4px; }
.tmdb-no-poster { width: 70px; height: 105px; background: var(--gray-200); border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; color: var(--gray-400); }
.tmdb-info { flex: 1; min-width: 0; }
.tmdb-info h3 { margin-bottom: 2px; }
.tmdb-overview { font-size: 0.8rem; color: var(--gray-600); margin-top: 6px; line-height: 1.5; }
.tmdb-actions { display: flex; gap: 8px; margin-top: 10px; align-items: center; }

/* === Video Management === */
.film-video-header { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.film-video-header h2 { margin: 0; }
.video-list-section { margin-bottom: 32px; }
.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 20px; margin-top: 16px; }
.video-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.video-player-wrap video { width: 100%; display: block; max-height: 220px; background: #000; }
.video-card-info { padding: 12px; }
.video-card-info strong { display: block; margin-bottom: 6px; }
.video-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 0.85rem; color: var(--gray-600); }
.video-add-section { margin-top: 32px; }
.video-tabs { display: flex; gap: 0; border-bottom: 2px solid var(--gray-200); margin-bottom: 20px; }
.tab-btn { padding: 10px 20px; background: none; border: none; border-bottom: 2px solid transparent; cursor: pointer; font-size: 0.95rem; color: var(--gray-600); margin-bottom: -2px; transition: all 0.15s; }
.tab-btn:hover { color: var(--red); }
.tab-btn.active { color: var(--red); border-bottom-color: var(--red); font-weight: 600; }
.tab-content { display: none; }
.tab-content.active { display: block; }
.form-card { background: var(--white); padding: 20px; border-radius: var(--radius); box-shadow: var(--shadow); }
.badge-info { background: #3b82f6; color: white; }
.badge-warning { background: #f59e0b; color: white; }
.badge-default { background: var(--gray-200); color: var(--gray-600); }
.badge-danger { background: #ef4444; color: white; }
.video-trailers-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }

/* === Video Section Anchor === */
#videos { scroll-margin-top: 80px; }

/* === Util === */
.text-muted { color: var(--gray-400); }

/* === Kijkwijzer / Cinecheck (cc-2020.ttf font) === */
@font-face {
    font-family: 'cc2020';
    src: url('../media/cc-2020.ttf');
}
.cc2020 { font-family: 'cc2020', Arial, sans-serif; font-size: 20px; }
.cc2020-26 { font-family: 'cc2020', Arial, sans-serif; font-size: 26px; }
.cc2020-40 { font-family: 'cc2020', Arial, sans-serif; font-size: 40px; text-shadow: #fff 0 0 12px; }
.cc2020-input { font-family: 'cc2020', Arial, sans-serif; font-size: 18px; padding: 8px; border: 1px dotted var(--gray-400); background: var(--gray-100); letter-spacing: 4px; }
.cc2020-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.85rem; color: var(--gray-600); margin-top: 4px; }
.cc2020-legend span { display: inline-flex; align-items: center; gap: 4px; }
.cc2020-legend .cc2020 { font-size: 16px; text-shadow: none; }
.kijkwijzer-section { margin: 16px 0; }
@media print {
    .cc2020-40 { text-shadow: none; font-size: 36px; }
}

/* === Mobile Nav Toggle === */
.nav-toggle { display: none; background: none; border: none; color: var(--white); font-size: 1.5rem; cursor: pointer; }

/* === Mobile === */
@media (max-width: 768px) {
    .tv-grid { grid-template-columns: 1fr; }
    .form-inline { flex-direction: column; align-items: stretch; }
}
@media (max-width: 640px) {
    .hero h1 { font-size: 2rem; }
    .stats-bar { gap: 24px; }
    .stat-num { font-size: 1.5rem; }
    .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
    .card-img { height: 225px; }
    .film-detail { flex-direction: column; align-items: center; }
    .film-poster { width: 200px; }
    .form-row { flex-direction: column; }
    .nav-toggle { display: block; }
    .nav-links { display: none; gap: 12px; font-size: 0.85rem; flex-direction: column; width: 100%; padding-top: 8px; }
    .nav-links.open { display: flex; }
    .tmdb-card { flex-direction: column; }
}
