body {
    background-color: #121212;
    color: #e0e0e0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

* {
    box-sizing: border-box;
}

a {
    text-decoration: none;
    color: inherit;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    background-color: #1f1f1f;
    padding: 15px 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: #e50914;
    flex-shrink: 0;
}

.search-bar {
    flex-grow: 1;
    max-width: 400px;
}

.search-bar form {
    display: flex;
    width: 100%;
}

.search-bar input {
    width: 100%;
    padding: 10px 15px;
    border-radius: 4px 0 0 4px;
    border: 1px solid #333;
    background: #333;
    color: white;
    outline: none;
    font-size: 14px;
}

.search-bar button {
    padding: 10px 20px;
    border-radius: 0 4px 4px 0;
    border: 1px solid #e50914;
    background: #e50914;
    color: white;
    cursor: pointer;
    font-weight: bold;
}

/* Grid Layouts */
.section-title {
    margin-top: 30px;
    margin-bottom: 15px;
    border-left: 4px solid #e50914;
    padding-left: 10px;
    font-size: 20px;
    font-weight: 600;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
}

.card {
    background: #1f1f1f;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s;
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-5px);
}

.card-img {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
}

.card-content {
    padding: 10px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.card-title {
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 5px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.card-info {
    font-size: 12px;
    color: #aaa;
    margin-top: 5px;
}

/* Detail Page */
.detail-container {
    display: flex;
    gap: 30px;
    margin-top: 20px;
    align-items: flex-start;
}

.detail-cover {
    flex-shrink: 0;
}

.detail-cover img {
    width: 240px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

.detail-info {
    flex-grow: 1;
}

.detail-info h1 {
    margin-top: 0;
    color: #fff;
    font-size: 28px;
    line-height: 1.2;
}

.meta-info {
    color: #aaa;
    margin-bottom: 20px;
    font-size: 14px;
    display: flex;
    gap: 15px;
    align-items: center;
}

.description {
    line-height: 1.6;
    color: #ccc;
    margin-bottom: 25px;
    font-size: 15px;
}

.episode-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(55px, 1fr));
    gap: 8px;
    margin-top: 15px;
}

.episode-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2a2a2a;
    color: #fff;
    text-align: center;
    padding: 8px 4px;
    border-radius: 4px;
    font-size: 13px;
    transition: background 0.2s;
}

.episode-btn:hover {
    background: #e50914;
}

/* Player */
.player-container {
    max-width: 900px;
    margin: 0 auto;
}

.video-wrapper {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.video-wrapper video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.nav-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
    gap: 10px;
}

.btn {
    padding: 12px 20px;
    background: #333;
    color: white;
    border-radius: 4px;
    font-weight: 600;
    text-align: center;
    transition: background 0.2s;
    white-space: nowrap;
}

.btn:hover {
    background: #e50914;
}

/* Footer */
footer {
    text-align: center;
    padding: 30px 20px;
    margin-top: 50px;
    border-top: 1px solid #333;
    color: #777;
    font-size: 14px;
}

/* Responsive Mobile */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    /* Header Mobile */
    .header-content {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .logo {
        text-align: center;
        margin-bottom: 5px;
    }

    .search-bar {
        max-width: 100%;
    }

    /* Grid Mobile */
    .grid {
        grid-template-columns: repeat(2, 1fr); /* Force 2 columns on mobile */
        gap: 10px;
    }

    .card-title {
        font-size: 13px;
    }

    /* Detail Page Mobile */
    .detail-container {
        flex-direction: column;
        gap: 20px;
    }

    .detail-cover {
        width: 100%;
        display: flex;
        justify-content: center;
    }

    .detail-cover img {
        width: 160px; /* Smaller cover on mobile detail */
        box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    }

    .detail-info h1 {
        font-size: 22px;
        text-align: center;
    }

    .meta-info {
        justify-content: center;
        font-size: 13px;
    }

    .description {
        font-size: 14px;
        text-align: justify;
    }

    /* Player Mobile */
    .nav-buttons {
        flex-wrap: wrap;
    }

    .nav-buttons .btn {
        flex: 1 1 auto; /* Buttons grow to fill space */
        font-size: 14px;
        padding: 10px;
    }
    
    /* Order buttons for better mobile UX: Prev | Next on top row, List on bottom */
    .nav-buttons a[href*="detail.php"] {
        order: 3;
        width: 100%;
        margin-top: 5px;
    }
}
