:root {
    --bg-main: #050505;       
    --bg-card: #121212;       
    --bg-input: #1e1e1e;
    --primary: #facc15;       
    --accent: #eab308;        
    --text-main: #ffffff;
    --text-muted: #a1a1aa;
    --gradient: linear-gradient(135deg, #eab308 0%, #fde047 100%);
    --navbar-bg: rgba(10, 10, 10, 0.8);
    --bottom-nav-bg: rgba(10, 10, 10, 0.95);
    --border-color: #222;
}

[data-theme="light"] {
    --bg-main: #eff2f5;       
    --bg-card: #ffffff;       
    --bg-input: #e2e6ea;
    --primary: #ca8a04;       
    --accent: #a16207;        
    --text-main: #212529;
    --text-muted: #6c757d;
    --gradient: linear-gradient(135deg, #a16207 0%, #ca8a04 100%);
    --navbar-bg: rgba(239, 242, 245, 0.85);
    --bottom-nav-bg: rgba(255, 255, 255, 0.95);
    --border-color: #ced4da;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    padding-top: 85px; 
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: background-color 0.3s, color 0.3s;
}

/* ========== NAVBAR ATAS ========== */
.navbar {
    position: fixed; top: 0; left: 0; right: 0; height: 75px;
    background: var(--navbar-bg); backdrop-filter: blur(25px); -webkit-backdrop-filter: blur(25px);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.05); border-bottom: 1px solid var(--border-color);
    display: flex; align-items: center; padding: 0 15px; gap: 12px; z-index: 1000;
    transition: background 0.3s, border-color 0.3s;
}

.top-logo {
    width: 46px; height: 46px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
    border: 3px solid transparent; 
    background-image: conic-gradient(from -45deg, #facc15 0% 25%, #f97316 25% 50%, #ef4444 50% 75%, #a855f7 75% 100%);
    background-origin: border-box; background-clip: border-box; -webkit-background-clip: border-box; padding: 0;
}

.top-search-bar {
    width: fit-content;
    max-width: 70%;
    overflow: hidden;
    background: var(--bg-input);
    border-radius: 50px;
    display: flex;
    align-items: center;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}
.top-search-bar:focus-within { border-color: var(--primary); box-shadow: 0 0 20px rgba(250, 204, 21, 0.15); }
.top-search-bar svg { color: var(--text-muted); margin-right: 10px; width: 18px; height: 18px; flex-shrink: 0; }
.top-search-bar input { width: 150px; min-width: 100px; background: transparent; border: none; color: var(--text-main); font-family: 'Outfit', sans-serif; font-size: 0.95rem; outline: none; }
.top-search-bar input::placeholder { color: var(--text-muted); }
.search-text-btn { display: none; background: transparent; border: none; color: var(--primary); font-weight: 700; font-size: 0.95rem; cursor: pointer; padding-left: 10px; font-family: 'Outfit', sans-serif; transition: opacity 0.2s; }

.theme-toggle-btn { background: transparent; border: none; color: var(--text-main); cursor: pointer; padding: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.theme-toggle-btn:hover { color: var(--primary); transform: rotate(15deg); transition: 0.2s; }

/* ========== MAIN ========== */
main { max-width: 100%; margin: 0 auto; padding: 10px 0 85px; flex: 1; width: 100%; }

/* ========== BOTTOM NAV (3 TAB) ========== */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0; height: 65px;
    background: var(--bottom-nav-bg); backdrop-filter: blur(25px); -webkit-backdrop-filter: blur(25px);
    border-top: 1px solid var(--border-color); display: flex; justify-content: space-around; align-items: center;
    z-index: 1000; padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav.hidden { display: none !important; }

.nav-item {
    background: transparent; border: none; color: var(--text-muted); display: flex; flex-direction: column;
    align-items: center; gap: 4px; font-size: 0.7rem; font-weight: 600; font-family: 'Outfit', sans-serif;
    cursor: pointer; transition: all 0.3s ease; width: auto; padding: 0 20px;
}
.nav-item.active { color: var(--primary); }
.nav-item.active svg { stroke: var(--primary); transform: translateY(-2px); }

/* ========== EMPTY STATE ========== */
.empty-state { padding: 60px 20px; text-align: center; color: var(--text-muted); }
.empty-state h2 { font-size: 1.5rem; margin-bottom: 10px; color: var(--text-main); }

/* ========== DEVELOPER VIEW ========== */
#developer-view { padding: 0 20px; }
.social-profile-container { max-width: 600px; margin: 0 auto; background: var(--bg-card); border-radius: 16px; overflow: hidden; border: 1px solid var(--border-color); margin-bottom: 30px; }
.social-banner { width: 100%; height: 120px; background: #333; }
.social-banner img { width: 100%; height: 100%; object-fit: cover; }
.social-profile-header { display: flex; justify-content: space-between; align-items: flex-end; padding: 0 20px; margin-top: -40px; }
.social-avatar-wrapper { width: 80px; height: 80px; border-radius: 50%; background: var(--bg-card); padding: 4px; border: 2px solid var(--primary); box-shadow: 0 0 15px rgba(250, 204, 21, 0.2); }
.social-avatar { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.social-info { padding: 10px 20px 20px; }
.social-name-wrapper { display: flex; align-items: center; gap: 5px; margin-bottom: 2px; }
.social-name { font-size: 1.4rem; font-weight: 800; color: var(--text-main); }
.social-handle { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 15px; }
.social-bio { font-size: 0.95rem; line-height: 1.5; color: var(--text-main); margin-bottom: 15px; }

/* ========== KATEGORI / GENRE ========== */
.genre-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 10px; margin-bottom: 20px; }
.genre-btn {
    background: var(--bg-input); border: 1px solid var(--border-color); color: var(--text-muted); padding: 10px 5px; border-radius: 8px;
    font-family: 'Outfit', sans-serif; font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: all 0.3s; text-align: center;
}
.genre-btn:hover, .genre-btn.active { background: var(--gradient); color: #050505; border-color: transparent; box-shadow: 0 4px 15px rgba(250, 204, 21, 0.3); }

/* ========== SECTION & SCROLL CARD ========== */
.category-section { margin-bottom: 40px; padding-left: 20px; }
.header-flex { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; padding-right: 20px; }
.section-header { display: flex; align-items: center; gap: 10px; }
.bar-accent { width: 4px; height: 24px; background: var(--primary); border-radius: 2px; box-shadow: 0 0 12px var(--primary); }
h2, h3 { font-size: 1.25rem; font-weight: 700; color: var(--text-main); }
.more-link { color: var(--primary); font-size: 0.9rem; text-decoration: none; font-weight: 500; cursor: pointer; }

.horizontal-scroll { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 10px; padding-right: 20px; scroll-behavior: smooth; -ms-overflow-style: none; scrollbar-width: none; }
.horizontal-scroll::-webkit-scrollbar { display: none; }
.scroll-card { min-width: 140px; max-width: 140px; cursor: pointer; flex-shrink: 0; transition: transform 0.2s; }
.scroll-card:hover { transform: translateY(-5px); }
.scroll-card-img { position: relative; border-radius: 8px; overflow: hidden; aspect-ratio: 3/4; margin-bottom: 8px; box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
.scroll-card-img img { width: 100%; height: 100%; object-fit: cover; }
.scroll-card-title { font-size: 0.85rem; font-weight: 500; color: var(--text-main); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ep-badge { position: absolute; top: 6px; right: 6px; background: var(--gradient); color: #050505; font-size: 0.65rem; font-weight: 700; padding: 3px 6px; border-radius: 4px; }

/* ========== SEARCH RESULTS & GRID ========== */
.search-results-container { padding: 0 20px 30px; }
.anime-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; margin-top: 20px; }

.hidden { display: none !important; }

/* ========== DETAIL VIEW ========== */
#detail-view { padding: 0 20px; max-width: 1200px; margin: 0 auto; }

.nav-back button { background: transparent; color: var(--text-muted); border: none; padding: 10px 0; display: flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 500; margin-bottom: 5px; font-size: 0.9rem; }
.nav-back button:hover { color: var(--primary); }
.detail-breadcrumb { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 15px; }
.detail-title { font-size: 1.7rem; font-weight: 700; color: var(--text-main); line-height: 1.2; padding-right: 10px; }

.btn-fav-detail { background: transparent; border: none; cursor: pointer; color: var(--text-muted); display: flex; align-items: center; justify-content: center; padding: 5px; }
.btn-fav-detail.active svg { fill: #ef4444; stroke: #ef4444; }

.detail-actions { display: flex; flex-direction: row; gap: 12px; margin-top: 16px; margin-bottom: 20px; width: 100%; }
.btn-action { flex: 1; background: var(--gradient); color: #050505; border: none; padding: 12px 10px; border-radius: 6px; font-weight: 600; font-size: 0.95rem; cursor: pointer; display: flex; justify-content: center; align-items: center; gap: 6px; box-shadow: 0 4px 15px rgba(250, 204, 21, 0.25); }
.btn-action:hover { opacity: 0.9; transform: translateY(-2px); }

.ep-header-wrapper { margin-bottom: 15px; }
.ep-header-title { font-size: 1.25rem; font-weight: 700; color: var(--text-main); margin-bottom: 8px;}

.episode-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(65px, 1fr)); gap: 10px; margin-bottom: 40px; }
.ep-box { background: transparent; color: var(--text-muted); border: 1px solid var(--border-color); border-radius: 4px; padding: 10px 5px; text-align: center; cursor: pointer; font-weight: 500; font-size: 0.9rem; transition: 0.2s; }
.ep-box:hover { color: var(--text-main); border-color: var(--primary); background: rgba(250, 204, 21, 0.1); }

/* ========== VIDEO PLAYER INLINE ========== */
#inline-player-wrap {
    margin-bottom: 30px;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.inline-video-box {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    background: #000;
}

.inline-video-box iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border: none;
}

.inline-player-ui {
    background: var(--bg-card);
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
}

.inline-ep-title {
    color: var(--text-main);
    margin: 0 0 12px 0;
    font-size: 1rem;
    font-weight: 600;
}

.server-options {
    display: flex; gap: 8px; flex-wrap: wrap;
}
.server-tag {
    background: var(--bg-input); padding: 6px 12px; border-radius: 4px; cursor: pointer; 
    font-size: 0.8rem; border: 1px solid var(--border-color); color: var(--text-main); transition: all 0.3s;
}
.server-tag.active { background: var(--gradient); color: #050505; border-color: transparent; font-weight: 700; box-shadow: 0 4px 15px rgba(250, 204, 21, 0.25); }

/* ========== LOADING SPINNER ========== */
.spinner { border: 3px solid rgba(250, 204, 21, 0.2); border-left-color: var(--primary); border-radius: 50%; width: 40px; height: 40px; animation: spin 0.8s linear infinite; margin: 100px auto 20px; }
#loading p { text-align: center; color: var(--text-muted); font-size: 0.9rem; }
@keyframes spin { 100% { transform: rotate(360deg); } }

/* ========== HERO SLIDER ========== */
.hero-section-container { margin-bottom: 30px; }
.hero-slider { position: relative; width: 100%; padding-top: 56.25%; overflow: hidden; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.15); background: var(--bg-card); }
.hero-wrapper { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; }
.hero-slide { min-width: 100%; height: 100%; position: relative; flex-shrink: 0; }
.hero-bg { width: 100%; height: 100%; object-fit: cover; object-position: center 20%; position: absolute; z-index: 1; }
.hero-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: linear-gradient(to top, var(--bg-main) 5%, rgba(0,0,0,0.6) 50%, transparent 100%); z-index: 2; }
.hero-content { position: absolute; bottom: 20px; left: 20px; right: 20px; z-index: 3; max-width: 600px; }
.hero-badge { display: inline-block; background: var(--gradient); color: #050505; font-size: 0.75rem; font-weight: 700; padding: 4px 10px; border-radius: 4px; margin-bottom: 10px; }
.hero-title { font-size: 1.6rem; font-weight: 700; line-height: 1.2; margin-bottom: 8px; color: white; text-shadow: 2px 2px 4px rgba(0,0,0,0.5); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hero-meta { display: flex; gap: 15px; color: #ddd; font-size: 0.85rem; margin-bottom: 12px; font-weight: 500; }
.hero-btn { background: var(--primary); color: #050505; border: none; padding: 8px 20px; border-radius: 50px; font-weight: 700; font-size: 0.9rem; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; box-shadow: 0 4px 15px rgba(250, 204, 21, 0.2); }
.hero-btn:hover { background: var(--accent); transform: translateY(-3px); }

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .hero-slider { padding-top: 56.25%; }
    .hero-title { font-size: 1.4rem; }
}

@media (max-width: 500px) {
    .hero-slider { padding-top: 60%; border-radius: 0; margin-left: -20px; margin-right: -20px; width: calc(100% + 40px); }
    .hero-content { bottom: 15px; left: 40px; right: 40px; }
    .hero-title { font-size: 1.1rem; }
    .hero-btn { width: fit-content; padding: 6px 16px; font-size: 0.85rem; }
    .detail-title { font-size: 1.4rem; }
    .detail-actions { flex-direction: row; gap: 8px; }
    .btn-action { padding: 10px 5px; font-size: 0.85rem; }
    .nav-item { padding: 0 16px; }
}