/* === 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;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.8s ease-out;
}

.splash-logo {
    width: 200px;
    height: 200px;
    background: url('/logo.png') no-repeat center / contain;
    animation: logoPulse 2s ease-in-out infinite;
}

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

@keyframes logoPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
        filter: brightness(1);
    }
    50% {
        transform: scale(1.15);
        opacity: 0.9;
        filter: brightness(1.2);
    }
}

/* === 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;
}

.logo-img {
    height: 48px;
    cursor: pointer;
}

.header-center {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    max-width: 700px;
    margin: 0 1rem;
}

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

/* === Search in Header (Desktop) === */
.search-section-header {
    flex: 1;
}

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

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

/* === Category Dropdown === */
.category-dropdown {
    position: relative;
    display: inline-block;
}

.category-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--card-bg);
    color: var(--fg);
    border: 1px solid rgba(255,255,255,0.2);
    padding: 0.6rem 1rem;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.category-btn:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.category-btn .arrow {
    transition: transform 0.3s;
    width: 12px;
    height: 12px;
}

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

.category-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;
    min-width: 220px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    z-index: 1000;
    overflow: hidden;
    animation: slideDown 0.3s ease-out;
    display: flex;
    flex-direction: column;
}

.category-menu.hidden {
    display: none !important;
}

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

.category-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--fg);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.3s;
    cursor: pointer;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.category-item:last-child {
    border-bottom: none;
}

.category-item:hover {
    background: var(--accent);
    color: white;
}

/* === Theme Toggle & Hamburger === */
.theme-toggle, .hamburger {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--fg);
    font-size: 1.2rem;
    padding: 0.25rem;
}

.hamburger {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.hamburger div {
    width: 20px;
    height: 2px;
    background: var(--fg);
    transition: 0.3s;
}

/* === Mobile Search Icon === */
.mobile-search-icon {
    background: var(--card-bg);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--fg);
    transition: all 0.3s;
}

.mobile-search-icon:hover {
    background: var(--accent);
    color: white;
}

/* === Mobile Menu === */
.mobile-menu {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding: 1rem;
    z-index: 99;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    animation: slideDown 0.3s ease-out;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

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

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

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

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

/* === Mobile Search Bar dengan Close Button === */
.mobile-search-bar {
    position: relative;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.mobile-search-bar #mobileSearchInput {
    width: 100%;
    padding: 0.6rem 2.5rem 0.6rem 1rem;
    border-radius: 25px;
    border: 1px solid rgba(255,255,255,0.2);
    background: var(--bg);
    color: var(--fg);
    font-size: 0.9rem;
    outline: none;
    transition: all 0.3s;
}

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

.mobile-search-bar .search-close {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--fg);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem;
    display: none;
    transition: color 0.3s;
}

.mobile-search-bar .search-close:hover {
    color: var(--accent);
}

.mobile-search-bar.search-active .search-close {
    display: block;
}

/* === Category Dropdown di Mobile === */
.mobile-category {
    width: 100%;
}

.mobile-category .category-btn {
    width: 100%;
    justify-content: center;
}

.mobile-category .category-menu {
    position: static;
    margin-top: 0.5rem;
    box-shadow: none;
    border: 1px solid rgba(255,255,255,0.1);
    width: 100%;
}

/* === Search Section (standalone) === */
.search-section {
    padding: 0 1.5rem 1.5rem;
}

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

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

#searchInput:focus {
    border-color: var(--accent);
}

/* === Content === */
.content {
    padding: 0 1.5rem 2rem;
    min-height: 60vh;
}

.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;
}

.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;
}

/* === 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;
}

.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 a {
    color: var(--accent);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .header {
        padding: 0.5rem 0.75rem;
        flex-wrap: nowrap;
    }
    
    .header-left {
        flex: 0 0 auto;
    }
    
    .logo-img {
        height: 32px;
    }
    
    .header-center {
        display: none;
    }
    
    .header-right {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        flex: 0 0 auto;
    }
    
    /* Hide desktop theme toggle di mobile */
    .theme-toggle {
        display: none;
    }
    
    /* Mobile Menu - Full Width & Consistent */
    .mobile-menu {
        position: fixed;
        top: 52px;
        left: 0;
        right: 0;
        background: var(--card-bg);
        border-bottom: 1px solid rgba(255,255,255,0.1);
        padding: 1rem;
        z-index: 99;
        max-height: calc(100vh - 52px);
        overflow-y: auto;
        animation: slideDown 0.3s ease-out;
        box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    }
    
    /* Grid 2 kolom di mobile */
    .for-you-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .content {
        padding: 0 0.75rem 1.5rem;
    }
    
    .splash-logo {
        width: 120px;
        height: 120px;
    }
    
    .section-wrapper {
        padding: 0 40px;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 0.4rem 0.6rem;
    }
    
    .logo-img {
        height: 28px;
    }
    
    .mobile-search-icon {
        width: 32px;
        height: 32px;
    }
    
    .hamburger div {
        width: 18px;
    }
    
    .for-you-grid {
        grid-template-columns: 1fr;
    }
    
    .hero-content h1 {
        font-size: 1.8rem;
    }
}

/* Desktop: hide mobile search icon */
@media (min-width: 769px) {
    .mobile-search-icon {
        display: none;
    }
    
    .mobile-search-bar {
        display: none;
    }
}
