/* Video Stream - Netflix Style Dark Theme */
@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Roboto:wght@300;400;500;700&display=swap');

:root {
    --bg-primary: #141414;
    --bg-secondary: #1f1f1f;
    --bg-card: #181818;
    --bg-hover: #252525;
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --accent: #e50914;
    --accent-hover: #f40612;
    --accent-dark: #831010;
    --success: #46d369;
    --border: #333333;
    --shadow: rgba(0, 0, 0, 0.75);
}

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

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

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

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

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

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

/* Header */
.header {
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.7) 10%, transparent);
    padding: 0 4%;
    height: 68px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.4s ease;
}

.header.scrolled {
    background: rgb(20, 20, 20);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 2.5rem;
}

.logo {
    text-decoration: none;
}

.header h1 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 2rem;
    color: var(--accent);
    letter-spacing: 4px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    margin: 0;
}

/* Navigation */
.nav-links {
    display: flex;
    gap: 1.25rem;
}

.nav-link {
    color: #e5e5e5;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 400;
    transition: color 0.3s;
}

.nav-link:hover {
    color: #b3b3b3;
}

.nav-link.active {
    color: #fff;
    font-weight: 500;
}

/* Header Right */
.header-right {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

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

.search-toggle {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem;
    transition: transform 0.2s;
}

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

.search-input {
    width: 0;
    padding: 0.5rem 0;
    background: rgba(0, 0, 0, 0.75);
    border: 1px solid #fff;
    border-radius: 0;
    color: #fff;
    font-size: 0.875rem;
    opacity: 0;
    transition: all 0.3s ease;
    position: absolute;
    right: 100%;
    margin-right: 0.5rem;
}

.search-input.active {
    width: 250px;
    padding: 0.5rem 0.75rem;
    opacity: 1;
}

.search-input::placeholder {
    color: #999;
}

.search-input:focus {
    outline: none;
}

/* User Info */
.user-info {
    color: #fff;
    font-size: 0.875rem;
}

/* Icon Button */
.btn-icon {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.25rem;
    transition: transform 0.2s;
}

.btn-icon:hover {
    transform: scale(1.1);
}

/* Logout Button */
.btn-logout {
    padding: 0.4rem 0.75rem;
    background: transparent;
    border: 1px solid #666;
    color: #fff;
    border-radius: 3px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-logout:hover {
    background: #e50914;
    border-color: #e50914;
}

/* Container */
.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 2rem 3rem;
}

/* Search Box */
.search-box {
    margin-bottom: 2rem;
}

.search-box input {
    width: 100%;
    max-width: 400px;
    padding: 0.875rem 1.25rem 0.875rem 3rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s ease;
}

.search-box input:focus {
    outline: none;
    border-color: var(--text-primary);
    background: var(--bg-card);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

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

/* Hero Section */
.hero {
    height: 56vh;
    min-height: 400px;
    max-height: 500px;
    padding-top: 68px;
    background: linear-gradient(to right, rgba(20, 20, 20, 0.9) 0%, rgba(20, 20, 20, 0.3) 50%, rgba(20, 20, 20, 0.9) 100%),
        url('https://picsum.photos/seed/chillflix-hero/1920/1080') center/cover no-repeat;
    display: flex;
    align-items: center;
    padding-left: 4%;
    padding-right: 4%;
    position: relative;
}

.hero::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 150px;
    background: linear-gradient(to top, var(--bg-primary) 0%, transparent 100%);
    pointer-events: none;
}

.hero-content {
    max-width: 550px;
    position: relative;
    z-index: 15;
}

.hero-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 2.5rem;
    line-height: 1.1;
    margin-bottom: 0.75rem;
    letter-spacing: 2px;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.8);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-width: 500px;
}

.hero-desc {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 1.5rem;
    line-height: 1.6;
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.8);
}

.hero-buttons {
    display: flex;
    gap: 1rem;
}

.btn-play {
    padding: 0.75rem 2rem;
    background: var(--text-primary);
    color: var(--bg-primary);
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.2s;
}

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

.btn-info {
    padding: 0.75rem 2rem;
    background: rgba(109, 109, 110, 0.7);
    color: var(--text-primary);
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.2s;
}

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

/* Section */
.section {
    margin-bottom: 2rem;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    padding: 0 4%;
}

.section-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Main Content */
.main-content {
    margin-top: 0;
    padding-top: 1.5rem;
    position: relative;
    z-index: 20;
}

/* Video Slider - Netflix Style Horizontal Scroll */
.video-slider,
.video-grid {
    display: flex;
    gap: 0.35rem;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding: 0.5rem 4%;
}

.video-slider::-webkit-scrollbar,
.video-grid::-webkit-scrollbar {
    display: none;
}

.video-slider,
.video-grid {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Video Card - Netflix Style */
.video-card {
    flex: 0 0 280px;
    background: var(--bg-card);
    border-radius: 6px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    cursor: pointer;
    position: relative;
    transform-origin: center;
}

.video-card:hover {
    transform: scale(1.08);
    z-index: 10;
    box-shadow: 0 14px 40px var(--shadow), 0 0 0 1px rgba(255, 255, 255, 0.1);
    border-radius: 6px;
}

.thumbnail-wrapper {
    position: relative;
    aspect-ratio: 16/9;
    overflow: hidden;
}

.video-card .thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: var(--bg-secondary);
    transition: opacity 0.3s ease;
}

.video-card .duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 500;
    backdrop-filter: blur(4px);
}

/* Hover Info Panel */
.video-hover-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, var(--bg-card) 0%, var(--bg-card) 60%, transparent 100%);
    padding: 3rem 1rem 1rem;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

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

.hover-buttons {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.btn-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid rgba(255, 255, 255, 0.7);
    background: rgba(42, 42, 42, 0.6);
    color: var(--text-primary);
    backdrop-filter: blur(4px);
}

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

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

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

/* My List Button */
.btn-mylist {
    font-size: 1.25rem;
    font-weight: 700;
}

.btn-mylist.in-list {
    background: var(--success);
    color: var(--bg-primary);
}

.btn-mylist.in-list:hover {
    background: #3cb85c;
}

/* Video Info */
.video-card .info {
    padding: 1rem;
}

.video-card .title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.video-card .meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-edit {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.25rem;
    opacity: 0.6;
    transition: opacity 0.2s, transform 0.2s;
}

.btn-edit:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Match Score Badge */
.match-score {
    color: var(--success);
    font-weight: 700;
    font-size: 0.8rem;
}

.quality-badge {
    background: var(--accent);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* Video Player Page */
.player-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.video-player {
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 8px 32px var(--shadow);
}

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

.video-info {
    margin-top: 1.5rem;
}

.video-info h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 1rem;
    letter-spacing: 0.5px;
}

.video-info .description {
    color: var(--text-secondary);
    line-height: 1.8;
}

.btn-back {
    padding: 0.6rem 1.25rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-back:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

/* Loading */
.loading {
    text-align: center;
    padding: 4rem;
    color: var(--text-secondary);
    font-size: 1rem;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 8px;
    width: 90%;
    max-width: 420px;
    border: 1px solid var(--border);
    box-shadow: 0 16px 48px var(--shadow);
}

.modal h2 {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 700;
}

.modal input {
    width: 100%;
    padding: 0.875rem 1rem;
    margin-bottom: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.modal input:focus {
    outline: none;
    border-color: var(--text-primary);
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

.modal-actions button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s;
}

.modal-actions button[type="submit"] {
    background: var(--text-primary);
    color: var(--bg-primary);
}

.modal-actions button[type="submit"]:hover {
    background: var(--text-secondary);
}

.modal-actions button[type="button"] {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.modal-actions button[type="button"]:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
}

/* Toast */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: 4px;
    color: white;
    font-weight: 500;
    z-index: 2000;
    animation: slideIn 0.3s ease;
    box-shadow: 0 4px 16px var(--shadow);
}

.toast-success {
    background: var(--success);
}

.toast-error {
    background: var(--accent);
}

.toast-info {
    background: #2196F3;
}

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

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

/* Auth Pages */
.auth-container {
    max-width: 400px;
    margin: 80px auto;
    padding: 2.5rem;
    background: var(--bg-card);
    border-radius: 8px;
    border: 1px solid var(--border);
    box-shadow: 0 8px 32px var(--shadow);
}

.auth-container h1 {
    text-align: center;
    margin-bottom: 2rem;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 2.5rem;
    color: var(--accent);
    letter-spacing: 3px;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s, background 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--text-primary);
    background: var(--bg-hover);
}

.btn-primary {
    width: 100%;
    padding: 1rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    letter-spacing: 0.5px;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.auth-links {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text-secondary);
}

.auth-links a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.auth-links a:hover {
    color: var(--accent);
}

.error-message {
    background: var(--accent);
    color: white;
    padding: 0.875rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    display: none;
    font-size: 0.9rem;
    font-weight: 500;
}

.success-message {
    background: var(--success);
    color: white;
    padding: 0.875rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    display: none;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Responsive */
@media (max-width: 1024px) {
    .container {
        padding: 1.5rem 2rem;
    }

    .header {
        padding: 1rem 2rem;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .header {
        padding: 1rem;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .header-actions {
        gap: 0.75rem;
    }

    #user-info {
        display: none;
    }

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

    .video-card:hover {
        transform: scale(1.02);
    }

    .video-card .title {
        font-size: 0.85rem;
    }

    .video-card .info {
        padding: 0.75rem;
    }

    .auth-container {
        margin: 40px 1rem;
        padding: 1.5rem;
    }

    .auth-container h1 {
        font-size: 2rem;
    }
}

/* Skeleton Loading */
.skeleton-grid {
    display: flex;
    gap: 0.35rem;
    padding: 0.5rem 4%;
    overflow-x: auto;
}

.skeleton-card {
    flex: 0 0 280px;
    background: var(--bg-card);
    border-radius: 6px;
    overflow: hidden;
}

.skeleton-thumb {
    width: 100%;
    aspect-ratio: 16/9;
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-card) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.skeleton-info {
    padding: 1rem;
}

.skeleton-title {
    height: 1rem;
    background: var(--bg-secondary);
    border-radius: 4px;
    margin-bottom: 0.5rem;
    width: 80%;
}

.skeleton-meta {
    height: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 4px;
    width: 50%;
}

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

    100% {
        background-position: 200% 0;
    }
}

/* Thumbnail Placeholder with Gradient */
.thumbnail-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #e94560;
    font-size: 2rem;
}

/* Ensure hero buttons are always clickable above main content */
.hero-content {
    position: relative;
    z-index: 20;
}

.hero-buttons {
    position: relative;
    z-index: 21;
}

/* Player loading message */
#loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Custom Modal */
.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: 1000;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 12px;
    width: 90%;
    max-width: 480px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

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

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--accent);
}

.modal-body {
    padding: 1.5rem;
}

.modal-input {
    width: 100%;
    padding: 1rem;
    background: var(--bg-primary);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.modal-input:focus {
    border-color: var(--accent);
}

.modal-footer {
    display: flex;
    gap: 1rem;
    padding: 1rem 1.5rem 1.5rem;
    justify-content: flex-end;
}

.btn-modal {
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-cancel {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
}

.btn-cancel:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}

.btn-save {
    background: var(--accent);
    color: #000;
}

.btn-save:hover {
    background: #ff2040;
    transform: translateY(-1px);
}

/* Resume Toast */
.resume-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1001;
    border: 1px solid var(--accent);
}

.resume-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}