html {
    scroll-behavior: smooth;
}
body {
    font-family: 'Inter', sans-serif;
    background-color: #1a1a1a;
    color: #f1f5f9;
    /* user-select: none;  Tinggalkan ini karena tidak memblokir scroll */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-touch-callout: none;
}
.theme-bg { background-color: #1a1a1a; }
/* [BARU] Darker BG untuk drawer */
.theme-bg-dark { background-color: #111; } 
.theme-text { color: #f0e68c; }
.card-bg { background-color: #2b2b2b; }
.nav-bg { background-color: #222222; }
.break-words { word-break: break-word; }

/* Custom scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #2b2b2b; }
::-webkit-scrollbar-thumb { background: #ffd700; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #ffc700; }

/* [MODIFIKASI] UI Kartu (Anime & Manga) */
.anime-grid-card {
    background-color: #2b2b2b;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    border: 1px solid #3f3f46;
}
.anime-grid-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5), 0 0 0 2px #ffd700;
}
.anime-grid-card-image-container {
    position: relative;
    aspect-ratio: 2 / 3;
    background-color: #333;
}
.anime-grid-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s ease;
}

/* [MODIFIKASI] Badge Episode Anime (kiri atas) */
.episode-badge {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    background-color: rgba(0, 0, 0, 0.7);
    color: #ffd700;
    padding: 0.25rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: bold;
    backdrop-filter: blur(4px);
    max-width: calc(100% - 1.5rem);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* [BARU] Badge Tipe Manga (kanan atas) */
.manga-type-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background-color: rgba(29, 78, 216, 0.8); /* Biru */
    color: #fff;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: bold;
    backdrop-filter: blur(4px);
}
/* [BARU] Badge Warna Manga (kiri atas) */
.manga-color-badge {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    background-color: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: bold;
    backdrop-filter: blur(4px);
}
.manga-color-badge.color {
    background-color: rgba(217, 119, 6, 0.8); /* Oranye */
}
.manga-color-badge.black {
    background-color: rgba(51, 65, 85, 0.8); /* Abu-abu */
}


.anime-grid-card-content {
    padding: 0.6rem;
    height: 3.75rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}
.anime-grid-card-title {
    font-weight: 600;
    color: #f1f5f9;
    font-size: 0.875rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.video-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    width: 100%;
    background-color: #000;
}
.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}
.episode-button.playing, .quality-btn.active {
    background-color: #ffd700;
    color: #1a1a1a;
    font-weight: bold;
}

.watched-episode {
    background-color: #3f3f46 !important;
    color: #a1a1aa !important;
}

/* [BARU] Watched Chapter (untuk manga) */
.watched-chapter {
    background-color: #374151 !important; /* lebih gelap */
    color: #9ca3af !important;
    border-color: #4b5563 !important;
}

/* Skeleton Loader Styles */
.skeleton {
    background-color: #333;
    border-radius: 0.5rem;
    animation: pulse 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .5; }
}
/* Placeholder untuk konten di List Anime */
.content-placeholder {
    min-height: 50vh; /* Memberi tinggi minimum agar skeleton terlihat */
}

#search-input { padding-left: 2.75rem; }

/* Tombol Bookmark di Detail (di bawah poster) */
.bookmark-btn-container {
     display: flex;
     justify-content: center;
     margin-top: 1rem;
}
.bookmark-btn-detail { /* [MODIFIKASI] ganti ID ke class */
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    border: 1px solid #4b5563;
}
 .bookmark-btn-detail svg {
     width: 1.25rem;
     height: 1.25rem;
 }
.bookmark-btn-detail.bookmarked {
    background-color: #ffd700;
    color: #1a1a1a;
    border-color: #ffd700;
}
.bookmark-btn-detail:not(.bookmarked) {
    background-color: transparent;
    color: #d1d5db;
}
.bookmark-btn-detail:hover:not(.bookmarked) {
     background-color: rgba(255, 215, 0, 0.1);
     border-color: #ffd700;
     color: #ffd700;
}
 .bookmark-btn-detail:hover.bookmarked {
     background-color: #e6c300;
     border-color: #e6c300;
}


/* Navigasi Kamus (All Anime) */
.kamus-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    right: 0;
    background-color: rgba(0,0,0,0.3);
    backdrop-filter: blur(5px);
    padding: 8px 4px;
    border-radius: 10px 0 0 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    z-index: 10;
    max-height: 80vh;
    overflow-y: auto;
}
.kamus-nav a {
    font-size: 0.7rem;
    font-weight: bold;
    color: #f1f5f9;
    padding: 0 4px;
    text-decoration: none;
}
.kamus-nav a:hover { color: #ffd700; }
.kamus-nav::-webkit-scrollbar { display: none; }
.kamus-nav { -ms-overflow-style: none; scrollbar-width: none; }


/* Tab untuk Halaman List (Ongoing/Tamat/Genre) */
.tab-btn {
    flex: 1;
    padding: 0.75rem 0.5rem;
    font-weight: 600;
    color: #a1a1aa;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
    text-align: center;
}
.tab-btn.active {
    color: #ffd700;
    border-bottom-color: #ffd700;
}

/* Navigasi Bawah (6 tombol) */
.nav-btn { width: 16.666%; }
.nav-btn span { font-size: 0.65rem; }

/* Style untuk nomor episode */
.episode-number {
     min-width: 2.5rem;
     text-align: right;
     font-weight: bold;
     color: #a1a1aa;
     margin-right: 0.75rem;
}
.episode-title {
     flex: 1;
     min-width: 0;
     overflow: hidden;
     text-overflow: ellipsis;
     white-space: nowrap;
}
.episode-list-item {
     display: flex;
     align-items: center;
     justify-content: space-between;
     width: 100%;
}

/* [BARU] Style untuk Hamburger Drawer */
.drawer-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    color: #d1d5db;
    transition: all 0.2s ease;
}
.drawer-btn:hover {
    background-color: #374151; /* gray-700 */
    color: #fff;
}
.drawer-btn.active {
    background-color: #ffd700;
    color: #1a1a1a;
}
.drawer-btn.active svg {
    stroke: #1a1a1a;
}

/* [BARU] Style untuk Manga Reader */
#manga-reader-container {
    position: fixed;
    inset: 0;
    background-color: #111; /* Latar belakang reader */
    z-index: 100;
    overflow-y: auto;
}
#manga-image-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    /* Padding untuk memberi ruang bagi header/footer */
    padding-top: 80px; 
    padding-bottom: 80px;
}
#manga-image-container img {
    width: 100%;
    max-width: 800px; /* Lebar maks gambar */
    height: auto;
    display: block;
    background-color: #333; /* fallback jika gambar lambat load */
    /* [DIHAPUS] min-height: 300px; (ini bisa sebabkan lompat) */
}

/* === PERBAIKAN BUG FLICKER/KEDUT === */
#manga-image-container img.loading {
    /* [DIHAPUS] animation: pulse 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite; */
    /* Cukup berikan background, jangan pakai animasi opacity */
    background-color: #333;
    min-height: 300px; /* fallback tinggi saat loading */
}
/* [DIHAPUS] @keyframes pulse */
/* @keyframes pulse { ... } */
/* === AKHIR PERBAIKAN === */


/* [MODIFIKASI] Styling Navigasi Bawah Manga Reader */
.manga-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: #374151;
    color: #d1d5db;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    transition: all 0.2s ease;
    flex-grow: 1; /* Biar rata kiri/kanan */
    justify-content: center;
    max-width: 40%;
}
.manga-nav-btn:hover {
    background-color: #4b5563;
}
.manga-nav-btn:disabled {
    background-color: #1f2937;
    color: #4b5563;
    cursor: not-allowed;
}

/* [BARU] Tombol Refresh di tengah */
.manga-refresh-btn {
    background-color: #ffd700;
    color: #111;
    width: 56px; /* Ukuran bulat */
    height: 56px; /* Ukuran bulat */
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4);
    transition: all 0.2s ease;
    flex-shrink: 0; /* Pastikan ukurannya tetap */
    
}
.manga-refresh-btn:hover {
    background-color: #e6c300;
    transform: scale(1.05);
}
.manga-refresh-btn svg {
    width: 28px;
    height: 28px;
    stroke-width: 3;
}
.manga-refresh-btn.rotating svg {
    animation: spin 1s linear infinite;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}


/* [BARU] Efek Sembunyi/Tampil Bar di Manga Reader */
#manga-reader-header.bars-hidden {
    transform: translateY(-100%);
}
#manga-reader-footer.bars-hidden {
    transform: translateY(100%);
}

/* [BARU] Tombol pagination */
.pagination-btn {
    background-color: #374151; /* gray-700 */
    color: #f1f5f9;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}
.pagination-btn:hover {
    background-color: #4b5563; /* gray-600 */
}
.pagination-btn:disabled {
    background-color: #1f2937; /* gray-800 */
    color: #4b5563; /* gray-600 */
    cursor: not-allowed;
}
.pagination-text {
    font-weight: 600;
    color: #9ca3af; /* gray-400 */
    padding: 0.5rem;
}

/* === [BARU] Halaman Auth (Login/Register/Profile) === */
.auth-container {
    max-width: 400px;
    margin: 2rem auto;
    background-color: #2b2b2b; /* card-bg */
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid #3f3f46;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.auth-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #d1d5db; /* gray-300 */
}

/* [BARU] Kontainer untuk input + ikon mata */
.auth-input-container {
    position: relative;
}

.auth-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: #374151; /* gray-700 */
    color: #f1f5f9; /* gray-100 */
    border-radius: 8px;
    border: 1px solid #4b5563; /* gray-600 */
    transition: all 0.2s ease;
    /* [BARU] Beri ruang untuk ikon mata */
    padding-right: 3rem; 
}
.auth-input:focus {
    outline: none;
    border-color: #ffd700;
    box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.4);
}
/* Ganti warna placeholder */
.auth-input::placeholder {
    color: #9ca3af; /* gray-400 */
}

/* [BARU] Tombol Ikon Mata */
.auth-password-toggle {
    position: absolute;
    top: 50%;
    right: 0.75rem;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #9ca3af; /* gray-400 */
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 99px;
    /* [MODIFIKASI] Sesuaikan posisi karena label di atas */
    margin-top: 0.75rem; 
}
.auth-input-container .auth-password-toggle {
     margin-top: 0; /* Reset jika label di dalam container */
}
/* Posisikan tombol mata dengan benar saat label ada di atas input */
.auth-input-container input + .auth-password-toggle {
    top: 60%; /* Sesuaikan ini jika perlu */
}
.auth-input-container label + input + .auth-password-toggle {
    top: 60%; /* Sesuaikan ini jika perlu */
}
/* Aturan yang lebih sederhana untuk input yang langsung di dalam container */
.auth-input-container > input {
    margin-top: 0;
}
.auth-input-container > .auth-password-toggle {
    top: 50%;
    margin-top: 0;
}


.auth-password-toggle:hover {
    color: #f1f5f9; /* gray-100 */
    background-color: #4b5563; /* gray-600 */
}
.auth-password-toggle svg {
    width: 1.25rem;
    height: 1.25rem;
}

.auth-checkbox {
    border-radius: 4px;
    border-color: #4b5563;
    background-color: #374151;
    color: #ffd700;
    transition: all 0.2s;
}
.auth-checkbox:focus {
    ring: #ffd700;
    ring-offset-color: #2b2b2b;
}

.auth-button {
    width: 100%;
    display: flex; /* [BARU] Untuk loading spinner */
    justify-content: center; /* [BARU] Untuk loading spinner */
    align-items: center; /* [BARU] Untuk loading spinner */
    padding: 0.75rem 1.5rem;
    background-color: #ffd700;
    color: #1a1a1a;
    font-weight: 700;
    font-size: 1rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 46px; /* [BARU] Beri tinggi agar spinner pas */
}
.auth-button:hover {
    background-color: #e6c300;
}
/* [BARU] State loading/disabled */
.auth-button:disabled {
    background-color: #4b5563; /* gray-600 */
    color: #9ca3af; /* gray-400 */
    cursor: not-allowed;
}

/* [BARU] Loading Spinner */
.auth-spinner {
    width: 1.25rem;
    height: 1.25rem;
    border: 3px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
/* Keyframe spin sudah ada di CSS Anda, jadi tidak perlu ditambah lagi */

.auth-button-secondary {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background-color: #374151; /* gray-700 */
    color: #f1f5f9; /* gray-100 */
    font-weight: 600;
    border: 1px solid #4b5563; /* gray-600 */
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.auth-button-secondary:hover {
    background-color: #4b5563; /* gray-600 */
}

.auth-button-danger {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background-color: rgba(239, 68, 68, 0.2); /* red-500/20 */
    color: #f87171; /* red-400 */
    font-weight: 600;
    border: 1px solid #ef4444; /* red-500 */
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.auth-button-danger:hover {
    background-color: rgba(239, 68, 68, 0.3);
    color: #ef4444; /* red-500 */
}

.auth-error-message {
    background-color: rgba(239, 68, 68, 0.2); /* red-500/20 */
    color: #f87171; /* red-400 */
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-weight: 500;
    text-align: center;
}
.auth-success-message {
    background-color: rgba(52, 211, 153, 0.2); /* green-400/20 */
    color: #34d399; /* green-400 */
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-weight: 500;
    text-align: center;
}