/* style.css */

:root {
    --primary-color: #e50914;
    /* Netflix red */
    --background-color: #141414;
    --text-color: #e0e0e0;
    --card-background: #222;
    --border-color: #333;
    --hover-color: #f40612;
    --free-tag-color: #4CAF50;
    /* Green for free */
    --paid-tag-color: #FFC107;
    /* Yellow for paid */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    scroll-behavior: smooth;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

header {
    background-color: #000;
    padding: 20px 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    /* Untuk responsif */
}

header h1 {
    color: var(--primary-color);
    font-size: 2.5em;
    margin-bottom: 10px;
    /* Untuk responsif */
}

#search-input {
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    background-color: var(--card-background);
    color: var(--text-color);
    border-radius: 5px;
    width: 100%;
    /* Default ke 100% */
    max-width: 300px;
    /* Batasi lebar */
    font-size: 1em;
}

#search-input::placeholder {
    color: #888;
}

main {
    padding: 40px 0;
}

#drama-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.drama-card {
    background-color: var(--card-background);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    cursor: pointer;
    text-align: center;
}

.drama-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.5);
}

.drama-card img {
    width: 100%;
    height: 300px;
    /* Tinggi gambar konsisten */
    object-fit: cover;
    display: block;
    border-bottom: 1px solid var(--border-color);
}

.drama-card-info {
    padding: 15px;
}

.drama-card h3 {
    font-size: 1.3em;
    margin-bottom: 8px;
    color: var(--primary-color);
    height: 50px;
    /* Batasi tinggi untuk judul */
    overflow: hidden;
    text-overflow: ellipsis;
}

.drama-card p {
    font-size: 0.9em;
    color: #bbb;
    height: 40px;
    /* Batasi tinggi untuk deskripsi singkat */
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Modal Styling */
.modal {
    display: none;
    /* Hidden by default */
    position: fixed;
    /* Stay in place */
    z-index: 1000;
    /* Sit on top */
    left: 0;
    top: 0;
    width: 100%;
    /* Full width */
    height: 100%;
    /* Full height */
    overflow: auto;
    /* Enable scroll if needed */
    background-color: rgba(0, 0, 0, 0.8);
    /* Black w/ opacity */
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
    /* Show when active */
}

.modal-content {
    background-color: var(--card-background);
    margin: auto;
    padding: 30px;
    border-radius: 10px;
    width: 90%;
    max-width: 900px;
    /* Lebih lebar untuk player dan daftar episode */
    position: relative;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    text-align: left;
    transform: scale(0.9);
    transition: transform 0.3s ease-out;
    display: flex;
    /* Untuk layout flexbox di dalam modal */
    flex-direction: column;
    gap: 20px;
}

.modal.active .modal-content {
    transform: scale(1);
}

.close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    top: 10px;
    right: 20px;
    cursor: pointer;
    transition: color 0.2s;
}

.close-button:hover,
.close-button:focus {
    color: var(--primary-color);
    text-decoration: none;
    cursor: pointer;
}

.detail-header {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    margin-bottom: 20px;
    flex-wrap: wrap;
    /* Untuk responsif */
}

.detail-header img {
    width: 180px;
    height: auto;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.detail-info-header {
    flex-grow: 1;
}

#detail-title {
    color: var(--primary-color);
    font-size: 2.2em;
    margin-bottom: 10px;
    margin-top: 0;
    /* Override default h2 margin */
}

.modal-content p {
    margin-bottom: 10px;
    color: #ccc;
}

.modal-content strong {
    color: var(--primary-color);
}

/* Video Player Styling */
.video-player-wrapper {
    background-color: #000;
    border-radius: 8px;
    overflow: hidden;
    padding: 15px;
    margin-bottom: 20px;
}

.video-player-wrapper h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.5em;
    text-align: center;
}

.video-player {
    width: 100%;
    aspect-ratio: 16 / 9;
    /* Responsive aspect ratio */
    background-color: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #888;
    font-size: 1.2em;
    border-radius: 5px;
    overflow: hidden;
    /* Ensure iframe stays within bounds */
}

.video-player iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

.button {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    padding: 12px 25px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    margin-top: 15px;
    /* Sesuaikan margin */
    transition: background-color 0.2s;
    float: right;
    /* Taruh di kanan bawah player */
}

.button:hover {
    background-color: var(--hover-color);
}

/* Chapter List Styling */
.chapter-list-container h3 {
    color: var(--primary-color);
    font-size: 1.5em;
    margin-bottom: 15px;
    text-align: center;
}

#chapter-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    /* Grid untuk chapter */
    gap: 10px;
    max-height: 300px;
    /* Batasi tinggi daftar episode */
    overflow-y: auto;
    /* Bisa discroll */
    padding-right: 10px;
    /* Space for scrollbar */
}

#chapter-list li {
    background-color: #333;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95em;
    border: 1px solid transparent;
}

#chapter-list li:hover {
    background-color: #444;
    transform: translateY(-2px);
    border-color: var(--primary-color);
}

#chapter-list li.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    font-weight: bold;
}

#chapter-list li.active:hover {
    background-color: var(--hover-color);
}

.chapter-status {
    font-size: 0.8em;
    padding: 3px 8px;
    border-radius: 3px;
    color: white;
    margin-left: 10px;
}

.chapter-status.free {
    background-color: var(--free-tag-color);
}

.chapter-status.paid {
    background-color: var(--paid-tag-color);
}

footer {
    background-color: #000;
    color: #888;
    text-align: center;
    padding: 20px 0;
    margin-top: 40px;
    border-top: 1px solid var(--border-color);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        text-align: center;
    }

    header h1 {
        margin-bottom: 15px;
    }

    #search-input {
        max-width: 80%;
        /* Lebar penuh di mobile */
    }

    #drama-list {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .drama-card img {
        height: 220px;
    }

    .modal-content {
        width: 95%;
        padding: 20px;
    }

    .detail-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .detail-header img {
        width: 150px;
    }

    #detail-title {
        font-size: 1.8em;
    }

    #chapter-list {
        grid-template-columns: 1fr;
        /* Satu kolom di mobile */
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 2em;
    }

    .drama-card img {
        height: 180px;
    }

    .drama-card h3 {
        font-size: 1.1em;
        height: auto;
    }

    .drama-card p {
        font-size: 0.8em;
        height: auto;
    }

    .video-player-wrapper h3 {
        font-size: 1.2em;
    }

    .chapter-list-container h3 {
        font-size: 1.2em;
    }
}