/* =========================================
   MODERN STREAMING APP DESIGN
   Total Redesign - Netflix/Disney+ Style
   ========================================= */

:root {
    /* Primary Colors - Vibrant Pink/Red */
    --primary: #FF3366;
    --primary-dark: #DD1144;
    --primary-light: #FF6B9D;
    --primary-gradient: linear-gradient(135deg, #FF3366 0%, #FF6B9D 100%);

    /* Secondary */
    --secondary: #7C4DFF;
    --accent: #FFC107;

    /* Backgrounds - Dark Theme */
    --bg-main: #0F0F0F;
    --bg-card: #1C1C1E;
    --bg-modal: #FFFFFF;
    --bg-overlay: rgba(0, 0, 0, 0.85);
    --bg-nav: rgba(15, 15, 15, 0.95);

    /* Text */
    --text-light: #FFFFFF;
    --text-dark: #2C2C2E;
    --text-muted: #8E8E93;

    /* Borders */
    --border-color: #2C2C2E;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.6);

    /* Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 999px;

    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.2s ease;
}

/* === RESET & BASE === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg-main);
    color: var(--text-light);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* === SCROLLBAR === */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-main);
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: var(--radius-full);
}

/* === TOP NAVIGATION (MINIMAL) === */
.top-nav-minimal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--bg-nav);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
}

.top-nav-container {
    max-width: 1400px;
    margin: 0 auto;
    height: 100%;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo-brand {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--text-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.5px;
    margin: 0;
}

.logo-icon {
    color: var(--primary);
    font-size: 1.3rem;
}

.nav-right {
    display: flex;
    gap: 12px;
}

.btn-icon-nav {
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    color: var(--text-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.btn-icon-nav:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--primary);
}

/* === MAIN CONTENT === */
.main-content-new {
    padding-top: 60px;
    padding-bottom: 80px;
    min-height: 100vh;
}

/* === HERO SECTION === */
.hero-section {
    position: relative;
    height: 50vh;
    min-height: 400px;
    display: flex;
    align-items: flex-end;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    margin-bottom: 40px;
    overflow: hidden;
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 650px;
    padding: 0 20px 50px;
}

.hero-badge {
    display: inline-block;
    padding: 8px 16px;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hero-title {
    font-size: 3rem;
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: 16px;
    letter-spacing: -1px;
}

.hero-description {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 28px;
    line-height: 1.6;
}

.hero-actions {
    display: flex;
    gap: 12px;
}

.btn-primary-large {
    padding: 16px 36px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-full);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: var(--transition);
    box-shadow: 0 4px 16px rgba(255, 51, 102, 0.4);
}

.btn-primary-large:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255, 51, 102, 0.5);
}

.hero-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, var(--bg-main) 0%, transparent 50%);
    z-index: 1;
}

/* === CAROUSEL SECTIONS === */
.carousel-sections {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.section-title-bar {
    margin-bottom: 24px;
}

.section-title-bar h3 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

/* === DRAMA GRID (ENHANCED) === */
.drama-grid-carousel {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

/* === DRAMA CARD (TOTALLY NEW) === */
.drama-card {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-card);
}

.drama-card:hover {
    transform: translateY(-8px) scale(1.02);
    z-index: 10;
}

.card-image-container {
    aspect-ratio: 2/3;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
}

.card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.drama-card:hover .card-img {
    transform: scale(1.1);
}

/* Card Overlay (Shows on Hover) */
.drama-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.4) 40%, transparent 100%);
    opacity: 0;
    transition: var(--transition);
    pointer-events: none;
}

.drama-card:hover::after {
    opacity: 1;
}

/* === BADGES === */
.rating-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 800;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 5;
}

.progress-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--primary);
    color: white;
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 800;
    z-index: 5;
}

.card-content {
    padding: 12px;
    position: relative;
    z-index: 5;
}

.card-title {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    height: 40px;
}

.card-info {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* === BOTTOM NAVIGATION === */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: var(--bg-nav);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px 16px;
    transition: var(--transition);
    border-radius: var(--radius-md);
    min-width: 70px;
}

.bottom-nav-item i {
    width: 24px;
    height: 24px;
}

.bottom-nav-item span {
    font-size: 11px;
    font-weight: 600;
}

.bottom-nav-item.active {
    color: var(--primary);
}

.bottom-nav-item:hover {
    color: var(--text-light);
    background: rgba(255, 255, 255, 0.05);
}

/* === DETAIL MODAL (NEW) === */
.detail-modal-new {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 2000;
    overflow-y: auto;
}

.detail-modal-new.active {
    display: block;
}

.detail-modal-backdrop {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.detail-modal-container {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 60px auto 0;
    background: var(--bg-main);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    overflow: hidden;
    animation: slideUp 0.4s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(100px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.btn-close-detail {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    transition: var(--transition);
}

.btn-close-detail:hover {
    background: var(--primary);
    transform: rotate(90deg);
}

.detail-info-section {
    position: relative;
    padding: 32px;
}

.detail-flex-new {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 32px;
}

.detail-poster {
    width: 100%;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.detail-title-new {
    font-size: 2rem;
    font-weight: 900;
    line-height: 1.2;
    margin-bottom: 16px;
    letter-spacing: -0.5px;
}

.detail-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
}

.meta-item i {
    color: var(--accent);
    width: 16px;
}

.detail-synopsis-new {
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.7;
    margin-bottom: 24px;
}

.progress-banner {
    background: rgba(255, 51, 102, 0.1);
    border: 1px solid var(--primary);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    color: var(--primary);
    font-weight: 600;
    font-size: 14px;
}

.btn-finish {
    width: 100%;
    padding: 12px;
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid #4CAF50;
    color: #4CAF50;
    border-radius: var(--radius-md);
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 24px;
    transition: var(--transition);
}

.btn-finish:hover {
    background: #4CAF50;
    color: white;
}

.episode-section {
    margin-top: 24px;
}

.episode-header {
    font-size: 1.2rem;
    font-weight: 800;
    margin-bottom: 16px;
}

/* === VIDEO PLAYER === */
.player-container {
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    position: relative;
    overflow: hidden;
    user-select: none;
}

.player-container.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100vh;
    /* Fallback */
    height: 100dvh;
    /* Dynamic */
    height: 100svh;
    /* Small viewport - aligns above address bar */
    z-index: 5000;
    border-radius: 0;
    aspect-ratio: auto;
    background: black;
}

#video-element {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.player-overlay-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    z-index: 15;
    pointer-events: none;
    transition: opacity 0.3s;
}

.play-ring-center {
    width: 70px;
    height: 70px;
    background: var(--primary-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin-bottom: 12px;
    box-shadow: 0 8px 24px rgba(255, 51, 102, 0.6);
    animation: pulse 2s ease-in-out infinite;
    pointer-events: auto;
    cursor: pointer;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.player-status-text {
    font-size: 14px;
    font-weight: 700;
    color: white;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* === CONTROLS === */
.custom-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.7) 50%, transparent 100%);
    padding: 40px 24px calc(20px + env(safe-area-inset-bottom)) 24px;
    z-index: 20;
    opacity: 1;
    transition: opacity 0.3s;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.player-container.playing:not(.show-ui) .custom-controls,
.player-container.playing:not(.show-ui) .player-overlay-center {
    opacity: 0;
    pointer-events: none;
}

.progress-bar-container {
    width: 100%;
    height: 5px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-full);
    cursor: pointer;
    position: relative;
    transition: height 0.2s;
}

.progress-bar-container:hover {
    height: 8px;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    border-radius: var(--radius-full);
    position: relative;
    box-shadow: 0 0 10px var(--primary);
}

.progress-fill::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s;
}

.progress-bar-container:hover .progress-fill::after {
    opacity: 1;
}

.controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.controls-group {
    display: flex;
    align-items: center;
    gap: 16px;
}

.control-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: var(--transition);
}

.control-btn:hover {
    color: var(--primary);
    transform: scale(1.1);
}

.control-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.control-btn:disabled:hover {
    color: white;
    transform: scale(1);
}

.control-btn.btn-text {
    padding: 10px 18px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    font-weight: 700;
    font-size: 13px;
    gap: 8px;
}

.control-btn.btn-text:hover {
    background: var(--primary);
}

.time-text {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

/* === EPISODE GRID === */
.ep-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 12px;
}

.ep-btn {
    aspect-ratio: 1/1;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-light);
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    font-size: 16px;
    position: relative;
}

.ep-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
}

.ep-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.check-mark {
    position: absolute;
    top: 4px;
    right: 4px;
    color: #4CAF50;
    background: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: none;
    align-items: center;
    justify-content: center;
}

.ep-btn.watched .check-mark {
    display: flex;
}

/* === EPISODE POPUP === */
.ep-popup {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    z-index: 100;
    display: none;
    align-items: flex-end;
}

.ep-popup-content {
    width: 100%;
    max-height: 80%;
    background: var(--bg-modal);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: 28px 20px calc(50px + env(safe-area-inset-bottom)) 20px;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.3s;
}

.ep-popup.active {
    display: flex;
}

.ep-popup.active .ep-popup-content {
    transform: translateY(0);
}

/* === SEARCH MODAL (NEW) === */
.search-modal-new {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 3000;
    animation: fadeIn 0.2s ease;
}

.search-modal-new.active {
    display: block;
}

.search-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.search-modal-content-new {
    position: relative;
    max-width: 700px;
    margin: 80px auto 0;
    padding: 0 20px;
    z-index: 3001;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

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

.search-header-new h2 {
    font-size: 1.8rem;
    font-weight: 900;
    color: white;
}

.btn-icon-close {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-icon-close:hover {
    background: var(--primary);
    transform: rotate(90deg);
}

.search-form-new {
    margin-bottom: 32px;
}

.search-input-group {
    position: relative;
}

.search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 24px;
}

.search-input-group input {
    width: 100%;
    padding: 18px 60px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-xl);
    color: white;
    font-size: 1.1rem;
    font-weight: 500;
    transition: var(--transition);
}

.search-input-group input::placeholder {
    color: var(--text-muted);
}

.search-input-group input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 0 4px rgba(255, 51, 102, 0.2);
}

.search-history-new {
    margin-top: 24px;
}

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

.history-header span {
    font-size: 13px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-text-sm {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.btn-text-sm:hover {
    background: rgba(255, 51, 102, 0.1);
}

.history-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.history-item {
    padding: 10px 18px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-full);
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-item:hover {
    background: var(--primary);
    border-color: var(--primary);
}

/* === LOADER === */
.loader-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-main);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9000;
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loader-text {
    margin-top: 20px;
    color: var(--primary);
    font-weight: 900;
    letter-spacing: 3px;
    font-size: 11px;
    text-transform: uppercase;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }

    .hero-section {
        height: 40vh;
        min-height: 300px;
    }

    .drama-grid-carousel {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }

    .detail-flex-new {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .detail-poster {
        max-width: 200px;
        margin: 0 auto;
    }

    .detail-title-new {
        font-size: 1.5rem;
        text-align: center;
    }

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

    .bottom-nav-item span {
        display: none;
    }

    .bottom-nav {
        height: 60px;
    }

    /* Mobile Video Player Safe Area */
    .player-container.fullscreen .custom-controls {
        padding-bottom: calc(24px + env(safe-area-inset-bottom));
    }

    .control-btn {
        min-width: 44px;
        min-height: 44px;
    }
}

@media (max-width: 480px) {
    .drama-grid-carousel {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .section-title-bar h3 {
        font-size: 1.2rem;
    }
}

/* === UTILITIES === */
::selection {
    background: var(--primary);
    color: white;
}

button:focus-visible,
input:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}