/* ========================================
   SUPERFLIX - Netflix-style Streaming UI
   ======================================== */

:root {
    --bg-primary: #141414;
    --bg-secondary: #1f1f1f;
    --bg-card: #181818;
    --bg-hover: #252525;
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --text-muted: #808080;
    --accent-primary: #e50914;
    --accent-hover: #f40612;
    --accent-secondary: #ffffff;
    --gradient-dark: linear-gradient(to top, var(--bg-primary) 0%, transparent 100%);
    --gradient-left: linear-gradient(to right, var(--bg-primary) 0%, transparent 50%);
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.5);
    --shadow-modal: 0 8px 40px rgba(0, 0, 0, 0.8);
    --transition-fast: 0.15s ease;
    --transition-medium: 0.3s ease;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --header-height: 68px;
    --mobile-nav-height: 70px;
}

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
    min-height: 100vh;
}

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

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

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ========================================
   HEADER
   ======================================== */

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4%;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.9) 0%, transparent 100%);
    z-index: 1000;
    transition: background var(--transition-medium);
}

.header.scrolled {
    background: rgba(20, 20, 20, 0.98);
    backdrop-filter: blur(10px);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 40px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text-primary);
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--accent-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.5rem;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.nav-menu {
    display: flex;
    gap: 24px;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color var(--transition-fast);
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-primary);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-primary);
    border-radius: 1px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Search */
.search-container {
    display: flex;
    align-items: center;
}

.search-toggle {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition-fast);
}

.search-toggle:hover {
    transform: scale(1.1);
}

.search-box {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.75);
    border: 1px solid var(--text-secondary);
    border-radius: var(--radius-sm);
    overflow: hidden;
    width: 0;
    opacity: 0;
    transition: all var(--transition-medium);
}

.search-box.active {
    width: 280px;
    opacity: 1;
    margin-left: 10px;
}

.search-box input {
    background: none;
    border: none;
    color: var(--text-primary);
    padding: 10px 15px;
    font-size: 0.9rem;
    width: 100%;
    outline: none;
}

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

.search-clear {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px 12px;
    display: flex;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.search-box.has-value .search-clear {
    opacity: 1;
}

/* Mobile Navigation */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--mobile-nav-height);
    background: rgba(20, 20, 20, 0.98);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1000;
    padding: 0 10px;
}

.mobile-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.7rem;
    transition: color var(--transition-fast);
}

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

.mobile-nav-item svg {
    width: 22px;
    height: 22px;
}

/* ========================================
   HERO SECTION
   ======================================== */

.hero {
    position: relative;
    height: 85vh;
    min-height: 500px;
    max-height: 900px;
    display: flex;
    align-items: flex-end;
    padding: 0 4% 8%;
    overflow: hidden;
}

.hero-backdrop {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center top;
    transition: opacity 0.5s ease;
}

.hero-gradient {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(to top, var(--bg-primary) 0%, transparent 50%),
        linear-gradient(to right, rgba(20, 20, 20, 0.9) 0%, transparent 60%);
}

.hero-content {
    position: relative;
    z-index: 10;
    max-width: 600px;
}

.hero-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 16px;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.8);
}

.hero-description {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.8);
}

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn-primary {
    background: var(--text-primary);
    color: var(--bg-primary);
}

.btn-primary:hover {
    background: rgba(255, 255, 255, 0.85);
}

.btn-secondary {
    background: rgba(109, 109, 110, 0.7);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(109, 109, 110, 0.5);
}

.btn-large {
    padding: 16px 32px;
    font-size: 1.1rem;
}

.btn svg {
    width: 20px;
    height: 20px;
}

/* ========================================
   CONTENT SECTIONS
   ======================================== */

.content-container {
    position: relative;
    z-index: 10;
    margin-top: -150px;
    padding-bottom: 50px;
}

.content-row {
    margin-bottom: 40px;
    padding: 0 4%;
}

.section-title {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.content-slider {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding-bottom: 20px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.content-slider::-webkit-scrollbar {
    display: none;
}

/* Content Cards */
.content-card {
    flex: 0 0 auto;
    width: 200px;
    cursor: pointer;
    transition: transform var(--transition-medium), z-index 0s 0.3s;
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
}

.content-card:hover {
    transform: scale(1.08);
    z-index: 10;
    transition: transform var(--transition-medium), z-index 0s;
}

.card-poster {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.card-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 60px 12px 12px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, transparent 100%);
    opacity: 0;
    transform: translateY(10px);
    transition: all var(--transition-medium);
}

.content-card:hover .card-info {
    opacity: 1;
    transform: translateY(0);
}

.card-title {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.card-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all var(--transition-medium);
}

.content-card:hover .card-play {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.card-play svg {
    width: 24px;
    height: 24px;
    color: var(--bg-primary);
    margin-left: 3px;
}

/* Search Results Grid */
.search-results {
    padding: 100px 4% 50px;
}

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

.content-grid .content-card {
    width: 100%;
}

/* ========================================
   MODAL
   ======================================== */

.modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-medium);
    padding: 20px;
    overflow-y: auto;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    overflow-y: auto;
    box-shadow: var(--shadow-modal);
    transform: scale(0.95);
    transition: transform var(--transition-medium);
}

.modal.active .modal-content {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    background: var(--bg-primary);
    border: none;
    border-radius: 50%;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background var(--transition-fast);
}

.modal-close:hover {
    background: var(--bg-secondary);
}

.modal-backdrop {
    width: 100%;
    height: 400px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.modal-backdrop::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, var(--bg-card) 0%, transparent 50%);
}

.modal-body {
    padding: 0 40px 40px;
    margin-top: -100px;
    position: relative;
    z-index: 5;
}

.modal-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.modal-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.modal-meta .rating {
    color: #46d369;
    font-weight: 600;
}

.modal-description {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 24px;
}

.modal-actions {
    margin-bottom: 32px;
}

/* Episodes */
.episodes-container {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 24px;
}

.season-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.season-selector label {
    font-weight: 600;
}

.season-selector select {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    cursor: pointer;
}

.episodes-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
}

.episode-item {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.episode-item:hover {
    background: var(--bg-hover);
}

.episode-number {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.episode-info {
    flex: 1;
}

.episode-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.episode-duration {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ========================================
   PLAYER MODAL
   ======================================== */

.player-modal {
    position: fixed;
    inset: 0;
    z-index: 3000;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-medium);
}

.player-modal.active {
    opacity: 1;
    visibility: visible;
}

.player-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background var(--transition-fast);
}

.player-close:hover {
    background: rgba(0, 0, 0, 0.8);
}

.player-container {
    width: 100%;
    height: 100%;
}

.player-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* ========================================
   LOADING
   ======================================== */

.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 5000;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-medium);
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--bg-secondary);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-hover) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */

.toast-container {
    position: fixed;
    bottom: 100px;
    right: 20px;
    z-index: 4000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 16px 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease;
    max-width: 350px;
}

.toast.error {
    border-left: 4px solid var(--accent-primary);
}

.toast.success {
    border-left: 4px solid #46d369;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 1024px) {
    .content-card {
        width: 160px;
    }

    .hero {
        height: 70vh;
    }
}

@media (max-width: 768px) {
    .nav-menu {
        display: none;
    }

    .mobile-nav {
        display: flex;
    }

    body {
        padding-bottom: var(--mobile-nav-height);
    }

    .header {
        padding: 0 16px;
    }

    .hero {
        height: 60vh;
        padding: 0 16px 15%;
    }

    .hero-title {
        font-size: 1.8rem;
    }

    .hero-description {
        font-size: 0.95rem;
        -webkit-line-clamp: 2;
    }

    .content-container {
        margin-top: -80px;
    }

    .content-row {
        padding: 0 16px;
    }

    .content-card {
        width: 130px;
    }

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

    .modal-body {
        padding: 0 20px 20px;
    }

    .modal-title {
        font-size: 1.5rem;
    }

    .modal-backdrop {
        height: 250px;
    }

    .search-box.active {
        position: absolute;
        right: 16px;
        top: 100%;
        margin: 10px 0 0 0;
        width: calc(100vw - 32px);
    }

    .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    .toast-container {
        left: 20px;
        right: 20px;
        bottom: calc(var(--mobile-nav-height) + 20px);
    }

    .toast {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .content-card {
        width: 110px;
    }

    .logo-text {
        display: none;
    }

    .content-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 12px;
    }
}

/* ========================================
   FOOTER
   ======================================== */

.footer {
    background: var(--bg-secondary);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 30px 4%;
    margin-top: 40px;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.footer-warning {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.footer-warning svg {
    flex-shrink: 0;
    color: #f59e0b;
}

.footer-credits {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.footer-credits a {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition-fast);
}

.footer-credits a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

@media (max-width: 768px) {
    .footer {
        padding: 24px 16px;
        margin-bottom: var(--mobile-nav-height);
    }

    .footer-warning {
        font-size: 0.8rem;
        text-align: center;
    }

    .footer-credits {
        font-size: 0.85rem;
    }
}

/* ========================================
   UTILITIES
   ======================================== */

.hidden {
    display: none !important;
}

.no-scroll {
    overflow: hidden;
}
