/* === Theme Variables === */
:root {
    --bg: #ffffff;
    --fg: #000000;
    --card-bg: #f8f8f8;
    --accent: #E31B23;
    --text-muted: #666;
}

.theme-dark {
    --bg: #000000;
    --fg: #ffffff;
    --card-bg: #111111;
    --text-muted: #aaa;
}

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

body {
    background-color: var(--bg);
    color: var(--fg);
    font-family: 'Manrope', sans-serif;
    transition: background-color 0.3s, color 0.3s;
    overflow-x: hidden;
}

/* === Splash Screen === */
.splash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.8s ease-out;
}

.splash-logo {
    width: 120px;
    height: 120px;
    background: url('logo.png') no-repeat center / contain;
    margin-bottom: 1.5rem;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.9; }
}

.splash.hidden {
    opacity: 0;
    pointer-events: none;
}

/* === Header === */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-img {
    height: 50px;
    width: auto;
    cursor: pointer;
}

/* === Search Toggle Button === */
.search-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--fg);
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-toggle-btn:hover {
    background: var(--card-bg);
}

/* === Kategori Dropdown === */
.kategori-dropdown {
    position: relative;
    z-index: 1000;
}

.kategori-btn {
    background: var(--accent);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s;
}

.kategori-btn:hover {
    background: #C61A21;
    transform: translateY(-2px);
}

.kategori-btn.active {
    background: #C61A21;
}

.dropdown-arrow {
    transition: transform 0.3s;
    width: 16px;
    height: 16px;
}

.kategori-btn.active .dropdown-arrow {
    transform: rotate(180deg);
}

.kategori-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: var(--card-bg);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 0.5rem;
    min-width: 280px;
    max-width: 90vw;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s;
    max-height: 70vh;
    overflow-y: auto;
}

.kategori-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Custom scrollbar untuk dropdown */
.kategori-menu::-webkit-scrollbar {
    width: 6px;
}

.kategori-menu::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
}

.kategori-menu::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 3px;
}

.kategori-menu::-webkit-scrollbar-thumb:hover {
    background: #C61A21;
}

.kategori-item {
    display: block;
    color: var(--fg);
    text-decoration: none;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s;
    margin-bottom: 0.25rem;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
}

.kategori-item:last-child {
    margin-bottom: 0;
}

.kategori-item:hover {
    background: var(--accent);
    color: white;
    transform: translateX(4px);
}

/* === Mobile Menu === */
.mobile-menu {
    position: fixed;
    top: 70px;
    right: 1rem;
    background: var(--card-bg);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 1rem;
    z-index: 99;
    min-width: 200px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.mobile-menu ul {
    list-style: none;
}

.mobile-menu li {
    margin: 0.5rem 0;
}

.mobile-menu button,
.mobile-menu a {
    color: var(--fg);
    background: none;
    border: none;
    text-decoration: none;
    font-size: 0.95rem;
    cursor: pointer;
    width: 100%;
    text-align: left;
    padding: 0.7rem 1rem;
    border-radius: 8px;
    transition: background 0.3s;
    display: block;
}

.mobile-menu button:hover,
.mobile-menu a:hover {
    background: rgba(255,255,255,0.1);
}

.hidden {
    display: none !important;
}

/* === Search Section === */
.search-section {
    padding: 1rem 1.5rem;
    background: var(--bg);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#searchInput {
    width: 100%;
    padding: 0.9rem 1.2rem;
    border-radius: 30px;
    border: 2px solid rgba(255,255,255,0.2);
    background: var(--card-bg);
    color: var(--fg);
    font-size: 1rem;
    outline: none;
    transition: all 0.3s;
}

#searchInput::placeholder {
    color: var(--text-muted);
}

#searchInput:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(227, 27, 35, 0.1);
}

/* === Content === */
.content {
    padding: 1.5rem;
    min-height: 60vh;
    scroll-behavior: smooth;
}

.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 1.5rem 0 1rem;
    display: flex;
    align-items: center;
    scroll-margin-top: 100px;
}

.section-title::before {
    content: "";
    display: inline-block;
    width: 4px;
    height: 16px;
    background: var(--accent);
    margin-right: 0.5rem;
    border-radius: 2px;
}

/* === Hero Banner === */
.hero-banner {
    height: 50vh;
    position: relative;
    overflow: hidden;
    margin-bottom: 2rem;
    display: none;
    border-radius: 12px;
}

.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    filter: brightness(0.6);
}

.hero-content {
    position: relative;
    z-index: 2;
    color: white;
    text-align: center;
    padding: 0 1rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.hero-content h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.hero-content p {
    font-size: 1.1rem;
    max-width: 600px;
    opacity: 0.9;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.btn-primary {
    background: var(--accent);
    color: white;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 30px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1rem;
}

.btn-primary:hover {
    background: #C61A21;
    transform: scale(1.05);
}

/* === For You & Dub Grid (4 kolom) === */
.for-you-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
    .for-you-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .for-you-grid {
        grid-template-columns: 1fr;
    }
}

/* === Drama Card === */
.drama-card {
    text-align: center;
    cursor: pointer;
    background: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: transform 0.3s, box-shadow 0.3s;
    min-width: 120px;
}

.drama-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.4);
}

.drama-poster {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    background: #333;
}

.drama-title {
    font-size: 0.85rem;
    margin-top: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--fg);
    padding: 0 0.5rem 0.5rem;
    line-height: 1.4;
}

.drama-card-relative {
    position: relative;
}

/* === Badge === */
.badge {
    position: absolute;
    top: 4px;
    left: 4px;
    background: #E31B23;
    color: white;
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    z-index: 1;
}

/* === Carousel Navigation Buttons === */
.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 2;
    font-size: 18px;
    user-select: none;
    transition: all 0.3s;
    border: none;
    font-weight: bold;
    pointer-events: auto;
}

.carousel-nav:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: translateY(-50%) scale(1.1);
}

.carousel-nav.prev {
    left: 10px;
}

.carousel-nav.next {
    right: 10px;
}

/* === Section Wrapper (untuk VIP) === */
.section-wrapper {
    position: relative;
    margin-bottom: 2rem;
    overflow: hidden;
    padding: 0 50px;
    scroll-margin-top: 100px;
}

.drama-grid {
    display: flex;
    gap: 1rem;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    overflow-x: auto;
}

.drama-grid::-webkit-scrollbar {
    display: none;
}

.drama-grid {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* === Pagination === */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
}

.pagination button {
    background: var(--card-bg);
    color: var(--fg);
    border: 1px solid rgba(255,255,255,0.2);
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.pagination button:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination span {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* === Scroll Animation === */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in.appear {
    opacity: 1;
    transform: translateY(0);
}

/* === Footer === */
.footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid rgba(255,255,255,0.05);
    margin-top: 2rem;
}

.footer strong {
    color: var(--accent);
}

/* === Detail Page Styles === */
.detail-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--fg);
    text-decoration: none;
    margin-bottom: 1.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.3s;
}

.detail-back:hover {
    color: var(--accent);
}

.detail-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.detail-info {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.detail-info span {
    background: var(--card-bg);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.85rem;
}

.detail-synopsis {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.detail-favorite {
    background: var(--accent);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 30px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 2rem;
    transition: all 0.3s;
}

.detail-favorite:hover {
    background: #C61A21;
    transform: scale(1.05);
}

.episode-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.75rem;
}

.episode-item {
    background: var(--card-bg);
    padding: 0.8rem;
    border-radius: 6px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    color: var(--fg);
    font-weight: 600;
}

.episode-item:hover {
    background: var(--accent);
    color: white;
    transform: translateY(-2px);
}

/* === Episode Player Page === */
.player-container {
    max-width: 900px;
    margin: 0 auto;
}

.player-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.player-synopsis {
    background: var(--card-bg);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    line-height: 1.6;
    font-size: 0.95rem;
}

.player-options {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.player-options select {
    background: var(--card-bg);
    color: var(--fg);
    border: 1px solid rgba(255,255,255,0.2);
    padding: 0.6rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
}

.player-download {
    background: var(--accent);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 30px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 2rem;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.player-download:hover {
    background: #C61A21;
    transform: scale(1.05);
}

.player-navigation {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 2rem;
}

.player-navigation button {
    background: var(--card-bg);
    color: var(--fg);
    border: 1px solid rgba(255,255,255,0.2);
    padding: 0.8rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.player-navigation button:hover {
    background: var(--accent);
    color: white;
}

.player-navigation button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* === Responsive === */
@media (max-width: 768px) {
    .header {
        padding: 0.75rem 1rem;
    }
    
    .logo-img {
        height: 40px;
    }
    
    .kategori-btn {
        padding: 0.6rem 0.8rem;
    }
    
    .kategori-btn svg:first-child {
        width: 20px;
        height: 20px;
    }
    
    .kategori-btn span {
        display: none;
    }
    
    .kategori-menu {
        left: 50%;
        transform: translateX(-50%) translateY(-10px);
        min-width: 260px;
        max-width: 95vw;
        right: auto;
        max-height: calc(100vh - 120px);
        overflow-y: auto;
        top: 50px;
    }
    
    .kategori-menu.show {
        transform: translateX(-50%) translateY(0);
    }
    
    .kategori-item {
        padding: 0.7rem 0.9rem;
        font-size: 0.85rem;
        text-align: center;
        white-space: normal;
        word-wrap: break-word;
    }
    
    .kategori-item:hover {
        transform: none;
    }
    
    .content {
        padding: 1rem;
    }
    
    .search-section {
        padding: 0.75rem 1rem;
    }
    
    .hero-content h1 {
        font-size: 1.8rem;
    }
    
    .hero-content p {
        font-size: 1rem;
    }
    
    .section-wrapper {
        padding: 0 40px;
    }
    
    .detail-title {
        font-size: 1.4rem;
    }
}

@media (max-width: 480px) {
    .header-left {
        gap: 0.5rem;
    }
    
    .logo-img {
        height: 35px;
    }
    
    .search-toggle-btn,
    .kategori-btn {
        padding: 0.5rem;
    }
    
    .kategori-menu {
        min-width: 240px;
        max-width: 95vw;
        padding: 0.4rem;
        max-height: calc(100vh - 100px);
    }
    
    .kategori-item {
        padding: 0.65rem 0.8rem;
        font-size: 0.8rem;
        line-height: 1.3;
    }
    
    .content {
        padding: 0.75rem;
    }
    
    .section-wrapper {
        padding: 0 35px;
    }
    
    .carousel-nav {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }
}
