/* ==========================================================================
   1. Variabel Global & Pengaturan Dasar (Disinkronkan dari style.css)
   ========================================================================== */
:root {
    --primary-color: #3498db;
    --secondary-color: #2980b9;
    --background-color: #f0f4f8;
    --surface-color: rgba(255, 255, 255, 0.8); /* Glass */
    --text-color: #2c3e50;
    --text-secondary: #636e72;
    --border-color: #dfe6e9;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --backdrop-blur: blur(12px);
    /* Variabel khusus TV */
    --focus-color: #3498db;
    --focus-shadow: 0 0 25px rgba(52, 152, 219, 0.8);
    --sidebar-bg: rgba(255, 255, 255, 0.5);
}

[data-theme="dark"] {
    --background-color: #0f172a;
    --surface-color: rgba(30, 41, 59, 0.8);
    --text-color: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --sidebar-bg: rgba(15, 23, 42, 0.8);
}

[data-theme="light"] {
    --background-color: #f8f9fa;
    --surface-color: #ffffff;
    --text-color: #2c3e50;
    --text-secondary: #7f8c8d;
    --border-color: #e1e8ed;
    --sidebar-bg: #2c3e50;
}

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

html, body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; /* Dari style.css */
    background-color: var(--background-color);
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease;
    line-height: 1.6; /* Dari style.css */
    /* Properti khusus TV */
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* ==========================================================================
   2. Layout & Komponen Khusus Smart TV
   ========================================================================== */
#tv-app {
    display: flex;
    height: 100%;
}

#sidebar {
    width: 100px;
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, rgba(0,0,0,0.4) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    transition: width 0.4s cubic-bezier(0.19, 1, 0.22, 1);
    z-index: 20;
    box-shadow: 5px 0 25px rgba(0,0,0,0.3);
    border-right: 1px solid var(--border-color);
}

#sidebar.expanded {
    width: 320px;
}

.logo-tv {
    font-size: 2.2rem;
    font-weight: 800;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: center;
    padding: 20px 0 40px 0;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#sidebar.expanded .logo-tv {
    opacity: 1;
}

#sidebar-content {
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

#sidebar-content::-webkit-scrollbar {
    display: none;
}

.sidebar-item {
    font-size: 1.3rem;
    padding: 18px 0;
    width: 90%;
    margin: 5px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    color: var(--text-secondary);
    border-radius: 16px;
    position: relative;
}

#sidebar.expanded .sidebar-item {
    justify-content: flex-start;
    padding-left: 25px;
}

.sidebar-item .icon {
    font-size: 1.6rem;
    width: 40px;
    text-align: center;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.sidebar-item .text {
    margin-left: 0;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    max-width: 0;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

#sidebar.expanded .sidebar-item .text {
    opacity: 1;
    max-width: 200px; /* Sufficient width */
    margin-left: 20px;
}

.sidebar-item.focused {
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    color: white;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.4);
    transform: scale(1.02);
}

.sidebar-item.focused .icon {
    transform: scale(1.2) rotate(5deg);
}

#theme-toggle-container {
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    margin-top: auto;
}

.category-dropdown {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding-left: 10px;
}
.category-dropdown.open {
    max-height: 600px;
}
.subcategory-item {
    font-size: 1.1rem;
    padding: 12px 0 12px 40px;
    opacity: 0.8;
}

.arrow-icon {
    position: absolute;
    right: 30px;
    transition: transform 0.4s ease;
    opacity: 0;
}
#sidebar.expanded .arrow-icon {
    opacity: 1;
}
.arrow-icon.open {
    transform: rotate(180deg);
}

#main-content {
    flex-grow: 1;
    padding: 40px;
    overflow-y: auto;
    background: radial-gradient(circle at top right, rgba(52, 152, 219, 0.05), transparent 40%);
}

#category-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 35px;
    letter-spacing: -0.02em;
    text-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

#video-grid-tv {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    padding-bottom: 50px;
}

.video-card-tv {
    border: none;
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    aspect-ratio: 16 / 9;
    background-color: var(--surface-color);
    position: relative;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.video-card-tv.focused {
    transform: scale(1.12);
    box-shadow: 0 20px 40px rgba(0,0,0,0.4), 0 0 0 4px var(--focus-color);
    z-index: 100;
}

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

.video-card-tv .title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px;
    background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #fff;
}

#player-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

#player-container {
    width: 90%;
    height: 90%;
    max-width: 1920px;
    aspect-ratio: 16/9;
}

#player-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.close-player-btn {
    position: absolute;
    top: 25px;
    right: 30px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 10px 20px;
    border-radius: 50px;
    font-size: 1rem;
    cursor: pointer;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    z-index: 1010;
}

.close-player-btn:hover, .close-player-btn.focused {
    background: var(--primary-color);
    border-color: var(--primary-color);
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(52, 152, 219, 0.5);
}
