/* public/detail.css */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&display=swap');

:root {
    --primary: #00aaff;
    --primary-glow: rgba(0, 170, 255, 0.5);
    --bg-dark: #0A0A0B; /* Sedikit lebih gelap */
    --bg-card: #141418; /* Warna card yang lebih kontras */
    --text-white: #f0f0f0;
    --text-gray: #a0a0a0;
    --radius: 12px;
    --transition-smooth: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

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

body {
    background-color: var(--bg-dark);
    font-family: 'Poppins', sans-serif;
    color: var(--text-white);
    overflow-x: hidden;
}

/* --- HEADER / NAVBAR --- */
.detail-navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 1rem 1.5rem;
    z-index: 100;
    display: flex;
    align-items: center;
    background: transparent;
    transition: background-color 0.3s ease-in-out, backdrop-filter 0.3s ease-in-out;
}

.detail-navbar.scrolled {
    background: rgba(10, 10, 11, 0.8);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.back-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    font-size: 1.2rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: var(--transition-smooth);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}
.back-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}
.back-btn:active {
    transform: scale(0.95);
    background: var(--primary);
}

/* --- HERO SECTION --- */
.detail-hero {
    position: relative;
    width: 100%;
    height: 40vh; /* Tinggi viewport, bisa disesuaikan */
    min-height: 350px;
    display: flex;
    align-items: flex-end;
    color: white;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    top: -10%; /* Posisi awal untuk parallax */
    left: 0;
    width: 100%;
    height: 120%; /* Lebih tinggi untuk parallax */
    background-size: cover;
    background-position: center 20%;
    filter: blur(8px) brightness(0.5);
    transform: scale(1.1); /* Sedikit zoom untuk feel premium */
    z-index: 1;
}

.hero-gradient {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 80%;
    background: linear-gradient(to top, var(--bg-dark) 5%, transparent 100%);
    z-index: 2;
}

.hero-content {
    position: relative;
    z-index: 3;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 2rem;
    align-items: flex-end;
}

.poster-wrapper {
    width: 180px;
    aspect-ratio: 2/3;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.1);
    transform: translateY(20%); /* Poster sedikit ke bawah */
    transition: transform 0.5s ease-out;
}
.poster-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-info {
    padding-bottom: 1rem;
}

.anime-title {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 0.8rem;
    text-shadow: 0 3px 15px rgba(0, 0, 0, 0.7);
}

.anime-meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}
.meta-badge {
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 25px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-white);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-smooth);
}
.meta-badge i {
    color: var(--primary);
    font-size: 0.9rem;
}
.meta-badge:hover {
    background: rgba(0, 0, 0, 0.5);
    transform: translateY(-2px);
}

/* --- ACTION BUTTONS --- */
.action-buttons {
    display: flex;
    gap: 1rem;
}
.btn {
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    font-size: 0.9rem;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    cursor: pointer;
}
.btn:active {
    transform: scale(0.95);
}

.btn-primary {
    background: linear-gradient(45deg, var(--primary), #00c3ff);
    color: white;
    box-shadow: 0 5px 20px var(--primary-glow);
}
.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px var(--primary-glow);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}


/* --- CONTENT AREA --- */
.content-area {
    padding: 4rem 1.5rem 2rem; /* Padding atas lebih besar karena poster */
    max-width: 1200px;
    margin: 0 auto;
}

.section {
    margin-bottom: 3rem;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
.section.visible {
    opacity: 1;
    transform: translateY(0);
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-white);
    position: relative;
}
.section-title::before {
    content: '';
    width: 5px;
    height: 28px;
    background: var(--primary);
    border-radius: 3px;
    box-shadow: 0 0 15px var(--primary-glow);
}

.synopsis {
    font-size: 0.95rem;
    color: var(--text-gray);
    line-height: 1.8;
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius);
    position: relative;
    transition: max-height 0.5s ease-in-out;
    overflow: hidden;
}

.synopsis.collapsed {
    max-height: 120px; /* Tinggi saat terlipat */
}
.synopsis.collapsed::after { /* Efek fade di bawah */
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50px;
    background: linear-gradient(to top, var(--bg-card), transparent);
    pointer-events: none;
}

.read-more {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    display: block;
    width: fit-content;
    margin: 1rem auto 0;
    transition: var(--transition-smooth);
}
.read-more:hover {
    background: var(--primary);
    color: white;
    box-shadow: 0 0 15px var(--primary-glow);
}


/* --- DETAIL INFO GRID --- */
.detail-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    list-style: none;
}
.detail-item {
    background: var(--bg-card);
    padding: 1rem;
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.detail-key {
    font-size: 0.75rem;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.detail-value {
    font-weight: 600;
    color: var(--text-white);
    font-size: 0.9rem;
}

/* --- EPISODE LIST --- */
.episode-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.8rem;
    max-height: 450px; /* Batasi tinggi maksimum */
    overflow-y: auto; /* Aktifkan scroll vertikal jika perlu */
    padding-right: 0.5rem; /* Ruang untuk scrollbar */
}

.episode-item {
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--bg-card);
    padding: 1.2rem 1rem;
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text-gray);
    font-weight: 500;
    font-size: 0.9rem;
    transition: var(--transition-smooth);
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
}
.episode-item:hover {
    transform: translateY(-5px);
    background: #1f1f23;
    color: var(--text-white);
    border-color: var(--primary);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}
.episode-item:active {
    transform: translateY(-2px);
    background: var(--primary);
    color: white;
}
.episode-item .ep-title {
    font-weight: 600;
}
.episode-item .ep-date { display: none; } /* Tidak relevan di grid */


/* SKELETON LOADER */
.skeleton {
    background-color: #1a1a1a;
    border-radius: 4px;
    animation: pulse 1.5s infinite ease-in-out;
}
@keyframes pulse {
    0% { background-color: #1a1a1a; }
    50% { background-color: #242424; }
    100% { background-color: #1a1a1a; }
}
.skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
}


/* RESPONSIVE DESIGN */
@media (max-width: 768px) {
    .detail-hero {
        height: auto;
        min-height: 0;
    }
    .hero-content {
        grid-template-columns: 1fr;
        text-align: center;
        padding-top: 8rem; /* Ruang untuk navbar */
        gap: 1.5rem;
    }
    .poster-wrapper {
        width: 150px;
        transform: translateY(0);
        margin: 0 auto;
    }
    .hero-info {
        padding-bottom: 0;
    }
    .anime-title {
        font-size: 1.8rem;
    }
    .anime-meta {
        justify-content: center;
    }
    .action-buttons {
        justify-content: center;
    }
    .content-area {
        padding-top: 2rem;
    }
    .episode-list {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
}

@media (max-width: 480px) {
    .detail-navbar {
        padding: 0.8rem 1rem;
    }
    .hero-content {
        padding-top: 6rem;
    }
    .poster-wrapper {
        width: 120px;
    }
    .anime-title {
        font-size: 1.5rem;
    }
    .meta-badge {
        padding: 0.4rem 0.8rem;
        font-size: 0.7rem;
    }
    .btn {
        padding: 0.7rem 1.2rem;
        font-size: 0.8rem;
    }
    .section-title {
        font-size: 1.2rem;
    }
    .episode-list {
        gap: 0.5rem;
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }
    .episode-item {
        padding: 1rem 0.5rem;
    }
}
