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

:root {
    --black: #111;
    --white: #fff;
    --gray: #888;
    --gray-light: #f0f0f0;
    --gray-dark: #333;
    --accent: rgb(5, 21, 51);
    --radius: 8px;
    --red: #F31111;
    --yellow: #FFE500;
    --green: #00C853;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--white);
    color: var(--black);
    min-height: 100vh;
}

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

/* Header */
.header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 0;
    border-bottom: 1px solid var(--gray-light);
    margin-bottom: 20px;
}

.logo {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent);
}

.back-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: var(--radius);
}

.back-btn:hover { background: var(--gray-light); }

/* Search */
.search-bar {
    margin-bottom: 16px;
}

.search-bar input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--gray-light);
    border-radius: var(--radius);
    font-size: 15px;
    font-family: inherit;
    outline: none;
}

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

/* Tags */
.tags-bar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 12px;
    margin-bottom: 20px;
    -webkit-overflow-scrolling: touch;
}

.tags-bar::-webkit-scrollbar { display: none; }

.tag-chip {
    padding: 8px 16px;
    border: 1px solid var(--gray-light);
    border-radius: 20px;
    background: var(--white);
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
}

.tag-chip.active {
    background: var(--black);
    color: var(--white);
    border-color: var(--black);
}

.tag-chip:hover:not(.active) {
    background: var(--gray-light);
}

/* Video Grid */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding-bottom: 40px;
}

.video-card {
    cursor: pointer;
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 0.2s;
}

.video-card:hover {
    transform: translateY(-2px);
}

.video-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: var(--black);
    overflow: hidden;
}

.video-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-dark);
}

.thumb-placeholder.small {
    width: 120px;
    height: 68px;
}

.duration {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(0,0,0,0.8);
    color: white;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 4px;
}

.video-lock-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    border-radius: inherit;
    pointer-events: none;
}

.video-info {
    padding: 10px 0;
}

.video-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-meta {
    display: flex;
    gap: 12px;
    font-size: 13px;
    color: var(--gray);
    margin-bottom: 6px;
}

.video-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.tag-badge {
    font-size: 11px;
    padding: 3px 8px;
    background: var(--gray-light);
    border-radius: 10px;
    color: var(--gray-dark);
}

.tag-badge.clickable {
    cursor: pointer;
}

.tag-badge.clickable:hover {
    background: var(--black);
    color: var(--white);
}

/* Like button */
.like-section { display: flex; align-items: center; margin: 6px 0; }
.like-btn { display: flex; align-items: center; gap: 6px; background: none; border: none;
            cursor: pointer; font-size: 14px; color: #888; padding: 4px 8px;
            border-radius: 20px; transition: all 0.2s; font-family: inherit; }
.like-btn:hover { background: #fff8e1; }
.like-btn.liked { color: var(--red); }
.like-count { font-weight: 600; }

/* Share button (card) */
.share-btn-card { background: none; border: none; cursor: pointer; color: #888;
                  font-size: 13px; padding: 4px 8px; border-radius: 6px; font-family: inherit; }
.share-btn-card:hover { background: var(--gray-light); color: var(--black); }

/* Share menu overlay */
.share-menu-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5);
                      z-index: 9998; display: flex; align-items: center;
                      justify-content: center; animation: fadeIn 0.2s ease; }
.share-menu { width: 90%; max-width: 320px; background: white; border-radius: 16px;
              overflow: hidden; animation: scaleIn 0.2s ease; }
.share-menu-header { display: flex; justify-content: space-between; align-items: center;
                     padding: 16px 20px; border-bottom: 1px solid var(--gray-light); }
.share-menu-close { width: 32px; height: 32px; background: none; border: none;
                    font-size: 24px; cursor: pointer; color: var(--gray); }
.share-menu-options { padding: 8px 0; }
.share-option { display: flex; align-items: center; gap: 16px; width: 100%;
                padding: 14px 20px; background: none; border: none;
                font-size: 15px; font-family: inherit; cursor: pointer; text-align: left; }
.share-option:hover { background: var(--gray-light); }
.share-option-icon { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; }
.share-option-text { font-weight: 500; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.empty-msg {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--gray);
    padding: 60px 0;
    font-size: 16px;
}

/* Player */
.player-wrapper {
    width: 100%;
    max-width: 900px;
    margin: 0 auto 20px;
}

.player-wrapper video {
    width: 100%;
    border-radius: var(--radius);
    background: var(--black);
}

.video-details {
    max-width: 900px;
    margin: 0 auto;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--gray-light);
    margin-bottom: 30px;
}

.video-detail-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
}

.video-description {
    color: var(--gray-dark);
    font-size: 15px;
    line-height: 1.5;
    margin-top: 12px;
}

/* Related */
.related-section {
    max-width: 900px;
    margin: 0 auto;
    padding-bottom: 40px;
}

.related-section h3 {
    font-size: 18px;
    margin-bottom: 16px;
}

.related-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.related-card {
    display: flex;
    gap: 12px;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius);
}

.related-card:hover {
    background: var(--gray-light);
}

.related-thumb {
    width: 120px;
    height: 68px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--gray-dark);
}

.related-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.related-info { flex: 1; min-width: 0; }

.related-title {
    font-size: 14px;
    font-weight: 600;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.related-meta {
    font-size: 12px;
    color: var(--gray);
    margin-top: 4px;
}

/* Landing Page */
.landing {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgb(5, 21, 51);
    color: var(--white);
}

.landing-hero {
    text-align: center;
    padding: 40px;
}

.landing-logo-img {
    width: 320px;
    max-width: 80vw;
    height: auto;
    margin-bottom: 24px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.header-logo-img {
    height: 30px;
    width: auto;
}

.landing-tagline {
    font-size: 20px;
    opacity: 0.9;
    margin-bottom: 40px;
}

.landing-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
}

.btn-landing-primary {
    padding: 14px 32px;
    background: var(--white);
    color: var(--accent);
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-landing-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.btn-landing-secondary {
    padding: 14px 32px;
    background: transparent;
    color: var(--white);
    border: 2px solid var(--white);
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
}

.btn-landing-secondary:hover {
    background: rgba(255,255,255,0.15);
}

/* Auth Screens */
.auth-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-light);
}

.auth-box {
    background: var(--white);
    padding: 40px;
    border-radius: var(--radius);
    width: 100%;
    max-width: 400px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.auth-title {
    text-align: center;
    color: var(--accent);
    margin-bottom: 24px;
    font-size: 24px;
}

.auth-subtitle {
    text-align: center;
    font-size: 14px;
    color: var(--gray);
    margin-bottom: 20px;
    line-height: 1.5;
}

.auth-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: var(--radius);
    font-size: 15px;
    font-family: inherit;
    outline: none;
    margin-bottom: 12px;
}

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

.auth-msg {
    padding: 12px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
}

.auth-msg.error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.auth-msg.success {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

.auth-link {
    text-align: center;
    font-size: 14px;
    color: var(--gray);
    margin-top: 12px;
}

.auth-link a {
    color: var(--accent);
    text-decoration: none;
}

.auth-link a:hover {
    text-decoration: underline;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}

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

.btn-primary:hover {
    opacity: 0.9;
}

.btn-full {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    font-weight: 600;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

.btn-outline {
    background: transparent;
    color: var(--gray);
    border: 1px solid #ddd;
}

.btn-outline:hover {
    background: var(--gray-light);
}

/* Header right */
.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.user-name {
    font-size: 14px;
    color: var(--gray);
}

.user-name-premium {
    padding: 3px 10px;
    border-radius: 12px;
    background: linear-gradient(white, white) padding-box,
                linear-gradient(135deg, #f5a623, #f0d000) border-box;
    border: 2px solid transparent;
    color: #a06000;
    font-weight: 600;
}

/* ===== APP LAYOUT (sidebar + main) ===== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.filter-sidebar {
    width: 260px;
    min-width: 260px;
    background: #f8f8f8;
    border-right: 1px solid #eee;
    overflow-y: auto;
    transition: width 0.2s ease, min-width 0.2s ease;
    flex-shrink: 0;
}

.filter-sidebar.collapsed {
    width: 0;
    min-width: 0;
    overflow: hidden;
    border-right: none;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    font-weight: 700;
    font-size: 15px;
    border-bottom: 1px solid #eee;
}

.sidebar-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: var(--gray);
    padding: 4px 6px;
    border-radius: 4px;
    line-height: 1;
}

.sidebar-close:hover { background: #eee; }

.sidebar-toggle-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    color: var(--gray-dark);
    line-height: 1;
}

.sidebar-toggle-btn:hover { background: var(--gray-light); }

/* Filter sections / accordion */
.filter-section {
    border-bottom: 1px solid #eee;
}

.filter-toggle {
    width: 100%;
    text-align: left;
    padding: 12px 20px;
    background: none;
    border: none;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: inherit;
    color: var(--black);
}

.filter-toggle:hover { background: #f0f0f0; }

.filter-toggle .chevron {
    font-size: 11px;
    transition: transform 0.2s;
    color: var(--gray);
}

.filter-toggle.open .chevron {
    transform: rotate(0deg);
}

.filter-toggle:not(.open) .chevron {
    transform: rotate(-90deg);
}

.filter-list {
    padding: 4px 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-list.collapsed {
    display: none;
}

.filter-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    line-height: 1.4;
}

.filter-item input[type="checkbox"] {
    flex-shrink: 0;
    accent-color: var(--accent);
}

.filter-count {
    color: #888;
    font-size: 12px;
    margin-left: auto;
    flex-shrink: 0;
}

.filter-empty {
    font-size: 13px;
    color: var(--gray);
    font-style: italic;
}

/* Main content area */
.app-layout .main-content {
    flex: 1;
    min-width: 0;
    overflow-x: hidden;
}

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

/* Tablet */
@media (max-width: 768px) {
    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 16px;
    }
    .player-wrapper, .video-details, .related-section {
        max-width: 100%;
    }
}

/* Teléfonos medianos: auth card con bordes */
@media (min-width: 420px) and (max-width: 600px) {
    .auth-box {
        border-radius: 12px;
        box-shadow: 0 4px 24px rgba(0,0,0,0.12);
        max-width: 380px;
        padding: 28px 24px;
    }
    .auth-screen {
        align-items: center;
        padding: 0;
    }
}

/* Móvil principal */
@media (max-width: 600px) {
    /* --- Sidebar overlay --- */
    .filter-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 85vw;
        height: 100%;
        z-index: 200;
        box-shadow: 4px 0 20px rgba(0,0,0,0.15);
        overflow-y: auto;
    }
    .filter-sidebar.collapsed {
        width: 0;
        min-width: 0;
        overflow: hidden;
    }
    .app-layout .main-content {
        width: 100%;
        position: relative;
    }
    .filter-sidebar:not(.collapsed) ~ .main-content::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: 199;
    }

    /* --- Header --- */
    .header {
        padding: 12px 0;
        gap: 8px;
    }
    .header-logo-img {
        height: 24px;
    }
    .header-right {
        gap: 8px;
    }
    .user-name {
        font-size: 12px;
        max-width: 80px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .btn-sm {
        padding: 8px 10px;
        font-size: 12px;
    }

    /* --- Landing --- */
    .landing-hero {
        padding: 24px 20px;
    }
    .landing-tagline {
        font-size: 16px;
        margin-bottom: 28px;
    }
    .landing-actions {
        flex-direction: column;
    }
    .btn-landing-primary, .btn-landing-secondary {
        padding: 12px 24px;
        font-size: 15px;
        width: 100%;
        max-width: 280px;
    }
    .landing-logo-img {
        width: 220px;
        margin-bottom: 16px;
    }

    /* --- Auth screens --- */
    .auth-box {
        padding: 24px 20px;
        border-radius: 0;
        box-shadow: none;
        max-width: 100%;
    }
    .auth-title {
        font-size: 20px;
        margin-bottom: 16px;
    }
    .auth-screen {
        align-items: flex-start;
        padding: 16px 0;
    }

    /* --- Container & grid --- */
    .container {
        padding: 0 12px;
    }
    .video-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        padding-bottom: 24px;
    }
    .video-detail-title {
        font-size: 18px;
    }

    /* --- Player --- */
    .video-details {
        padding-bottom: 16px;
        margin-bottom: 16px;
    }
    .related-thumb {
        width: 100px;
        height: 56px;
    }
    .related-title {
        font-size: 13px;
    }
    .related-section h3 {
        font-size: 16px;
    }

    /* --- Touch targets (44px min) --- */
    .tag-chip {
        padding: 10px 14px;
        min-height: 44px;
    }
    .sidebar-close {
        min-height: 44px;
        min-width: 44px;
    }
    .sidebar-toggle-btn, .back-btn {
        min-height: 44px;
    }
}

/* Teléfonos muy pequeños */
@media (max-width: 360px) {
    .container {
        padding: 0 8px;
    }
}

/* --- Subscription Tier --- */

.btn-premium-cta {
    background: linear-gradient(135deg, #f5a623 0%, #f0d000 100%);
    color: #333;
    border: none;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 0.85em;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.btn-premium-cta:hover {
    background: linear-gradient(135deg, #e09010 0%, #d4b800 100%);
}

.free-tier-banner {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 0.9em;
    color: #78350f;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.free-tier-banner a { color: #92400e; font-weight: 600; }

.quota-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.quota-dots { display: flex; gap: 6px; }

.quota-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #d1d5db;
    border: 2px solid #9ca3af;
    transition: background 0.2s;
}

.quota-dot.used {
    background: #f59e0b;
    border-color: #d97706;
}

.quota-text { font-size: 0.88em; }
.quota-upgrade { font-size: 0.88em; }

/* Dual-range slider */
.range-labels { display:flex; justify-content:space-between; font-size:12px; color:#555; margin-bottom:6px; }
.dual-range { position:relative; height:20px; margin: 4px 0 8px; }
.dual-range-track { position:absolute; top:50%; transform:translateY(-50%); width:100%; height:4px; background:#ddd; border-radius:2px; }
.dual-range-fill { position:absolute; height:100%; background:rgb(5, 21, 51); border-radius:2px; }
.range-input { position:absolute; width:100%; height:4px; background:transparent; appearance:none; pointer-events:none; top:50%; transform:translateY(-50%); margin:0; }
.range-input::-webkit-slider-thumb { appearance:none; width:16px; height:16px; border-radius:50%; background:rgb(5, 21, 51); cursor:pointer; pointer-events:all; border:2px solid #fff; box-shadow:0 1px 3px rgba(0,0,0,.3); }
.range-input::-moz-range-thumb { width:16px; height:16px; border-radius:50%; background:rgb(5, 21, 51); cursor:pointer; pointer-events:all; border:2px solid #fff; box-shadow:0 1px 3px rgba(0,0,0,.3); border-radius:50%; }

/* Apply filters button */
.sidebar-apply {
    position: sticky;
    bottom: 0;
    padding: 12px 0 8px;
    background: #fff;
    border-top: 1px solid var(--gray-light);
    margin-top: 8px;
}
.btn-apply-filters {
    width: 100%;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-apply-filters:hover { background: #c1121f; }
