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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #0f0f0f;
    color: #fff;
}

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

/* Movie page specific container width */
.movie-page-body .container {
    max-width: 1200px;
}

/* Main Header Navigation */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    background: #1a1a1a;
    padding: 16px 24px;
    border-radius: 8px;
    position: relative;
}

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.mobile-menu-toggle span {
    display: block;
    width: 24px;
    height: 3px;
    background: #fff;
    border-radius: 2px;
    transition: all 0.3s;
}

/* Main Navigation */
.main-nav {
    display: flex;
    gap: 8px;
    align-items: center;
}

.nav-link {
    padding: 10px 20px;
    color: #999;
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.2s;
    position: relative;
}

.nav-link:hover {
    color: #fff;
    background: #2a2a2a;
}

.nav-link.active {
    color: #fff;
    background: #2563eb;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: transparent;
}

h1 {
    font-size: 2rem;
    font-weight: 600;
}

.btn-logout {
    padding: 10px 20px;
    background: #333;
    border: none;
    border-radius: 4px;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
    flex-shrink: 0;
}

.btn-logout:hover {
    background: #444;
}

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

.movie-card {
    background: #1a1a1a;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s;
    text-decoration: none;
    color: inherit;
    display: block;
}

.movie-card:hover {
    transform: scale(1.05);
}

.movie-poster {
    width: 100%;
    aspect-ratio: 2/3;
    background: #2a2a2a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
}

.movie-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.poster-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 14px;
}

.movie-info {
    padding: 15px;
}

.movie-title {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 5px;
}

.movie-details {
    display: flex;
    gap: 10px;
    font-size: 14px;
    color: #999;
}

.movie-year, .movie-rating {
    font-size: 14px;
    color: #999;
}

/* Home page sections */
.home-section {
    margin-bottom: 60px;
}

.home-section:last-child {
    margin-bottom: 0;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.view-all-link {
    color: #2563eb;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 4px;
    transition: all 0.2s;
}

.view-all-link:hover {
    background: rgba(37, 99, 235, 0.1);
    color: #3b82f6;
}

/* Player page styles */
.back-link {
    color: #fff;
    text-decoration: none;
    padding: 10px 20px;
    background: #333;
    border-radius: 4px;
    font-size: 14px;
    transition: background 0.2s;
}

.back-link:hover {
    background: #444;
}

.player-page {
    max-width: 1200px;
    margin: 0 auto;
}

.player-page h1 {
    font-size: 2rem;
    margin-bottom: 10px;
}

.movie-meta {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    font-size: 16px;
    color: #999;
}

.movie-overview {
    margin-bottom: 20px;
    line-height: 1.6;
    color: #ccc;
}

.player-controls-bar {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    padding: 15px;
    background: #1a1a1a;
    border-radius: 8px;
}

.audio-track-selector {
    display: none;
    flex: 1;
    min-width: 0;
}

.audio-track-selector label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #999;
}

.audio-track-select {
    width: 100%;
    max-width: 500px;
    padding: 10px;
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 4px;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
}

.audio-track-select:hover {
    border-color: #666;
}

.audio-track-select:focus {
    outline: none;
    border-color: #888;
}

.playback-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.control-btn {
    padding: 16px 28px;
    background: #4a4a4a;
    border: 2px solid #666;
    border-radius: 8px;
    color: #ffffff;
    cursor: pointer;
    font-size: 18px;
    font-weight: 600;
    transition: all 0.2s;
    min-width: 120px;
    min-height: 52px;
    letter-spacing: 0.3px;
}

.control-btn:hover {
    background: #5a5a5a;
    border-color: #888;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.control-btn:active {
    background: #666;
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.control-btn:focus {
    outline: none;
    border-color: #aaa;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.15);
}

@media (max-width: 768px) {
    .player-controls-bar {
        flex-direction: column;
        gap: 15px;
    }

    .audio-track-selector {
        width: 100%;
    }

    .playback-controls {
        width: 100%;
        justify-content: space-between;
        gap: 5px;
    }

    .control-btn {
        padding: 10px 12px;
        font-size: 14px;
        min-width: 70px;
        min-height: 44px;
        flex: 1;
    }
}

.player-container {
    position: relative;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}

video {
    width: 100%;
    background: #000;
}

.loading {
    text-align: center;
    padding: 40px;
    font-size: 18px;
    color: #999;
}

/* Cache preparing message */
.cache-preparing-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    padding: 40px;
    border-radius: 12px;
    text-align: center;
    z-index: 1000;
    min-width: 300px;
}

.cache-preparing-message p {
    margin: 10px 0;
    color: #fff;
    font-size: 16px;
}

.cache-preparing-message .progress-text {
    color: #999;
    font-size: 14px;
}

/* Loading spinner */
.loading-spinner {
    border: 4px solid #333;
    border-top: 4px solid #fff;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Header styles */
.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

/* Content tabs */
.content-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid #333;
    margin-bottom: 30px;
}

.tab-btn {
    padding: 12px 24px;
    background: transparent;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    margin-bottom: -1px;
}

.tab-btn:hover {
    color: #999;
}

.tab-btn.active {
    color: #fff;
    border-bottom-color: #fff;
}

/* TV Show card badge */
.tvshow-card .movie-poster {
    position: relative;
}

.tvshow-badge {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.85);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    color: #fff;
}

/* TV Show page */
.tvshow-page {
    max-width: 1200px;
    margin: 0 auto;
}

.tvshow-header {
    display: flex;
    gap: 30px;
    margin-bottom: 40px;
}

.tvshow-poster-container {
    flex-shrink: 0;
}

.tvshow-poster {
    width: 200px;
    height: 300px;
    object-fit: cover;
    border-radius: 8px;
    background: #2a2a2a;
}

.tvshow-info {
    flex: 1;
}

.tvshow-info h1 {
    font-size: 2rem;
    margin-bottom: 10px;
}

.tvshow-meta {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    font-size: 16px;
    color: #999;
}

.tvshow-overview {
    line-height: 1.6;
    color: #ccc;
}

/* Season selector */
.season-selector {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 30px;
    padding: 15px;
    background: #1a1a1a;
    border-radius: 8px;
}

.season-selector label {
    font-size: 16px;
    font-weight: 500;
    color: #999;
}

.season-select {
    padding: 10px 15px;
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 4px;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    min-width: 200px;
}

.season-select:hover {
    border-color: #666;
}

.season-select:focus {
    outline: none;
    border-color: #888;
}

/* Episode grid */
.episode-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.episode-card {
    background: #1a1a1a;
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s;
}

.episode-card:hover {
    transform: scale(1.03);
}

.episode-card.episode-unavailable {
    opacity: 0.5;
    pointer-events: none;
}

.episode-still {
    position: relative;
    aspect-ratio: 16/9;
    background: #2a2a2a;
}

.episode-still img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.still-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 18px;
    font-weight: 500;
}

.episode-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.85);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.episode-info {
    padding: 12px 15px;
}

.episode-number {
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
    font-weight: 500;
}

.episode-title {
    font-size: 14px;
    font-weight: 500;
    color: #fff;
}

/* Episode page */
.episode-page {
    max-width: 1200px;
    margin: 0 auto;
}

.episode-breadcrumb {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    font-size: 14px;
    color: #666;
}

.episode-breadcrumb a {
    color: #999;
    text-decoration: none;
}

.episode-breadcrumb a:hover {
    color: #fff;
}

.breadcrumb-separator {
    color: #444;
}

.episode-page h1 {
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.episode-meta {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    font-size: 14px;
    color: #999;
}

.episode-number-meta {
    font-weight: 500;
}

.episode-overview {
    margin-bottom: 20px;
    line-height: 1.6;
    color: #ccc;
}

/* Episode navigation */
.episode-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #333;
}

.nav-btn {
    padding: 12px 24px;
    background: #333;
    border-radius: 6px;
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

.nav-btn:hover {
    background: #444;
}

.nav-btn-prev {
    margin-right: auto;
}

.nav-btn-next {
    margin-left: auto;
}

.next-episode-highlight {
    background: #2563eb;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* TV Show Hero Section */
.tvshow-hero {
    display: flex;
    gap: 30px;
    margin-bottom: 30px;
    padding: 20px;
    background: #1a1a1a;
    border-radius: 8px;
    max-width: 1600px;
    margin-left: auto;
    margin-right: auto;
}

.tvshow-hero-poster {
    width: 180px;
    height: 270px;
    object-fit: cover;
    border-radius: 8px;
    background: #2a2a2a;
    flex-shrink: 0;
}

.tvshow-hero-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.tvshow-hero-info h1 {
    font-size: 2rem;
    font-weight: 600;
    margin: 0;
}

.tvshow-hero-meta {
    display: flex;
    gap: 15px;
    font-size: 16px;
    color: #999;
}

.tvshow-hero-year,
.tvshow-hero-rating {
    color: #999;
}

.tvshow-hero-overview {
    line-height: 1.6;
    color: #ccc;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Movie Hero Section */
.movie-hero {
    display: flex;
    gap: 30px;
    margin-bottom: 30px;
    padding: 20px;
    background: #1a1a1a;
    border-radius: 8px;
    max-width: 1600px;
    margin-left: auto;
    margin-right: auto;
}

.movie-hero-poster {
    width: 180px;
    height: 270px;
    object-fit: cover;
    border-radius: 8px;
    background: #2a2a2a;
    flex-shrink: 0;
}

.movie-hero-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.movie-hero-info h1 {
    font-size: 2rem;
    font-weight: 600;
    margin: 0;
}

.movie-hero-meta {
    display: flex;
    gap: 15px;
    font-size: 16px;
    color: #999;
}

.movie-hero-year,
.movie-hero-rating {
    color: #999;
}

.movie-hero-overview {
    line-height: 1.6;
    color: #ccc;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* TV Show Player Layout - Two Column Design */
.tvshow-player-layout {
    display: flex;
    gap: 20px;
    max-width: 1600px;
    margin: 0 auto;
}

/* Left Main Content - Player (70%) */
.player-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.player-section {
    flex-shrink: 0;
}

/* Episode Info Section */
.episode-info-section {
    background: #1a1a1a;
    border-radius: 8px;
    padding: 24px;
}

.episode-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.episode-number-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    background: #2563eb;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.episode-title-main {
    font-size: 1.75rem;
    font-weight: 600;
    line-height: 1.3;
    margin: 0;
}

.episode-overview-text {
    line-height: 1.6;
    color: #ccc;
    font-size: 15px;
}

/* Auto Next Episode Info */
.auto-next-info {
    margin-top: 20px;
    padding: 16px;
    background: rgba(37, 99, 235, 0.1);
    border: 1px solid rgba(37, 99, 235, 0.3);
    border-radius: 6px;
}

.auto-next-info.hidden {
    display: none;
}

.auto-next-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.auto-next-icon {
    font-size: 20px;
    color: #2563eb;
}

.auto-next-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.auto-next-label {
    font-size: 12px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.auto-next-title {
    font-size: 14px;
    color: #fff;
    font-weight: 500;
}

/* Right Sidebar - Episode List (30%) */
.episode-sidebar {
    width: 30%;
    min-width: 280px;
    max-width: 400px;
    background: #1a1a1a;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 120px);
    position: sticky;
    top: 20px;
}

.episode-sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #333;
}

.episode-sidebar-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.3;
}

.tvshow-meta-small {
    display: flex;
    gap: 12px;
    font-size: 14px;
    color: #999;
}

.tvshow-year-small,
.tvshow-rating-small {
    color: #999;
}

.episode-list-container {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.episode-list-container::-webkit-scrollbar {
    width: 8px;
}

.episode-list-container::-webkit-scrollbar-track {
    background: #1a1a1a;
}

.episode-list-container::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
}

.episode-list-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.episode-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Season header in episode list */
.season-header {
    padding: 12px 12px 8px 12px;
    font-size: 14px;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 8px;
}

.season-header:first-child {
    margin-top: 0;
}

/* Episode item in sidebar */
.episode-item {
    padding: 12px;
    background: #242424;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.episode-item:hover {
    background: #2a2a2a;
    border-left-color: #666;
}

.episode-item.active {
    background: #2563eb;
    border-left-color: #1d4ed8;
}

.episode-item-number {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 4px;
}

.episode-item.active .episode-item-number {
    color: #fff;
}

.episode-item-title {
    font-weight: 400;
    color: #ccc;
}

.episode-item.active .episode-item-title {
    color: #fff;
}

.episode-item-duration {
    font-size: 12px;
    color: #999;
    margin-top: 4px;
}

.episode-item.active .episode-item-duration {
    color: #e0e7ff;
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
    /* Mobile Menu Toggle */
    .mobile-menu-toggle {
        display: flex;
        order: 1;
    }

    /* Mobile Navigation */
    .main-nav {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        background: #1a1a1a;
        margin-top: 12px;
        border-radius: 8px;
        padding: 8px;
        gap: 4px;
        display: none;
        z-index: 1000;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    }

    .main-nav.active {
        display: flex;
    }

    .nav-link {
        width: 100%;
        text-align: left;
    }

    /* Logout button on mobile */
    .btn-logout {
        order: 3;
    }

    /* Header adjustments */
    .main-header {
        padding: 12px 16px;
    }

    /* Content tabs */
    .content-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab-btn {
        white-space: nowrap;
        padding: 10px 20px;
    }

    /* TV Show Hero Section - Mobile */
    .tvshow-hero {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 15px;
    }

    .tvshow-hero-poster {
        width: 150px;
        height: 225px;
    }

    .tvshow-hero-info h1 {
        font-size: 1.5rem;
    }

    .tvshow-hero-meta {
        justify-content: center;
    }

    /* Movie Hero Section - Mobile */
    .movie-hero {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 15px;
    }

    .movie-hero-poster {
        width: 150px;
        height: 225px;
    }

    .movie-hero-info h1 {
        font-size: 1.5rem;
    }

    .movie-hero-meta {
        justify-content: center;
    }

    /* TV Show layout */
    .tvshow-player-layout {
        flex-direction: column-reverse;
    }

    .episode-sidebar {
        width: 100%;
        max-width: 100%;
        max-height: 400px;
        position: static;
    }

    .player-main {
        width: 100%;
    }

    .tvshow-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .tvshow-poster {
        width: 160px;
        height: 240px;
    }

    .tvshow-meta {
        justify-content: center;
    }

    .episode-grid {
        grid-template-columns: 1fr;
    }

    .episode-navigation {
        flex-direction: column;
        gap: 10px;
    }

    .nav-btn {
        text-align: center;
    }

    .nav-btn-prev, .nav-btn-next {
        margin: 0;
    }

    .episode-sidebar {
        max-height: 300px;
    }

    .episode-title-main {
        font-size: 1.5rem;
    }

    .episode-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .control-btn {
        min-width: 90px;
        padding: 12px 20px;
        font-size: 16px;
    }

    .playback-controls {
        flex-wrap: wrap;
    }

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

/* Tablet responsive */
@media (max-width: 1024px) {
    .tvshow-player-layout {
        flex-direction: column-reverse;
    }

    .episode-sidebar {
        width: 100%;
        max-width: 100%;
        max-height: 400px;
        position: static;
    }

    .player-main {
        width: 100%;
    }
}
