/* ==========================================
STYLE SYSTEM V2
========================================== */
:root {
    --primary: #e53935;
    --primary-glow: rgba(229, 57, 53, 0.6);
    --bg-dark: #121212;
    --bg-card: #1e1e1e;
    --bg-input: #2a2a2a;
    --text-main: #ffffff;
    --text-sub: #aaaaaa;
    --border: #333333;
    --radius: 8px;
    --header-height: 60px;
}

/* === RESET & BASE === */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    padding-top: var(--header-height);
    line-height: 1.5;
    overflow-x: hidden;
}

a { text-decoration: none; color: inherit; transition: 0.2s; }
img { max-width: 100%; display: block; }
button { cursor: pointer; border: none; outline: none; font-family: inherit; }
ul { list-style: none; }

/* === TV FOCUS STATE (SANGAT PENTING) === */
/* Membuat elemen yang difokuskan remote terlihat sangat jelas */
*:focus-visible {
    outline: 4px solid var(--primary) !important;
    outline-offset: 4px;
    z-index: 100;
    transform: scale(1.05);
    box-shadow: 0 0 20px var(--primary-glow);
    background-color: rgba(255,255,255,0.1) !important; /* Highlight tambahan */
}

/* === HEADER MINIMALIS === */
.app-header {
    position: fixed; top: 0; left: 0; right: 0;
    height: var(--header-height);
    background-color: var(--primary);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.brand-logo a {
    display: flex; align-items: center; gap: 8px;
    font-weight: 800; font-size: 24px; letter-spacing: -0.5px;
    color: white;
}

.id-text { color: rgba(255,255,255,0.7); font-weight: 600; }

.nav-actions { display: flex; gap: 16px; }

.menu-toggle, .search-btn, .back-home-btn {
    background: none; border: none; cursor: pointer; padding: 12px;
    display: flex; align-items: center; justify-content: center;
    color: white; border-radius: 50%; font-size: 20px;
}

.back-home-btn {
    flex-direction: row; gap: 10px; border-radius: 8px; padding: 8px 16px;
    font-size: 16px; font-weight: 600; background: rgba(0,0,0,0.2);
}

/* === SIDEBAR NAVIGASI (KANAN) === */
.sidebar-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.85);
    opacity: 0; visibility: hidden; z-index: 1001;
    backdrop-filter: blur(4px);
}
.sidebar-overlay.active { opacity: 1; visibility: visible; }

.sidebar {
    position: fixed;
    top: 0;
    right: -320px;      /* Sembunyi di kanan */
    bottom: 0;
    width: 320px;
    background: var(--bg-card);
    z-index: 1002;
    display: flex;       /* Ubah dari none ke flex tapi geser posisinya */
    flex-direction: column;
    box-shadow: -8px 0 30px rgba(0,0,0,0.8);
}

.sidebar.open {
    right: 0; /* Muncul ke layar */
}

.sidebar-header {
    padding: 24px; border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
}
.sidebar-header h3 { font-size: 22px; font-weight: 700; color: var(--text-main); }
.close-sidebar { background: none; border: none; color: var(--text-sub); font-size: 32px; cursor: pointer; padding: 8px; }
.sidebar-nav { padding: 16px 0; overflow-y: auto; flex: 1; }

.sidebar-link {
    display: block; padding: 20px 24px; color: var(--text-main);
    font-size: 20px; 
    /* ✅ PERBAIKAN: Pindahkan indikator fokus ke KANAN agar sesuai posisi sidebar */
    border-right: 6px solid transparent; 
    border-left: none;
    transition: 0.2s;
    margin-bottom: 4px;
}

.sidebar-link:hover, .sidebar-link:focus {
    background: rgba(255,255,255,0.05);
    border-right-color: var(--primary);
    padding-right: 32px; /* Efek geser ke dalam saat fokus */
    padding-left: 24px; /* Reset padding kiri */
}

/* === LAYOUT UTAMA === */
.container { max-width: 1400px; margin: 0 auto; padding: 32px 24px; min-height: calc(100vh - 200px); }
.section-title { font-size: 24px; font-weight: 700; margin-bottom: 24px; color: var(--text-main); border-left: 6px solid var(--primary); padding-left: 16px; }

/* === GRID DRAMA RESPONSIVE === */
.drama-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* Mobile: 3 Kolom */
    gap: 16px;
}
@media (min-width: 768px) { .drama-grid { grid-template-columns: repeat(4, 1fr); gap: 24px; } }
@media (min-width: 1200px) { .drama-grid { grid-template-columns: repeat(6, 1fr); gap: 32px; } }

/* === KARTU DRAMA === */
.card-link { display: block; }
.poster-wrapper {
    position: relative; aspect-ratio: 2/3; border-radius: var(--radius);
    overflow: hidden; background: var(--bg-input); margin-bottom: 12px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.4);
}
.poster-wrapper img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.drama-card:hover .poster-wrapper img, .drama-card:focus-within .poster-wrapper img { transform: scale(1.1); }

.ep-badge {
    position: absolute; bottom: 12px; left: 12px;
    background: var(--primary); color: white;
    padding: 6px 12px; border-radius: 6px; font-size: 14px; font-weight: 700;
    box-shadow: 0 4px 8px rgba(0,0,0,0.6);
}

.card-title {
    font-size: 16px; font-weight: 600; line-height: 1.4;
    color: var(--text-main);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* === HALAMAN NONTON (WATCH PAGE) - TV OPTIMIZED === */
.watch-page { padding-top: 0; background: #000; }
.watch-header { justify-content: space-between; padding: 0 12px; }

.video-container-full {
    position: relative; width: 100%; height: 100vh; background: #000;
}
.video-container-full iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: none; }
@media (max-width: 768px) { .video-container-full { height: 56.25vw; max-height: 40vh; } }

.info-container {
    background: var(--bg-dark);
    padding: 0 16px 20px;
    border-radius: 20px 20px 0 0;
    margin-top: -20px;
    position: relative; z-index: 10;
}

.info-section { margin-bottom: 32px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.watch-title { font-size: 24px; margin-bottom: 16px; font-weight: 800; }

.ep-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.ep-btn {
    padding: 10px 18px; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 6px; color: var(--text-sub); font-size: 14px; font-weight: 600; cursor: pointer;
}
.ep-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

.detail-table { width: 100%; border-collapse: collapse; font-size: 20px; }
.detail-table th, .detail-table td { padding: 20px 0; border-bottom: 1px solid var(--border); text-align: left; }
.detail-table th { color: var(--text-sub); width: 35%; font-weight: 600; }

.sinopsis-text { font-size: 22px; line-height: 1.6; color: var(--text-sub); }

.cast-list { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.cast-list li { padding: 16px 20px; background: var(--bg-input); border-radius: 8px; font-size: 18px; color: var(--text-sub); border: 1px solid var(--border); }

/* === SEARCH & PAGINATION === */
.search-input {
    width: 100%; 
    padding: 24px 32px; 
    background: var(--bg-input); 
    border: 2px solid var(--border);
    border-radius: var(--radius); 
    color: white; 
    font-size: 24px; 
    margin-bottom: 32px;
    transition: border-color 0.2s;
}
.search-input:focus { 
    outline: none; 
    border-color: var(--primary); 
    box-shadow: 0 0 0 4px rgba(229, 57, 53, 0.2); 
}

.pagination { display: flex; justify-content: center; gap: 16px; margin: 48px 0; flex-wrap: wrap; }
.pag-btn {
    padding: 16px 32px; background: var(--bg-card); border: 2px solid var(--border);
    border-radius: 8px; color: var(--text-sub); font-size: 20px; font-weight: 600;
}
.pag-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

.app-footer { text-align: center; padding: 48px 24px; color: var(--text-sub); font-size: 16px; border-top: 1px solid var(--border); margin-top: 48px; }
.alert { padding: 32px; background: rgba(255, 204, 0, 0.1); border: 2px solid rgba(255, 204, 0, 0.3); border-radius: var(--radius); color: #ffcc00; text-align: center; font-weight: 500; font-size: 20px; }

/* === SCROLLBAR CUSTOM === */
::-webkit-scrollbar { width: 12px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-sub); }
