/* Las fuentes se cargan desde <link> en index.html (un @import aquí bloquea el render en cadena) */

:root {
    --primary: #dc2626;
    --primary-dark: #b91c1c;
    --primary-light: #ef4444;
    --primary-glow: rgba(220, 38, 38, 0.35);
    --primary-subtle: rgba(220, 38, 38, 0.1);
    --accent-gold: #d4a574;
    --accent-gold-light: #e8c9a8;
    --bg-primary: #09090b;
    --bg-secondary: #0f0f12;
    --bg-tertiary: #161619;
    --bg-card: #1a1a1f;
    --bg-card-hover: #222228;
    --bg-elevated: #252529;
    --bg-input: #0d0d10;
    --glass-bg: rgba(22, 22, 25, 0.85);
    --glass-border: rgba(255, 255, 255, 0.06);
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #52525b;
    --success: #22c55e;
    --warning: #f59e0b;
    --error-color: #ef4444;
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-medium: rgba(255, 255, 255, 0.1);
    --border-color: rgba(255, 255, 255, 0.08); /* alias usado por ads.css */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px var(--primary-glow);
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-display: 'Playfair Display', Georgia, serif;
    --font-body: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    /* Ningún elemento (ads de ancho fijo, etc.) debe romper el layout en móvil */
    overflow-x: hidden;
}

img,
video,
iframe {
    max-width: 100%;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 0%, rgba(220, 38, 38, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(212, 165, 116, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

::selection {
    background: var(--primary);
    color: white;
}

/* Accesibilidad: indicador de foco visible al navegar con teclado */
:focus-visible {
    outline: 2px solid var(--primary-light);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

:focus:not(:focus-visible) {
    outline: none;
}

::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-elevated);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 2rem;
    position: relative;
    z-index: 1;
}

/* ============================================
   HEADER
   ============================================ */
.header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: linear-gradient(180deg, rgba(9, 9, 11, 0.98) 0%, rgba(9, 9, 11, 0.95) 100%);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-subtle);
}

.header::before {
    content: '⚠ CONTENIDO PARA MAYORES DE 18 AÑOS';
    display: block;
    background: linear-gradient(90deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-dark) 100%);
    background-size: 200% 100%;
    animation: shimmerBanner 3s ease infinite;
    color: white;
    text-align: center;
    padding: 0.5rem 1rem;
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

@keyframes shimmerBanner {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    gap: 1.5rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: var(--transition-base);
    flex-shrink: 0;
}

.logo:hover {
    transform: scale(1.02);
}

.logo i {
    font-size: 1.75rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent-gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 10px var(--primary-glow));
}

.logo span {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-gold-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* NAVIGATION */
.nav {
    display: flex;
    gap: 0.25rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-lg);
    font-weight: 500;
    font-size: 0.9375rem;
    transition: var(--transition-base);
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--primary-subtle);
}

.nav-link.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: var(--shadow-glow);
}

/* HEADER ACTIONS */
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.auth-buttons {
    display: flex;
    gap: 0.5rem;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: var(--radius-lg);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition-base);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--primary-glow);
}

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-medium);
}

.btn-outline:hover {
    background: var(--bg-elevated);
    border-color: var(--primary);
    color: var(--primary-light);
}

.btn-error {
    background: linear-gradient(135deg, var(--error-color) 0%, #dc2626 100%);
    color: white;
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* ============================================
   USER MENU
   ============================================ */
.user-menu {
    position: relative;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: var(--transition-base);
}

.user-info:hover {
    background: var(--bg-elevated);
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent-gold) 100%);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.8rem;
}

.user-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    min-width: 200px;
    box-shadow: var(--shadow-lg);
    display: none;
    overflow: hidden;
}

.user-dropdown.active {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition-fast);
    font-size: 0.875rem;
}

.dropdown-item:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.dropdown-item i {
    width: 18px;
    text-align: center;
    color: var(--text-muted);
}

.dropdown-item:hover i {
    color: var(--primary);
}

.user-dropdown hr {
    border: none;
    border-top: 1px solid var(--border-subtle);
    margin: 0;
}

/* FIREBASE STATUS */
.firebase-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-lg);
    font-size: 0.75rem;
    font-weight: 500;
}

.firebase-status.loading {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.firebase-status.ready {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.firebase-status.error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error-color);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: var(--radius-full);
}

.status-dot.loading {
    background: var(--warning);
    animation: pulse 2s infinite;
}

.status-dot.ready {
    background: var(--success);
}

.status-dot.error {
    background: var(--error-color);
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(0.9);
    }
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    min-height: calc(100vh - 120px);
    padding: 1.5rem 0 3rem;
    position: relative;
    z-index: 1;
}

.page {
    display: none;
}

.page.active {
    display: block;
    animation: pageIn 0.3s ease;
}

@keyframes pageIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* PAGE HEADER - más compacto */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h1 {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-gold-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* FILTERS */
.filters {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.filter-select {
    padding: 0.5rem 2rem 0.5rem 1rem;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    font-family: var(--font-body);
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition-base);
    min-width: 200px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 16px;
}

.filter-select:hover {
    border-color: var(--border-medium);
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-subtle);
}

/* ============================================
   HOME LAYOUT - Grid with sidebar
   ============================================ */
.home-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 1.5rem;
    align-items: start;
}

.home-main {
    min-width: 0;
    /* Prevent grid blowout */
}

.home-sidebar {
    position: sticky;
    top: 120px;
}

@media (max-width: 1100px) {
    .home-layout {
        grid-template-columns: 1fr;
    }

    .home-sidebar {
        display: none;
    }
}

/* ============================================
   VIDEOS GRID (base - overridden by video-cards-improved.css)
   ============================================ */
.videos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}

/* ============================================
   CATEGORIES
   ============================================ */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}

.category-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-base);
}

.category-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: var(--shadow-md), var(--shadow-glow);
}

.category-icon {
    font-size: 2.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent-gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.75rem;
}

.category-name {
    font-family: var(--font-display);
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
}

.category-count {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.category-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 0.75rem;
}

/* ============================================
   VIDEO DETAIL
   ============================================ */
.video-detail-container {
    max-width: 1100px;
    margin: 0 auto;
}

.video-detail-info {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    position: relative;
}

.video-detail-info::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent-gold), var(--primary));
}

.video-detail-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.video-detail-stats {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.stat-item i {
    color: var(--primary);
    font-size: 0.8rem;
}

.video-detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 1rem 0;
    border-top: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
    margin: 1rem 0;
}

.action-btn.faved {
    background: linear-gradient(135deg, var(--accent-gold) 0%, #b8860b 100%);
    border-color: var(--accent-gold);
    color: #1a1a1f;
}

.action-btn-muted {
    background: transparent;
    color: var(--text-muted);
}

.action-btn-muted:hover {
    background: var(--error-color);
    border-color: var(--error-color);
    color: #fff;
    box-shadow: none;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition-base);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.875rem;
}

.action-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
}

.action-btn.liked {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-color: var(--primary);
    color: white;
}

.video-detail-description h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.375rem;
}

.video-detail-description p {
    color: var(--text-secondary);
    line-height: 1.7;
    font-size: 0.9375rem;
}

.video-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-top: 0.75rem;
}

.tag {
    padding: 0.375rem 0.75rem;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border-radius: var(--radius-full);
    font-size: 0.8125rem;
}

.tag:hover {
    background: var(--primary-subtle);
    color: var(--primary-light);
}

/* ============================================
   COMMENTS
   ============================================ */
.comments-section {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    margin-top: 1rem;
}

.comments-header {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.comments-header::before {
    content: '';
    width: 4px;
    height: 24px;
    background: linear-gradient(180deg, var(--primary), var(--accent-gold));
    border-radius: var(--radius-full);
}

.comment-form {
    margin-bottom: 1.5rem;
}

.comment-form textarea {
    width: 100%;
    padding: 0.875rem;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    font-family: var(--font-body);
    resize: vertical;
    min-height: 100px;
    margin-bottom: 0.75rem;
    transition: var(--transition-base);
}

.comment-form textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-subtle);
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.comment {
    display: flex;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    border-left: 3px solid var(--primary);
}

.comment-avatar {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent-gold) 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
}

.comment-body {
    flex: 1;
    min-width: 0;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.375rem;
}

.comment-author {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.comment-date {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.comment-content {
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 0.875rem;
}

/* ============================================
   UPLOAD FORM
   ============================================ */
.upload-container {
    max-width: 800px;
    margin: 0 auto;
}

.upload-form {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    position: relative;
}

.upload-form::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent-gold), var(--primary));
}

.form-section {
    margin-bottom: 1.5rem;
}

.form-section h3 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-section h3::before {
    content: '';
    width: 4px;
    height: 20px;
    background: linear-gradient(180deg, var(--primary), var(--accent-gold));
    border-radius: var(--radius-full);
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
    font-size: 0.875rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    font-family: var(--font-body);
    transition: var(--transition-base);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-subtle);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.file-input-wrapper {
    position: relative;
}

.file-input-wrapper input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 2;
}

.file-input-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem;
    background: var(--bg-input);
    border: 2px dashed var(--border-medium);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition-base);
}

.file-input-wrapper:hover .file-input-label {
    border-color: var(--primary);
    background: var(--primary-subtle);
}

.file-input-label i {
    font-size: 2.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent-gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.75rem;
}

.file-input-label span {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.875rem;
}

.file-info {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: var(--primary-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.8125rem;
}

.upload-progress {
    margin-top: 0.75rem;
}

.progress-bar {
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 0.375rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent-gold));
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    display: block;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-family: var(--font-mono);
}

.thumbnail-preview {
    margin-top: 0.75rem;
    display: none;
}

.thumbnail-preview.active {
    display: block;
}

.thumbnail-preview img {
    width: 100%;
    max-width: 350px;
    border-radius: var(--radius-lg);
    border: 2px solid var(--border-subtle);
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-subtle);
}

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.375rem;
    margin-top: 1.5rem;
}

.pagination button {
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition-base);
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 0.875rem;
}

.pagination button:hover:not(:disabled) {
    background: var(--primary);
    border-color: var(--primary);
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination button.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-color: var(--primary);
}

/* ============================================
   MODALS
   ============================================ */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    backdrop-filter: blur(8px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-2xl);
    max-width: 460px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.3s ease;
    position: relative;
}

.modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent-gold), var(--primary));
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
}

.modal-header h2 {
    font-family: var(--font-display);
    font-size: 1.375rem;
    font-weight: 700;
}

.modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.375rem;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
}

.modal-close:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.modal-form {
    padding: 1.5rem;
}

.modal-footer-text {
    text-align: center;
    margin-top: 1.25rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.modal-footer-text a {
    color: var(--primary-light);
    text-decoration: none;
    font-weight: 600;
}

.modal-footer-text a:hover {
    text-decoration: underline;
}

/* ============================================
   TOAST
   ============================================ */
.toast-container {
    position: fixed;
    top: 90px;
    right: 1.5rem;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 360px;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 0.875rem 1rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: toastIn 0.4s ease;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast-icon {
    font-size: 1.25rem;
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.success .toast-icon {
    color: var(--success);
}

.toast.error {
    border-left: 4px solid var(--error-color);
}

.toast.error .toast-icon {
    color: var(--error-color);
}

.toast.warning {
    border-left: 4px solid var(--warning);
}

.toast.warning .toast-icon {
    color: var(--warning);
}

.toast.info {
    border-left: 4px solid var(--primary);
}

.toast.info .toast-icon {
    color: var(--primary);
}

.toast-message {
    flex: 1;
    color: var(--text-primary);
    font-size: 0.875rem;
}

/* LOADING */
.loading-spinner {
    text-align: center;
    padding: 3rem;
    grid-column: 1 / -1;
}

.loading-spinner i {
    font-size: 2.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent-gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.75rem;
}

.loading-spinner p {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .page-header h1 {
        font-size: 1.5rem;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 0.75rem;
    }

    /* Header en 2 filas: [☰ logo ..... botones] / [buscador] */
    .header-content {
        flex-wrap: wrap;
        padding: 0.5rem 0;
        gap: 0.5rem;
        row-gap: 0.375rem;
    }

    .logo {
        order: 1;
        margin-right: auto;
    }

    .logo i {
        font-size: 1.4rem;
    }

    .logo span {
        font-size: 1.2rem;
    }

    .header-actions {
        order: 2;
    }

    .auth-buttons .btn {
        padding: 0.45rem 0.7rem;
        font-size: 0.78rem;
        gap: 0.35rem;
    }

    .user-info {
        padding: 0.4rem 0.6rem;
    }

    .user-name {
        max-width: 90px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.8125rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .page-header h1 {
        font-size: 1.375rem;
    }

    /* Filtros: ocupan el ancho completo, mitad y mitad */
    .filters {
        width: 100%;
        gap: 0.5rem;
    }

    .filter-select {
        flex: 1 1 0;
        min-width: 0;
    }

    .video-detail-stats {
        gap: 0.75rem;
    }

    .toast-container {
        left: 0.75rem;
        right: 0.75rem;
        max-width: none;
    }

    .main-content {
        padding: 1rem 0 2rem;
    }

    .video-detail-title {
        font-size: 1.25rem;
    }
}

@media (max-width: 480px) {
    /* Banner +18 más compacto */
    .header::before {
        font-size: 0.65rem;
        letter-spacing: 1px;
        padding: 0.4rem 0.5rem;
    }

    .auth-buttons .btn {
        font-size: 0.72rem;
        padding: 0.4rem 0.55rem;
        gap: 0.3rem;
    }

    .logo span {
        font-size: 1.1rem;
    }

    /* Reproductor: menos botones (el doble tap ya adelanta/retrocede) */
    #rewindBtn,
    #forwardBtn,
    #pipBtn {
        display: none;
    }

    .video-controls {
        padding: 2rem 0.5rem 0.5rem;
    }

    /* Acciones del video en 2 columnas parejas */
    .video-detail-actions {
        gap: 0.5rem;
    }

    .action-btn {
        flex: 1 1 calc(50% - 0.25rem);
        justify-content: center;
        padding: 0.6rem 0.75rem;
        font-size: 0.8rem;
    }

    .video-detail-info,
    .comments-section,
    .upload-form {
        padding: 1rem;
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   REPRODUCTOR PREMIUM
   ============================================ */
.video-player-wrapper {
    position: relative;
    background: #000;
    border-radius: var(--radius-xl);
    overflow: hidden;
    margin-bottom: 1rem;
    aspect-ratio: 16/9;
}

.premium-video-player {
    width: 100%;
    height: 100%;
    display: block;
    background: #000;
}

.video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.7) 50%, transparent 100%);
    padding: 3rem 1rem 0.75rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.video-controls.visible {
    opacity: 1;
}

.video-controls:hover {
    opacity: 1;
}

.progress-container {
    position: relative;
    width: 100%;
    height: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

/* Note: .progress-bar is also used by upload progress, scope this to the player */
.video-controls .progress-bar,
.progress-container .progress-bar {
    position: relative;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    transition: height 0.1s ease;
    overflow: visible;
    margin-bottom: 0;
}

.progress-container:hover .progress-bar {
    height: 6px;
}

.progress-filled {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent-gold));
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s linear;
}

.progress-thumb {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 14px;
    height: 14px;
    background: var(--primary);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    transition: transform 0.1s ease;
}

.progress-container:hover .progress-thumb {
    transform: translate(-50%, -50%) scale(1);
}

.time-tooltip {
    position: absolute;
    bottom: 100%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-family: var(--font-mono);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    margin-bottom: 8px;
}

.progress-container:hover .time-tooltip {
    opacity: 1;
}

.controls-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.controls-left,
.controls-right {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.control-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.1);
}

.volume-container {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.volume-slider {
    width: 0;
    opacity: 0;
    transition: all 0.3s ease;
    cursor: pointer;
    accent-color: var(--primary);
}

.volume-container:hover .volume-slider {
    width: 70px;
    opacity: 1;
}

.time-display {
    color: white;
    font-size: 0.8125rem;
    font-family: var(--font-mono);
    margin-left: 0.375rem;
}

.speed-container {
    position: relative;
}

#speedText {
    font-size: 0.75rem;
    font-weight: 600;
}

.speed-menu {
    position: absolute;
    bottom: 100%;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 0.375rem;
    display: none;
    flex-direction: column;
    min-width: 72px;
    margin-bottom: 0.375rem;
    box-shadow: var(--shadow-lg);
}

.speed-menu.show {
    display: flex;
}

.speed-menu button {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.375rem 0.75rem;
    cursor: pointer;
    font-size: 0.8125rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    text-align: center;
}

.speed-menu button:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.speed-menu button.active {
    background: var(--primary);
    color: white;
}

.play-overlay-big {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 72px;
    height: 72px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 15;
}

.play-overlay-big i {
    font-size: 1.75rem;
    color: var(--primary);
    margin-left: 4px;
}

.play-overlay-big:hover {
    transform: translate(-50%, -50%) scale(1.1);
}

.action-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 56px;
    height: 56px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.action-indicator.show {
    opacity: 1;
    animation: actionPop 0.5s ease;
}

.action-indicator i {
    font-size: 1.25rem;
    color: white;
}

@keyframes actionPop {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
    }

    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0;
    }
}

/* Indicador de 2x al mantener presionado */
.speed-hold-indicator {
    position: absolute;
    top: 10%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    z-index: 16;
}

.speed-hold-indicator.show {
    opacity: 1;
}

.double-tap-indicator {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 90px;
    height: 90px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    z-index: 15;
}

.double-tap-indicator.left {
    left: 15%;
}

.double-tap-indicator.right {
    right: 15%;
}

.double-tap-indicator.show {
    animation: doubleTapPop 0.6s ease forwards;
}

.double-tap-indicator i {
    font-size: 1.25rem;
    color: white;
}

.double-tap-indicator span {
    font-size: 0.8125rem;
    color: white;
    font-weight: 600;
    margin-top: 3px;
}

@keyframes doubleTapPop {
    0% {
        opacity: 0;
        transform: translateY(-50%) scale(0.5);
    }

    30% {
        opacity: 1;
        transform: translateY(-50%) scale(1.1);
    }

    100% {
        opacity: 0;
        transform: translateY(-50%) scale(1);
    }
}

/* Fullscreen */
.video-player-wrapper:fullscreen {
    border-radius: 0;
}

.video-player-wrapper:fullscreen .video-controls {
    padding: 4rem 2rem 1rem;
}

.video-player-wrapper:fullscreen .control-btn {
    width: 44px;
    height: 44px;
    font-size: 1.125rem;
}

.video-player-wrapper:fullscreen .play-overlay-big {
    width: 90px;
    height: 90px;
}

.video-player-wrapper:fullscreen .play-overlay-big i {
    font-size: 2.25rem;
}

@media (max-width: 768px) {
    .control-btn {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }

    .time-display {
        font-size: 0.6875rem;
    }

    .volume-container:hover .volume-slider {
        width: 50px;
    }

    .play-overlay-big {
        width: 60px;
        height: 60px;
    }

    .play-overlay-big i {
        font-size: 1.5rem;
    }
}

/* ============================================
   BARRA DE BÚSQUEDA (header)
   ============================================ */
.search-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 0 1 340px;
    height: 42px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    padding: 0 0.375rem 0 0.95rem;
    transition: border-color var(--transition-base), box-shadow var(--transition-base), background var(--transition-base);
}

.search-bar:hover {
    border-color: var(--border-medium);
}

.search-bar:focus-within {
    background: var(--bg-input);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-subtle);
}

.search-bar .search-icon {
    color: var(--text-muted);
    font-size: 0.875rem;
    flex-shrink: 0;
    transition: color var(--transition-base);
}

.search-bar:focus-within .search-icon {
    color: var(--primary-light);
}

.search-input {
    flex: 1;
    min-width: 0;
    height: 100%;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    border: none;
    outline: none;
    box-shadow: none;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    letter-spacing: 0.01em;
}

.search-input::placeholder {
    color: var(--text-muted);
    opacity: 1;
}

/* Quitar adornos nativos del input type=search (look anticuado) */
.search-input::-webkit-search-cancel-button,
.search-input::-webkit-search-decoration,
.search-input::-webkit-search-results-button {
    -webkit-appearance: none;
    appearance: none;
}

/* Autofill: evitar el fondo blanco/azul nativo */
.search-input:-webkit-autofill,
.search-input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--text-primary);
    -webkit-box-shadow: 0 0 0 1000px var(--bg-tertiary) inset;
    caret-color: var(--text-primary);
}

.search-submit {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.8125rem;
    transition: var(--transition-base);
}

.search-bar:focus-within .search-submit,
.search-submit:hover {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
}

/* ============================================
   BANNER DE RESULTADOS (búsqueda / etiqueta)
   ============================================ */
.results-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-left: 3px solid var(--primary);
    border-radius: var(--radius-lg);
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
}

.results-banner .results-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

.results-banner .results-info i {
    color: var(--primary-light);
}

.results-banner .results-info strong {
    color: var(--text-primary);
}

.results-banner .results-count {
    background: var(--primary-subtle);
    color: var(--primary-light);
    padding: 0.125rem 0.625rem;
    border-radius: var(--radius-full);
    font-size: 0.8125rem;
    font-weight: 600;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

/* ============================================
   ETIQUETAS EN TARJETAS DE VIDEO
   ============================================ */
.video-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-top: 0.625rem;
}

.video-card-tags .tag {
    padding: 0.2rem 0.55rem;
    font-size: 0.75rem;
}

/* Etiquetas clicables (tarjetas y detalle) */
.tag-link {
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition-fast);
}

.tag-link:hover {
    background: var(--primary-subtle);
    color: var(--primary-light);
}

.video-tags-label {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--text-muted);
    font-size: 0.8125rem;
    margin-right: 0.25rem;
}

/* Responsive del buscador */
@media (max-width: 768px) {
    .search-bar {
        order: 3; /* segunda fila, después de logo y botones */
        flex-basis: 100%;
        max-width: none;
        margin-top: 0;
        height: 38px;
    }
}

/* ============================================
   ESTADO VACÍO / SIN RESULTADOS
   ============================================ */
.empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4rem 1.5rem;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    opacity: 0.6;
}

.empty-state h3 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.empty-state p {
    margin-bottom: 1.25rem;
    max-width: 420px;
}

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
    position: relative;
    z-index: 1;
    margin-top: 3rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-subtle);
    padding: 2.5rem 0 1.5rem;
}

.footer-top {
    display: grid;
    grid-template-columns: 1.5fr 2fr;
    gap: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
}

.footer-brand .logo {
    margin-bottom: 0.75rem;
}

.footer-brand p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    max-width: 380px;
    line-height: 1.7;
}

.footer-links {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    justify-items: start;
}

.footer-col {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.footer-col h4 {
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.footer-col a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color var(--transition-fast);
}

.footer-col a:hover {
    color: var(--primary-light);
}

.footer-compliance {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.8125rem;
    padding: 1.25rem 0;
}

.footer-compliance i {
    color: var(--success);
}

.footer-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.footer-rating {
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    padding: 0.125rem 0.5rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

@media (max-width: 768px) {
    .footer-top {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

/* ============================================
   VIDEOS RELACIONADOS
   ============================================ */
.related-section {
    margin-top: 1.5rem;
}

.related-section:empty {
    display: none;
}

.related-header {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.related-header::before {
    content: '';
    width: 4px;
    height: 24px;
    background: linear-gradient(180deg, var(--primary), var(--accent-gold));
    border-radius: var(--radius-full);
}

.related-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

/* ============================================
   MODAL LEGAL
   ============================================ */
.legal-body {
    padding: 1.5rem;
    max-height: 65vh;
    overflow-y: auto;
    color: var(--text-secondary);
    line-height: 1.7;
    font-size: 0.9rem;
}

.legal-body h4 {
    color: var(--text-primary);
    font-size: 1rem;
    margin: 1.25rem 0 0.5rem;
}

.legal-body p {
    margin-bottom: 0.75rem;
}

.legal-body ul {
    margin: 0 0 0.75rem 1.25rem;
}

.legal-body ul li {
    margin-bottom: 0.375rem;
}

.legal-body strong {
    color: var(--text-primary);
}

/* ============================================
   SKELETONS DE CARGA
   ============================================ */
.skeleton-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.skeleton-thumb {
    width: 100%;
    padding-top: 56.25%;
    background: var(--bg-tertiary);
}

.skeleton-line {
    height: 12px;
    margin: 0.75rem;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
}

.skeleton-line-lg { width: 80%; }
.skeleton-line-sm { width: 50%; }

.skeleton-thumb,
.skeleton-line {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-elevated) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.4s infinite;
}

@keyframes skeletonShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================
   SCROLL INFINITO
   ============================================ */
.infinite-loader {
    grid-column: 1 / -1;
    text-align: center;
    padding: 1.5rem;
    color: var(--primary-light);
    font-size: 1.5rem;
}

.list-end {
    grid-column: 1 / -1;
    text-align: center;
    padding: 1.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    letter-spacing: 0.5px;
}

/* ============================================
   SEGUIR VIENDO (historial en home)
   ============================================ */
.continue-watching:empty { display: none; }

.continue-watching {
    margin-bottom: 1.75rem;
}

.cw-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.875rem;
}

.cw-header h2 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cw-header h2 i { color: var(--primary-light); font-size: 1rem; }

.cw-all {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    transition: color var(--transition-fast);
}

.cw-all:hover { color: var(--primary-light); }

.cw-row {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 240px;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    scrollbar-width: thin;
}

.cw-row::-webkit-scrollbar { height: 6px; }
.cw-row::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 3px; }

.cw-card { cursor: pointer; }

.cw-thumb {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-tertiary);
}

.cw-thumb img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-base);
}

.cw-card:hover .cw-thumb img { transform: scale(1.05); }

.cw-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(255,255,255,0.2);
}

.cw-progress-bar {
    height: 100%;
    background: var(--primary);
}

.cw-title {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================================
   BOTÓN VOLVER ARRIBA
   ============================================ */
.back-to-top {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 1500;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-full);
    font-size: 1rem;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity var(--transition-base), transform var(--transition-base), visibility var(--transition-base), background var(--transition-fast);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
}

/* No tapar el anuncio sticky móvil */
body.has-mobile-ad .back-to-top {
    bottom: 70px;
}

/* ============================================
   MENÚ HAMBURGUESA (móvil)
   ============================================ */
.nav-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-md);
}

.nav-toggle:hover { background: var(--primary-subtle); }

@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
        order: 0; /* primero: a la izquierda del logo */
    }

    .nav {
        order: 4;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 0.25rem;
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;
        margin: 0;
        border-top: 0 solid var(--border-subtle);
    }

    .nav.open {
        max-height: 400px;
        opacity: 1;
        margin-top: 0.5rem;
        padding-top: 0.5rem;
        border-top: 1px solid var(--border-subtle);
    }

    .nav-link { justify-content: flex-start; }
}