/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #e50914;
    --secondary-color: #564d4d;
    --text-primary: #fff;
    --text-secondary: #999;
    --bg-primary: #141414;
    --bg-secondary: #1f1f1f;
    --bg-card: #2a2a2a;
    --border-color: #3a3a3a;
}

[data-theme="light"] {
    --text-primary: #000;
    --text-secondary: #666;
    --bg-primary: #f5f5f5;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --border-color: #e0e0e0;
}

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

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

/* Navbar */
.navbar {
    background: var(--bg-secondary);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border-color);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-links a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: var(--primary-color);
}

/* Buttons */
.btn-primary, .btn-secondary {
    padding: 0.5rem 1.5rem;
    border-radius: 4px;
    text-decoration: none;
    transition: all 0.3s;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    display: inline-block;
}

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

.btn-primary:hover {
    background: #b20710;
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--secondary-color);
}

.btn-block {
    display: block;
    width: 100%;
}

.icon-btn {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

/* Theme and Language Controls */
.theme-language-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.language-selector select {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    border-radius: 4px;
    cursor: pointer;
}

/* Dropdown */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-toggle {
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.5rem 1rem;
    position: relative;
}

.dropdown-toggle:hover {
    color: var(--primary-color);
}

.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    min-width: 150px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 1000;
    padding: 0.5rem 0;
}

/* Invisible bridge between button and menu to prevent hover loss */
.dropdown-menu::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    height: 12px;
    background: transparent;
}

.dropdown:hover .dropdown-menu {
    display: block;
}

.dropdown-menu a {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.2s;
}

.dropdown-menu a:hover {
    background: var(--bg-secondary);
    color: var(--primary-color);
}

/* Messages */
.messages-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 1000;
    max-width: 400px;
}

.alert {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
    background: var(--bg-card);
    border-left: 4px solid var(--primary-color);
}

/* Home Page - Shelves */
.shelf {
    margin: 3rem 0;
}

.shelf h2 {
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    position: relative;
    padding-left: 1rem;
}

.shelf h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 70%;
    background: var(--primary-color);
    border-radius: 2px;
}

.shelf h2 a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.3s;
}

.shelf h2 a:hover {
    color: var(--primary-color);
}

.series-scroll {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    scrollbar-width: thin;
}

.series-scroll::-webkit-scrollbar {
    height: 8px;
}

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

.series-scroll::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 4px;
}

.series-card {
    flex-shrink: 0;
    width: 220px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.series-card:hover {
    transform: translateY(-12px) scale(1.02);
}

.series-card a {
    text-decoration: none;
    color: inherit;
}

.series-card-image {
    position: relative;
    width: 100%;
    height: 320px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.4s;
}

.series-card:hover .series-card-image {
    box-shadow: 0 12px 30px rgba(229, 9, 20, 0.4);
}

.series-card-image::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);
    z-index: 1;
    opacity: 0.8;
}

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

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

.series-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1.25rem;
    z-index: 2;
}

.series-info h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #fff;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.series-info p {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 0.5rem;
}

.series-stats {
    display: flex;
    gap: 0.75rem;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 0.5rem;
}

.series-stat {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.series-stat-icon {
    font-size: 0.9rem;
}

.badge {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.7rem;
    margin-top: 0.5rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
}

.badge.trending {
    background: linear-gradient(135deg, #ff6b00, #ff8f00);
    animation: pulse 2s ease-in-out infinite;
}

.badge.new {
    background: linear-gradient(135deg, #00a8ff, #0088ff);
}

.badge.free {
    background: linear-gradient(135deg, #00d26a, #00b359);
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(255, 107, 0, 0.5);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 4px 16px rgba(255, 107, 0, 0.8);
    }
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 4px;
    background: var(--bg-secondary);
    border-radius: 2px;
    margin-top: 0.5rem;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.3s;
}

/* Series Detail Page */
.series-detail-page {
    margin-top: -70px;
}

.series-header {
    position: relative;
    padding: 100px 0 2rem;
    background: linear-gradient(to bottom, transparent, var(--bg-primary));
}

.cover-image {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 500px;
    background-size: cover;
    background-position: center;
    opacity: 0.3;
    z-index: -1;
}

.series-main-info {
    display: flex;
    gap: 2rem;
}

.series-poster {
    width: 250px;
    height: 375px;
    object-fit: cover;
    border-radius: 8px;
}

.series-details {
    flex: 1;
}

.series-details h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.series-meta {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.description {
    margin-bottom: 1.5rem;
    line-height: 1.8;
    max-width: 800px;
}

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

/* Episodes Section */
.episodes-section {
    margin: 3rem 0;
}

.episodes-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.episode-item {
    background: var(--bg-card);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s;
}

.episode-item:hover {
    transform: translateY(-5px);
}

.episode-item.watched {
    opacity: 0.7;
}

.episode-item a {
    text-decoration: none;
    color: inherit;
    display: block;
}

.episode-thumbnail {
    position: relative;
    width: 100%;
    height: 170px;
    overflow: hidden;
}

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

.lock-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 1.5rem;
}

.episode-info {
    padding: 1rem;
}

.episode-info h3 {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.episode-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.episode-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.episode-number-badge {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), #b20710);
    border-radius: 50%;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    box-shadow: 0 4px 12px rgba(229, 9, 20, 0.4);
    transition: all 0.3s;
    position: relative;
}

.episode-number-badge .lock-icon {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--bg-card);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

/* Video Player */
.video-player-page {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.video-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    height: 100vh;
}

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

.video-controls-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 1rem;
}

.video-controls-overlay > * {
    pointer-events: auto;
}

/* TikTok-style Actions */
.tiktok-actions {
    position: absolute;
    right: 1rem;
    bottom: 120px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    pointer-events: auto;
    z-index: 10;
}

.action-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
    transition: transform 0.2s;
}

.action-item:active {
    transform: scale(0.9);
}

.action-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all 0.3s;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.action-icon:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.action-icon.active {
    background: rgba(229, 9, 20, 0.9);
    border-color: rgba(229, 9, 20, 1);
    box-shadow: 0 0 20px rgba(229, 9, 20, 0.6);
}

.action-count {
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.action-label {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.65rem;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

/* Animations */
@keyframes heartbeat {
    0%, 100% {
        transform: scale(1);
    }
    25% {
        transform: scale(1.3);
    }
    50% {
        transform: scale(0.9);
    }
    75% {
        transform: scale(1.2);
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Toast Notification */
.toast-notification {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(255, 255, 255, 0.95);
    color: #000;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s ease;
}

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

.top-controls {
    background: linear-gradient(to bottom, rgba(0,0,0,0.8), transparent);
    padding: 1rem;
    margin: -1rem;
}

.back-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
}

.video-title {
    margin-top: 1rem;
}

.video-title h2 {
    font-size: 1.2rem;
    margin-bottom: 0.25rem;
}

.video-title p {
    font-size: 0.9rem;
    color: #ccc;
}

.bottom-controls {
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    padding: 1rem;
    margin: -1rem;
    display: flex;
    justify-content: space-between;
}

.nav-btn {
    background: var(--primary-color);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 8px;
    text-align: center;
    max-width: 400px;
}

.modal-content h3 {
    margin-bottom: 1rem;
}

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

/* Auth Pages */
.auth-page {
    min-height: calc(100vh - 200px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-container {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 8px;
    max-width: 400px;
    width: 100%;
}

.auth-container h1 {
    margin-bottom: 0.5rem;
}

.auth-container > p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

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

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

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

.auth-switch {
    text-align: center;
    color: var(--text-secondary);
}

.auth-switch a {
    color: var(--primary-color);
    text-decoration: none;
}

/* Profile Page */
.profile-page {
    padding: 2rem 0;
}

.profile-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.profile-form {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 8px;
}

.avatar-section {
    text-align: center;
    margin-bottom: 2rem;
}

.avatar-preview {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 1rem;
}

.avatar-placeholder {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    margin: 0 auto 1rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.subscription-info {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 8px;
    height: fit-content;
}

.subscription-info h2 {
    margin-bottom: 1rem;
}

.status {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.status.active {
    color: #00d26a;
}

.status.inactive {
    color: var(--text-secondary);
}

/* Footer */
footer {
    background: var(--bg-secondary);
    padding: 2rem 0;
    margin-top: 4rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 768px) {
    .nav-links {
        gap: 0.5rem;
        font-size: 0.875rem;
    }

    .series-main-info {
        flex-direction: column;
    }

    .episodes-list {
        grid-template-columns: 1fr;
    }

    .profile-content {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}
