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

:root {
    --bg-main: #050816;
    --bg-elevated: #0b1120;
    --bg-card: #111827;
    --bg-card-soft: #020617;
    --accent: #6366f1;
    --accent-soft: rgba(99, 102, 241, 0.18);
    --accent-strong: #f97316;
    --text-main: #f9fafb;
    --text-soft: #9ca3af;
    --border-subtle: #1f2937;
    --radius-lg: 18px;
    --radius-md: 14px;
    --shadow-soft: 0 18px 45px rgba(0,0,0,0.65);
    --shadow-card: 0 12px 30px rgba(15,23,42,0.85);
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top, #1f2937 0, #020617 40%, #000 100%);
    color: var(--text-main);
    min-height: 100vh;
}

/* HEADER */

.header {
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(18px);
    background: linear-gradient(135deg, #111827ee, #020617ee);
    border-bottom: 1px solid rgba(148,163,184,0.18);
}

.header-inner {
    max-width: 1024px;
    margin: 0 auto;
    padding: 14px 16px;
}

.brand-pill {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    background: linear-gradient(135deg, #22c1c3, #4b6bfb);
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 10px 25px rgba(37,99,235,0.6);
    flex-shrink: 0;
}

.brand-logo span {
    font-weight: 700;
    font-size: 18px;
}

.brand-text h1 {
    font-size: 20px;
    letter-spacing: 0.03em;
}

.brand-text h1 span {
    color: #a5b4fc;
}

.brand-text p {
    margin-top: 4px;
    font-size: 12px;
    color: #9ca3af;
}

/* MAIN LAYOUT */

main {
    max-width: 1024px;
    margin: 0 auto;
    padding: 14px 16px 28px;
}

/* SEARCH CARD */

.search-card {
    background: radial-gradient(circle at top left, #111827, #020617);
    border-radius: var(--radius-lg);
    padding: 12px 12px 14px;
    border: 1px solid rgba(148,163,184,0.2);
    box-shadow: var(--shadow-soft);
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 14px;
}

.search-input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(15,23,42,0.9);
    border-radius: 999px;
    padding: 6px 12px;
    border: 1px solid rgba(51,65,85,0.9);
}

.search-icon {
    font-size: 14px;
    opacity: 0.8;
}

#search-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 14px;
    outline: none;
    min-width: 0;
}

#search-input::placeholder {
    color: #6b7280;
}

.search-btn {
    padding: 9px 16px;
    border-radius: 999px;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    color: white;
    font-size: 13px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(79,70,229,0.8);
    transition: transform 0.08s ease-out, box-shadow 0.12s ease-out;
}

.search-btn:active {
    transform: scale(0.96);
    box-shadow: 0 6px 16px rgba(79,70,229,0.7);
}

/* TABS */

.filter-row {
    display: flex;
    justify-content: flex-start;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 7px 14px;
    border-radius: 999px;
    border: 1px solid rgba(55,65,81,0.9);
    background: rgba(15,23,42,0.9);
    color: #e5e7eb;
    font-size: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.16s, box-shadow 0.16s, transform 0.08s, border-color 0.16s;
}

.tab-btn.active {
    background: linear-gradient(135deg, #f97316, #fb7185);
    border-color: transparent;
    box-shadow: 0 10px 25px rgba(248,113,113,0.7);
    color: white;
}

.tab-btn:active {
    transform: scale(0.96);
}

/* SECTION HEAD */

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 4px 0 10px;
}

.section-head h2 {
    font-size: 20px;
}

.section-head p {
    color: var(--text-soft);
    font-size: 13px;
}

/* GRID DRAMA */

#drama-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
    margin-top: 4px;
}

/* CARD */

.drama-card {
    background: radial-gradient(circle at top, #111827, #020617 70%);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-card);
    transition: transform 0.2s ease-out, box-shadow 0.2s ease-out, border-color 0.2s;
    display: flex;
    flex-direction: column;
    position: relative;
}

.drama-card:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 16px 40px rgba(15,23,42,0.95);
    border-color: rgba(129,140,248,0.9);
}

.drama-card img {
    width: 100%;
    height: 215px;
    object-fit: cover;
    display: block;
}

/* BADGE EPISODE */

.badge-episode {
    position: absolute;
    bottom: 10px;
    left: 10px;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(15,23,42,0.9);
    color: #e5e7eb;
    font-size: 11px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* CARD INFO */

.drama-info {
    padding: 9px 10px 11px;
    text-align: left;
}

.drama-info h3 {
    font-size: 13px;
    margin-bottom: 4px;
    line-height: 1.3;
}

.drama-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: var(--text-soft);
}

.drama-tag {
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(31,41,55,0.9);
    border: 1px solid rgba(55,65,81,0.9);
}

/* LOAD MORE (disembunyikan, dipakai JS) */

.load-more-wrapper {
    display: none;
}

/* DETAIL PAGE */

#detail-page {
    display: none;
    margin-top: 4px;
}

.detail-header {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 10px;
}

.back-btn {
    background: rgba(15,23,42,0.95);
    color: #e5e7eb;
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid rgba(55,65,81,0.9);
    cursor: pointer;
    font-size: 13px;
}

/* DETAIL LAYOUT */

#drama-detail {
    display: grid;
    grid-template-columns: minmax(0, 210px) minmax(0, 1fr);
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 18px;
}

#drama-detail img {
    width: 100%;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
}

.detail-info-title {
    font-size: 20px;
    margin-bottom: 8px;
}

.detail-info-meta {
    font-size: 13px;
    color: var(--text-soft);
    margin-bottom: 10px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.detail-description {
    font-size: 13px;
    line-height: 1.6;
    color: #e5e7eb;
}

/* PLAYER */

#player {
    width: 100%;
    max-width: 900px;
    margin: 4px auto 20px;
    text-align: center;
}

#player video {
    width: 100%;
    max-height: 70vh;
    border-radius: var(--radius-lg);
    background: #000;
    box-shadow: var(--shadow-card);
}

/* EPISODES */

.section-title {
    text-align: left;
    margin: 8px 0 10px;
    font-size: 16px;
}

#episode-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 10px;
}

.episode-btn {
    background: rgba(15,23,42,0.95);
    padding: 10px 6px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 12px;
    border: 1px solid rgba(55,65,81,0.9);
    text-align: center;
    transition: background 0.16s, border-color 0.16s, transform 0.08s;
}

.episode-btn:hover {
    background: rgba(31,41,55,1);
}

.episode-btn.playing {
    background: linear-gradient(135deg, #6366f1, #ec4899);
    border-color: transparent;
    color: #f9fafb;
}

/* LOADING */

.loading {
    text-align: center;
    padding: 28px 8px;
    font-size: 14px;
    color: var(--text-soft);
}

/* FOOTER */

footer {
    text-align: center;
    padding: 20px 12px 26px;
    font-size: 11px;
    color: #6b7280;
    border-top: 1px solid rgba(31,41,55,0.9);
    background: radial-gradient(circle at top, #020617, #000 70%);
}

/* RESPONSIVE */

@media (max-width: 720px) {
    .header-inner {
        padding-inline: 12px;
    }

    .brand-pill {
        gap: 10px;
    }

    .brand-logo {
        width: 44px;
        height: 44px;
        border-radius: 15px;
    }

    .brand-text h1 {
        font-size: 18px;
    }

    main {
        padding-inline: 12px;
    }

    #drama-detail {
        grid-template-columns: 1fr;
    }

    #player {
        margin-top: 0;
    }
        }
