:root {
    --bg-color: #141414;
    --bg-secondary: #000000;
    --primary-color: #e50914;
    --primary-hover: #b20710;
    --text-color: #ffffff;
    --text-muted: #b3b3b3;
    --card-hover-scale: 1.15;
    --transition-speed: 0.4s;
    --sidebar-width: 80px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow-x: hidden;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* Utility Classes */
.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.hidden {
    display: none !important;
}

/* App Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Login Screen */
.login-container {
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at top right, #1a1a1a 0%, #000000 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* Abstract Background Shapes */
.login-container::before {
    content: '';
    position: absolute;
    top: -10%;
    right: -10%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, rgba(229, 9, 20, 0.15) 0%, transparent 70%);
    border-radius: 50%;
    filter: blur(60px);
    z-index: 0;
}

.login-container::after {
    content: '';
    position: absolute;
    bottom: -10%;
    left: -10%;
    width: 40vw;
    height: 40vw;
    background: radial-gradient(circle, rgba(20, 20, 100, 0.15) 0%, transparent 70%);
    border-radius: 50%;
    filter: blur(60px);
    z-index: 0;
}

.login-box {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 50px 40px;
    border-radius: 16px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    z-index: 1;
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 2rem;
    color: #fff;
    text-align: center;
    letter-spacing: -0.5px;
}

.form-group {
    margin-bottom: 20px;
    position: relative;
}

.form-input {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    height: 55px;
    /* Taller inputs */
    line-height: 55px;
    padding: 0 20px;
    width: 100%;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-input:focus {
    background: rgba(0, 0, 0, 0.5);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(229, 9, 20, 0.15);
    outline: none;
}

.form-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.btn-primary {
    background: linear-gradient(45deg, var(--primary-color) 0%, #b20710 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    margin-top: 20px;
    padding: 16px;
    width: 100%;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(229, 9, 20, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(229, 9, 20, 0.5);
}

.btn-primary:active {
    transform: translateY(0);
}

.login-brand {
    text-align: center;
    margin-bottom: 30px;
    font-size: 3rem;
    font-weight: 900;
    color: var(--primary-color);
    letter-spacing: -2px;
}

.btn-primary:hover {
    background-color: #f40612;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background-color: black;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 20px;
    border-right: 1px solid #333;
    transition: width var(--transition-speed);
}

.sidebar-item {
    color: var(--text-muted);
    font-size: 24px;
    margin-bottom: 30px;
    cursor: pointer;
    transition: color 0.2s;
    position: relative;
    width: 100%;
    text-align: center;
    padding: 10px 0;
}

.sidebar-item:hover,
.sidebar-item.active {
    color: white;
}

.sidebar-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background-color: var(--primary-color);
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    padding: 20px 40px;
}

.section-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 15px;
    margin-top: 30px;
    color: #e5e5e5;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

/* HERO SECTION */
/* HERO SECTION - NETFLIX STYLE */
.hero-container {
    height: 50vh;
    /* Reduced to 50vh per 'very big' feedback */
    position: relative;
    margin-bottom: 20px;
    /* Changed from -40px to 20px to fix button overlap */
    display: flex;
    align-items: center;
    overflow: hidden;
}

.hero-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.hero-backdrop img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    /* Focus on top where faces usually are */
    mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
}

.hero-gradient {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(77deg, rgba(0, 0, 0, .6) 0, rgba(0, 0, 0, 0) 85%),
        linear-gradient(to top, #141414 0, rgba(20, 20, 20, 0) 40%);
}

.hero-overlay-left {
    position: absolute;
    inset: 0;
    background: linear-gradient(to right, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.4) 40%, transparent 100%);
}

.hero-content {
    position: relative;
    z-index: 10;
    padding-left: 60px;
    max-width: 650px;
    margin-top: 100px;
    opacity: 0;
    animation: fadeUp 0.8s ease-out forwards 0.5s;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-title {
    font-size: 3rem;
    /* Reduced from 4rem to fit 50vh */
    font-weight: 800;
    margin-bottom: 15px;
    /* Reduced margin */
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    line-height: 1.1;
}

.hero-overview {
    font-size: 1.1rem;
    /* Slightly reduced */
    color: #fff;
    margin-bottom: 20px;
    /* Reduced from 30px */
    line-height: 1.4;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-width: 600px;
}

.hero-buttons {
    display: flex;
    gap: 15px;
}

.btn-hero {
    border: none;
    padding: 12px 30px;
    border-radius: 4px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s ease;
}

.btn-hero-play {
    background: #fff;
    color: #000;
}

.btn-hero-play:hover {
    background: rgba(255, 255, 255, 0.75);
}

.btn-hero-info {
    background: rgba(109, 109, 110, 0.7);
    color: #fff;
}

.btn-hero-info:hover {
    background: rgba(109, 109, 110, 0.4);
}

/* CAROUSEL ROWS - NETFLIX STYLE */
.dashboard-rows {
    position: relative;
    z-index: 20;
    padding-bottom: 50px;
}

.media-row-container {
    margin-bottom: 40px;
    padding-left: 60px;
    position: relative;
}

.row-header {
    font-size: 1.4rem;
    font-weight: 600;
    color: #e5e5e5;
    margin-bottom: 15px;
    transition: color 0.2s;
}

.row-header:hover {
    color: #fff;
}

/* Main Carousel Container */
.media-carousel,
.media-grid-horizontal {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 20px 0 40px 0;
    /* Extra bottom padding for hover scale */
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    margin-left: -5px;
    /* Alignment tweaks */
}

.media-carousel::-webkit-scrollbar,
.media-grid-horizontal::-webkit-scrollbar {
    display: none;
}

.btn-play,
.btn-info {
    border: none;
    padding: 12px 35px;
    /* Larger buttons */
    border-radius: 4px;
    font-size: 1.3rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
}

.btn-play {
    background: #fff;
    color: #000;
}

.btn-play:hover {
    background: rgba(255, 255, 255, 0.75);
    transform: scale(1.05);
}

.btn-info {
    background: rgba(109, 109, 110, 0.7);
    color: #fff;
}

.btn-info:hover {
    background: rgba(109, 109, 110, 0.4);
    transform: scale(1.05);
}

/* CARD ITEM */
.media-card {
    flex: 0 0 auto;
    width: 200px;
    /* Base width */
    aspect-ratio: 2/3;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.19, 1, 0.22, 1), box-shadow 0.3s;
    background: #2f2f2f;
}

.media-card:hover {
    transform: scale(var(--card-hover-scale));
    z-index: 100;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.9);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

/* Adjust siblings on hover to focus (optional, complex) */
/* Instead, rely on z-index */

.media-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

/* Info overlay on card */
.media-info {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, transparent 60%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 15px;
    opacity: 0;
    transition: opacity 0.3s;
}

.media-card:hover .media-info {
    opacity: 1;
}

.media-title {
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    text-align: center;
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.8);
    transform: translateY(10px);
    transition: transform 0.3s ease;
}

.media-card:hover .media-title {
    transform: translateY(0);
}


/* Player Overlays */
.player-overlay-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    text-align: center;
    z-index: 2000;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.spinner {
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top: 5px solid #fff;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px auto;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.btn-retry {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    margin-top: 10px;
}

.btn-retry:hover {
    background: #c0392b;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-content {
    background: #1f1f1f;
    padding: 30px;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    color: white;
}

/* ========================================
   CUSTOM VIDEO PLAYER CONTROLS
   ======================================== */

.custom-player-container {
    position: relative;
    width: 100%;
    height: 100%;
    background: #000;
    cursor: default;
}

.custom-player-container video {
    width: 100%;
    height: 100%;
    display: block;
}

/* Custom Controls */
.custom-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.7) 70%, transparent 100%);
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.custom-player-container:hover .custom-controls,
.custom-controls.show {
    opacity: 1;
}

/* Progress Bar */
.progress-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    cursor: pointer;
    margin-bottom: 15px;
    position: relative;
    transition: height 0.2s;
}

.progress-container:hover {
    height: 8px;
}

.progress-bar {
    height: 100%;
    background: var(--primary-color);
    border-radius: 3px;
    position: relative;
    transition: width 0.1s linear;
}

.progress-bar::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background: var(--primary-color);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s;
}

.progress-container:hover .progress-bar::after {
    opacity: 1;
}

/* Buffer Bar */
.buffer-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 3px;
    transition: width 0.3s;
}

/* Controls Row */
.controls-row {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Control Buttons */
.control-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    transition: transform 0.2s, color 0.2s;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.control-btn:hover {
    transform: scale(1.15);
    color: var(--primary-color);
}

.control-btn:active {
    transform: scale(1.05);
}

/* Time Display */
.time-display {
    color: white;
    font-size: 14px;
    font-weight: 500;
    min-width: 110px;
    user-select: none;
}

/* Volume Control */
.volume-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.volume-slider {
    width: 80px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
    transition: height 0.2s;
}

.volume-slider:hover {
    height: 6px;
}

.volume-level {
    height: 100%;
    background: white;
    border-radius: 2px;
    transition: width 0.1s;
    position: relative;
}

.volume-level::after {
    content: '';
    position: absolute;
    right: -4px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s;
}

.volume-slider:hover .volume-level::after {
    opacity: 1;
}

/* Spacer */
.controls-spacer {
    flex: 1;
}

/* Loading Spinner for Player */
.player-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
    pointer-events: none;
}

.player-loading .spinner {
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top: 4px solid var(--primary-color);
    width: 60px;
    height: 60px;
}

/* Center Play Button */
.center-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    border: 3px solid white;
    border-radius: 50%;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    z-index: 5;
    opacity: 0;
    pointer-events: none;
}

.center-play-btn.show {
    opacity: 1;
    pointer-events: all;
}

.center-play-btn:hover {
    transform: translate(-50%, -50%) scale(1.1);
    background: rgba(229, 9, 20, 0.9);
    border-color: var(--primary-color);
}

.center-play-btn i {
    color: white;
    font-size: 32px;
    margin-left: 4px;
}

/* Fullscreen adjustments */
.custom-player-container:fullscreen {
    background: #000;
}

.custom-player-container:fullscreen .custom-controls {
    padding: 30px;
}

/* Hide native controls */
.custom-player-container video::-webkit-media-controls {
    display: none !important;
}

.custom-player-container video::-webkit-media-controls-enclosure {
    display: none !important;
}

/* Live Dashboard Layout */
.live-dashboard {
    display: flex;
    height: calc(100vh - 40px);
    gap: 20px;
}

.live-sidebar {
    width: 280px;
    background: var(--bg-secondary);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #333;
}

.live-sidebar-header {
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid #333;
    font-weight: 600;
}

.live-category-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.live-category-item {
    padding: 12px 15px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    margin-bottom: 5px;
    color: var(--text-muted);
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.live-category-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.live-category-item.active {
    background: var(--primary-color);
    color: white;
}

.live-main {
    flex: 1;
    display: flex;
    flex-direction: row;
    /* Colunas: Player + Canais */
    height: 100%;
    overflow: hidden;
    padding: 0;
    gap: 15px;
}

.live-player-section {
    flex: 2;
    /* Player ocupa mais espaço no centro */
    display: flex;
    flex-direction: column;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid #333;
    height: 100%;
    max-height: 100%;
}

.live-player-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #1a1a1a;
    color: var(--text-muted);
}

.live-player-placeholder i {
    font-size: 50px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.live-channels-section {
    flex: 0 0 320px;
    /* Largura fixa para a lista da direita */
    height: 100%;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    padding: 15px;
    border: 1px solid #333;
}

.live-channels-grid {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.live-channel-list-item {
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
    color: #ccc;
    border-left: 3px solid transparent;
}

.live-channel-list-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

.live-channel-list-item.active {
    background: rgba(229, 9, 20, 0.15);
    color: white;
    border-left-color: var(--primary-color);
}

.channel-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* EPG Styles */
.live-player-container-wrapper {
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
}

.live-epg-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #111;
    border-top: 1px solid #333;
    overflow: hidden;
}

.epg-header {
    padding: 12px 20px;
    background: #1a1a1a;
    font-size: 14px;
    font-weight: 600;
    color: #eee;
    border-bottom: 1px solid #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

.epg-header i {
    color: var(--primary-color);
}

.epg-content {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

.epg-item {
    display: flex;
    padding: 12px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    gap: 20px;
}

.epg-item:last-child {
    border-bottom: none;
}

.epg-time {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary-color);
    min-width: 60px;
    padding-top: 2px;
}

.epg-info {
    flex: 1;
}

.epg-title {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 4px;
}

.epg-desc {
    font-size: 12px;
    color: #999;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.epg-empty,
.epg-loading {
    padding: 40px;
    text-align: center;
    color: #666;
    font-size: 14px;
}

/* Ajuste para o player inline */
.player-inline-container {
    width: 100%;
    height: 100%;
    position: relative;
}

.player-title-inline {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 15px;
    padding-top: 40px;
    /* Espaço para o botão de fechar se fosse o caso, mas aqui é para o título */
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), transparent);
    z-index: 10;
    font-weight: 600;
    pointer-events: none;
}

/* Movie Details Modal */
.movie-details-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.movie-details-modal {
    background: #181818;
    width: 100%;
    max-width: 1000px;
    max-height: 90vh;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    animation: modalSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--primary-color);
    transform: rotate(90deg);
}

.modal-body {
    display: flex;
    height: 100%;
    overflow-y: auto;
}

.modal-poster {
    flex: 0 0 350px;
    background: #000;
}

.modal-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-info-content {
    flex: 1;
    padding: 40px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.modal-title {
    font-size: 36px;
    font-weight: 800;
    margin: 0;
    color: white;
    line-height: 1.2;
}

.modal-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.meta-tag {
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    color: #ccc;
}

.meta-tag.rating {
    color: #ffc107;
    background: rgba(255, 193, 7, 0.1);
}

.modal-plot h3,
.modal-cast h3,
.modal-director h3 {
    font-size: 16px;
    color: #888;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.modal-plot p,
.modal-cast p,
.modal-director p {
    font-size: 16px;
    color: #eee;
    line-height: 1.6;
}

.modal-actions {
    margin-top: auto;
    padding-top: 20px;
}

.btn-watch-now {
    padding: 15px 40px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s;
}

.btn-watch-now:hover {
    background: #c00;
    transform: scale(1.05);
    box-shadow: 0 10px 20px rgba(229, 9, 20, 0.3);
}

.btn-trailer {
    background: rgba(109, 109, 110, 0.4);
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 4px;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    backdrop-filter: blur(5px);
}

.btn-trailer:hover {
    background: rgba(109, 109, 110, 0.7);
    transform: scale(1.05);
}

/* Movie Cards Refined */
.category-card-content {
    height: 100%;
    background: linear-gradient(45deg, #222, #333);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 20px;
    text-align: center;
    border-radius: 8px;
}

.category-card-content i {
    font-size: 40px;
    color: var(--primary-color);
}

.category-card-content span {
    font-size: 16px;
    font-weight: 600;
}

.btn-back {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 20px;
    transition: all 0.2s;
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.2);
}

.placeholder-poster {
    height: 100%;
    background: #222;
    display: flex;
    align-items: center;
    justify-content: center;
}

.placeholder-poster i {
    font-size: 50px;
    color: #444;
}

/* Loading Spinner */
.loading-spinner-container {
    display: flex;
    justify-content: center;
    padding: 50px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive Modal */
@media (max-width: 768px) {
    .modal-body {
        flex-direction: column;
    }

    .modal-poster {
        flex: 0 0 300px;
    }

    .modal-info-content {
        padding: 25px;
    }

    .modal-title {
        font-size: 24px;
    }
}

/* Series Modal Specifics */
.series-modal {
    max-width: 1100px;
    height: 85vh;
}

.series-modal-body {
    padding: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
    /* Ensure body takes full modal height */
    overflow: hidden;
    /* Prevent body scroll, handle inside sections */
}

.series-header-info {
    display: flex;
    padding: 30px;
    background: linear-gradient(to bottom, rgba(24, 24, 24, 0.5), #181818);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
    /* Prevent header from shrinking */
    max-height: 40%;
    /* Limit header height so episodes always have space */
    overflow-y: auto;
    /* Allow scrolling inside header if content is huge */
}

.series-episodes-section {
    flex: 1;
    /* Take remaining space */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Container doesn't scroll */
    padding: 20px 30px;
    min-height: 0;
    /* Critical for flex scrolling */
}

.season-selector {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 15px;
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
    /* Keep season selector fixed size */
}

.season-tab {
    padding: 10px 25px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: #888;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.2s;
}

.season-tab:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.season-tab.active {
    background: var(--primary-color);
    color: white;
}

.episodes-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.episode-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.episode-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(10px);
}

.episode-number {
    font-size: 20px;
    font-weight: 800;
    color: #444;
    width: 40px;
}

.episode-details {
    flex: 0 1 auto;
    /* Don't grow indefinitely */
    min-width: 0;
    /* Allow text truncation */
    margin-right: 10px;
}

.episode-name {
    font-size: 16px;
    font-weight: 600;
    color: #eee;
}

.episode-meta {
    font-size: 12px;
    color: #666;
    margin-top: 2px;
}

.episode-play-icon {
    font-size: 24px;
    color: var(--primary-color);
    opacity: 0;
    transition: opacity 0.2s;
    margin-left: auto;
    /* Push to the right end */
}

.episode-item:hover .episode-play-icon {
    opacity: 1;
}

/* Global Player Overlay Fix */
.player-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #000;
    z-index: 2200 !important;
    /* Higher than modal (2000) */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Series Responsive */
@media (max-width: 768px) {
    .series-header-info {
        flex-direction: column;
        padding: 20px;
    }

    .series-header-info .modal-poster {
        flex: 0 0 200px;
        margin-bottom: 20px;
    }

    .series-header-info .modal-info-content {
        padding: 0;
    }

    .series-episodes-section {
        padding: 15px;
    }
}

/* Profile Screen Styles */
.profile-screen-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #141414;
    animation: fadeIn 0.5s ease;
}

.profile-title {
    font-size: 3.5rem;
    font-weight: 500;
    color: #fff;
    margin-bottom: 50px;
    text-align: center;
    letter-spacing: 1px;
}

.profile-grid-container {
    display: flex;
    gap: 2vw;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 80%;
}

.profile-card-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    width: 10vw;
    min-width: 120px;
    max-width: 200px;
}

.profile-card-group:hover {
    color: white;
}

.profile-avatar-wrapper {
    width: 100%;
    aspect-ratio: 1/1;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 20px;
    border: 3px solid transparent;
    transition: all 0.2s ease;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    background: #333;
}

.profile-card-group:hover .profile-avatar-wrapper {
    border-color: #e5e5e5;
    transform: scale(1.05);
    /* Netflix-like minimal zoom */
}

.profile-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-name {
    color: #808080;
    font-size: 1.3rem;
    text-align: center;
    transition: color 0.2s ease;
    font-weight: 400;
}

.profile-card-group:hover .profile-name {
    color: #e5e5e5;
    font-weight: 600;
}

/* Add Profile Button Specifics */
.add-profile-icon {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #141414;
    /* Match bg to look transparent/integrated */
    color: #808080;
    font-size: 5vw;
}

.profile-card-group:hover .add-profile-icon {
    background: #e5e5e5;
    color: #141414;
}

/* Profile Modal (Reusing/Extending Modal) */
.profile-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.profile-modal-content {
    background: #141414;
    padding: 40px 60px;
    border-radius: 4px;
    /* Netflix uses cleaner, sharper corners usually, but 4px is safe */
    width: 100%;
    max-width: 500px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
    border: 1px solid #333;
}

.profile-modal-title {
    font-size: 2rem;
    color: #fff;
    margin-bottom: 20px;
    font-weight: 500;
}

.profile-form-group {
    margin-bottom: 30px;
}

.profile-form-label {
    display: block;
    color: #808080;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.profile-input-row {
    display: flex;
    align-items: center;
    gap: 20px;
}

.profile-input-avatar {
    width: 60px;
    height: 60px;
    border-radius: 4px;
}

.profile-text-input {
    flex: 1;
    background: #333;
    border: none;
    color: #fff;
    height: 40px;
    padding: 0 15px;
    font-size: 1rem;
    outline: none;
}

.profile-text-input:focus {
    background: #444;
}

.profile-modal-actions {
    display: flex;
    gap: 15px;
}

.btn-profile-save {
    background: #fff;
    color: #141414;
    border: 1px solid #fff;
    font-weight: 700;
    padding: 10px 30px;
    cursor: pointer;
    font-size: 1rem;
    letter-spacing: 1px;
}

.btn-profile-save:hover {
    background: #c00;
    padding: 0;
}

.series-episodes-section {
    padding: 15px;
}

/* Profile Screen Styles */
.profile-screen-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #141414;
    animation: fadeIn 0.5s ease;
}

.profile-title {
    font-size: 3.5rem;
    font-weight: 500;
    color: #fff;
    margin-bottom: 50px;
    text-align: center;
    letter-spacing: 1px;
}

.profile-grid-container {
    display: flex;
    gap: 2vw;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 80%;
}

.profile-card-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    width: 10vw;
    min-width: 120px;
    max-width: 200px;
}

.profile-card-group:hover {
    color: white;
}

.profile-avatar-wrapper {
    width: 100%;
    aspect-ratio: 1/1;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 20px;
    border: 3px solid transparent;
    transition: all 0.2s ease;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    background: #333;
}

.profile-card-group:hover .profile-avatar-wrapper {
    border-color: #e5e5e5;
    transform: scale(1.05);
    /* Netflix-like minimal zoom */
}

.profile-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-name {
    color: #808080;
    font-size: 1.3rem;
    text-align: center;
    transition: color 0.2s ease;
    font-weight: 400;
}

.profile-card-group:hover .profile-name {
    color: #e5e5e5;
    font-weight: 600;
}

/* Add Profile Button Specifics */
.add-profile-icon {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #141414;
    /* Match bg to look transparent/integrated */
    color: #808080;
    font-size: 5vw;
}

.profile-card-group:hover .add-profile-icon {
    background: #e5e5e5;
    color: #141414;
}

/* Profile Modal (Reusing/Extending Modal) */
.profile-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.profile-modal-content {
    background: #141414;
    padding: 40px 60px;
    border-radius: 4px;
    /* Netflix uses cleaner, sharper corners usually, but 4px is safe */
    width: 100%;
    max-width: 500px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
    border: 1px solid #333;
}

.profile-modal-title {
    font-size: 2rem;
    color: #fff;
    margin-bottom: 20px;
    font-weight: 500;
}

.profile-form-group {
    margin-bottom: 30px;
}

.profile-form-label {
    display: block;
    color: #808080;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.profile-input-row {
    display: flex;
    align-items: center;
    gap: 20px;
}

.profile-input-avatar {
    width: 60px;
    height: 60px;
    border-radius: 4px;
}

.profile-text-input {
    flex: 1;
    background: #333;
    border: none;
    color: #fff;
    height: 40px;
    padding: 0 15px;
    font-size: 1rem;
    outline: none;
}

.profile-text-input:focus {
    background: #444;
}

.profile-modal-actions {
    display: flex;
    gap: 15px;
}

.btn-profile-save {
    background: #fff;
    color: #141414;
    border: 1px solid #fff;
    font-weight: 700;
    padding: 10px 30px;
    cursor: pointer;
    font-size: 1rem;
    letter-spacing: 1px;
}

.btn-profile-save:hover {
    background: #c00;
    color: #fff;
    border-color: #c00;
}

.btn-profile-cancel {
    background: transparent;
    color: #808080;
    border: 1px solid #808080;
    font-weight: 700;
    padding: 10px 30px;
    cursor: pointer;
    font-size: 1rem;
    letter-spacing: 1px;
}

.btn-profile-cancel:hover {
    color: #fff;
    border-color: #fff;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {

    /* Sidebar transforms to Bottom Navigation */
    .sidebar {
        width: 100% !important;
        height: 60px;
        flex-direction: row;
        justify-content: space-around;
        top: auto;
        bottom: 0;
        border-right: none;
        border-top: 1px solid #333;
        padding-top: 0;
        align-items: center;
        background: rgba(0, 0, 0, 0.95);
        backdrop-filter: blur(10px);
    }

    .sidebar-item {
        margin-bottom: 0;
        font-size: 1.2rem;
        padding: 10px;
    }

    /* Sidebar Item - Hide Logout on Mobile */
    .sidebar-item.logout-btn {
        display: none !important;
    }

    /* Profile Page - Show Logout Button */
    .btn-profile-logout {
        display: block !important;
    }

    /* Maximize content space */
    .app-container {
        padding: 0;
    }

    .live-dashboard,
    .series-view-container,
    .movie-view-container {
        height: calc(100vh - 60px);
        /* Full height minus bottom nav */
        padding-bottom: 60px;
    }

    /* Adjust Main Content to not be hidden behind bottom nav */
    .content {
        margin-left: 0 !important;
        padding-bottom: 70px;
        /* Space for bottom nav */
        width: 100%;
        padding-left: 5px;
        padding-right: 5px;
    }

    /* Hero Section */
    .hero-content h1 {
        font-size: 2rem;
    }

    .hero-overview {
        font-size: 0.9rem;
        max-width: 100%;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    /* Grids */
    .media-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px;
        padding: 0 10px;
    }

    .media-card {
        aspect-ratio: 2/3;
    }

    /* Profile Page Mobile */
    .profile-title {
        font-size: 2rem;
        margin-bottom: 30px;
    }

    .profile-grid-container {
        gap: 20px;
        width: 100%;
    }

    .profile-card-group {
        width: 40%;
        /* 2 per row */
        max-width: 150px;
    }

    .profile-name {
        font-size: 1rem;
    }

    /* Modals */
    .profile-modal-content {
        width: 90%;
        padding: 20px;
    }

    .profile-modal-title {
        font-size: 1.5rem;
    }

    /* Player Controls */
    .vjs-control-bar {
        font-size: 0.8rem;
    }
}

/* Skeleton Loading Animation */
.modal-skeleton {
    width: 100%;
    margin-top: 20px;
    animation: fadeIn 0.3s ease;
}

.skeleton-line {
    height: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    margin-bottom: 10px;
    position: relative;
    overflow: hidden;
}

.skeleton-line::after {
    content: "";
    display: block;
    position: absolute;
    left: -150px;
    top: 0;
    height: 100%;
    width: 150px;
    background: linear-gradient(to right, transparent 0%, rgba(255, 255, 255, 0.1) 50%, transparent 100%);
    animation: load 1.5s cubic-bezier(0.4, 0.0, 0.2, 1) infinite;
}

@keyframes load {
    from {
        left: -150px;
    }

    to {
        left: 100%;
    }
}

/* Custom Player Close Button (Top Right) */
.player-close {
    position: absolute;
    top: 40px;
    right: 40px;
    left: auto;
    /* Force override */
    z-index: 9999;
    color: white;
    font-size: 35px;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.player-close:hover {
    background: rgba(229, 9, 20, 0.9);
    /* Netflix Red */
    transform: scale(1.1);
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(229, 9, 20, 0.5);
}

/* Resume Prompt Overlay */
.resume-prompt-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.resume-card {
    background: rgba(30, 30, 30, 0.9);
    padding: 40px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    max-width: 500px;
    width: 90%;
}

.resume-card h3 {
    font-size: 2rem;
    margin-bottom: 10px;
    color: #fff;
}

.resume-card p {
    color: #ccc;
    font-size: 1.2rem;
    margin-bottom: 30px;
}

.resume-actions {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.btn-resume {
    background: #e50914;
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 1.1rem;
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: transform 0.2s;
}

.btn-resume:hover {
    transform: scale(1.05);
    background: #f40b17;
}

.btn-restart {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 12px 30px;
    font-size: 1.1rem;
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
}

.btn-restart:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: #fff;
}

/* Episode Progress Bar (Inline) */
.episode-progress-inline {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: 20px;
    margin-left: 10px;
    flex: 1;
    /* Take all remaining space */
}

.episode-progress-track {
    width: 100%;
    /* Fill container */
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
}

.episode-progress-fill {
    height: 100%;
    background: #e50914;
    /* Netflix Red */
    box-shadow: 0 0 5px rgba(229, 9, 20, 0.7);
}

.progress-text {
    font-size: 12px;
    color: #aaa;
    font-weight: 500;
    min-width: 30px;
}