/* ============================================
   MissAV - Main Stylesheet
   Dark theme, modern video platform design
   ============================================ */

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

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #16161f;
    --bg-card-hover: #1c1c28;
    --bg-surface: #1a1a26;
    --bg-overlay: rgba(0, 0, 0, 0.85);

    --text-primary: #e8e8f0;
    --text-secondary: #9090a8;
    --text-muted: #606078;
    --text-link: #7c8cf8;

    --accent: #6366f1;
    --accent-light: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.25);

    --pink: #ec4899;
    --pink-glow: rgba(236, 72, 153, 0.2);

    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    --border: #222235;
    --border-light: #2a2a40;

    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.6);

    --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display: 'Space Grotesk', 'DM Sans', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);

    --header-h: 64px;
    --sidebar-w: 240px;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

input, select {
    font-family: inherit;
    font-size: inherit;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ---------- Header ---------- */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-h);
    background: rgba(10, 10, 15, 0.92);
    backdrop-filter: blur(20px) saturate(1.5);
    -webkit-backdrop-filter: blur(20px) saturate(1.5);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 20px;
}

.header__logo {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.header__logo span {
    background: linear-gradient(135deg, var(--accent), var(--pink));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header__search {
    flex: 1;
    max-width: 520px;
    position: relative;
}

.header__search input {
    width: 100%;
    height: 40px;
    padding: 0 16px 0 42px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    transition: all var(--transition);
}

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

.header__search input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.header__search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 18px;
    height: 18px;
}

.header__nav {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.header__nav-btn {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition);
    white-space: nowrap;
}

.header__nav-btn:hover,
.header__nav-btn.active {
    color: var(--text-primary);
    background: var(--bg-card);
}

.header__nav-btn.active {
    color: var(--accent-light);
}

/* ---------- Layout ---------- */
.layout {
    display: flex;
    min-height: calc(100vh - var(--header-h));
}

.main {
    flex: 1;
    padding: 24px;
    max-width: 100%;
}

/* ---------- Category Bar ---------- */
.category-bar {
    display: flex;
    gap: 8px;
    padding: 0 0 20px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

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

.category-chip {
    padding: 7px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
}

.category-chip:hover {
    border-color: var(--border-light);
    color: var(--text-primary);
    background: var(--bg-card-hover);
}

.category-chip.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* ---------- Sort Bar ---------- */
.sort-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0 20px;
    gap: 12px;
    flex-wrap: wrap;
}

.sort-bar__title {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
}

.sort-bar__controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.sort-btn {
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
    border: 1px solid transparent;
    transition: all var(--transition);
}

.sort-btn:hover {
    color: var(--text-secondary);
    background: var(--bg-card);
}

.sort-btn.active {
    color: var(--accent-light);
    background: var(--bg-card);
    border-color: var(--border);
}

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

/* ---------- Video Card ---------- */
.video-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    transition: all var(--transition);
    cursor: pointer;
}

.video-card:hover {
    border-color: var(--border-light);
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.video-card:hover .video-card__thumb img {
    transform: scale(1.05);
}

.video-card__thumb {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--bg-secondary);
}

.video-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.video-card__thumb-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 50%);
    opacity: 0;
    transition: opacity var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-card:hover .video-card__thumb-overlay {
    opacity: 1;
}

.video-card__play-btn {
    width: 52px;
    height: 52px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.video-card:hover .video-card__play-btn {
    background: var(--accent);
    transform: scale(1.1);
}

.video-card__play-btn svg {
    width: 22px;
    height: 22px;
    fill: white;
    margin-left: 2px;
}

.video-card__duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    padding: 2px 8px;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #fff;
    font-variant-numeric: tabular-nums;
}

.video-card__hd {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 2px 7px;
    background: var(--accent);
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.video-card__body {
    padding: 12px;
}

.video-card__title {
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.4;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 8px;
    transition: color var(--transition);
}

.video-card:hover .video-card__title {
    color: var(--accent-light);
}

.video-card__meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.video-card__meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.video-card__meta-item svg {
    width: 13px;
    height: 13px;
    opacity: 0.6;
}

/* ---------- Video Modal / Player ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: var(--bg-overlay);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 960px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
    scrollbar-width: thin;
}

.modal__player {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    overflow: hidden;
}

.modal__player iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    transition: all var(--transition);
}

.modal__close:hover {
    background: var(--danger);
    transform: scale(1.1);
}

.modal__info {
    padding: 20px;
}

.modal__title {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 12px;
    line-height: 1.4;
}

.modal__stats {
    display: flex;
    gap: 20px;
    margin-bottom: 16px;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.modal__stat {
    display: flex;
    align-items: center;
    gap: 6px;
}

.modal__stat svg {
    width: 15px;
    height: 15px;
    opacity: 0.7;
}

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

.modal__category-tag {
    padding: 4px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 100px;
    font-size: 0.72rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.modal__category-tag:hover {
    border-color: var(--accent);
    color: var(--accent-light);
}

/* ---------- Loading ---------- */
.loading {
    display: flex;
    justify-content: center;
    padding: 40px;
}

.loading__spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ---------- Load More ---------- */
.load-more {
    display: flex;
    justify-content: center;
    padding: 20px 0 40px;
}

.load-more__btn {
    padding: 12px 40px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: all var(--transition);
}

.load-more__btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
    color: var(--accent-light);
}

.load-more__btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

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

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

.skeleton-card {
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}

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

.skeleton-card__body {
    padding: 12px;
}

.skeleton-card__line {
    height: 14px;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    margin-bottom: 8px;
}

.skeleton-card__line:last-child {
    width: 60%;
    margin-bottom: 0;
}

/* ---------- Footer ---------- */
.footer {
    padding: 30px 24px;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.footer a {
    color: var(--text-secondary);
    transition: color var(--transition);
}

.footer a:hover {
    color: var(--accent-light);
}

/* ---------- Empty State ---------- */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
}

.empty-state__icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    opacity: 0.3;
}

.empty-state__title {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.empty-state__text {
    font-size: 0.9rem;
}

/* ---------- Back to top ---------- */
.back-to-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    box-shadow: var(--shadow);
    z-index: 50;
    opacity: 0;
    transform: translateY(20px);
    transition: all var(--transition);
    pointer-events: none;
}

.back-to-top.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.back-to-top:hover {
    background: var(--accent-light);
    transform: translateY(-3px);
}

/* ---------- Mobile Menu Toggle ---------- */
.menu-toggle {
    display: none;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: all var(--transition);
}

.menu-toggle:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 16px;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 0 16px;
        gap: 12px;
    }

    .header__nav {
        display: none;
    }

    .menu-toggle {
        display: flex;
    }

    .main {
        padding: 16px;
    }

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

    .video-card__body {
        padding: 8px 10px;
    }

    .video-card__title {
        font-size: 0.78rem;
        -webkit-line-clamp: 2;
    }

    .video-card__meta {
        font-size: 0.68rem;
        gap: 8px;
    }

    .category-bar {
        padding: 0 0 16px;
    }

    .modal {
        max-width: 100%;
        margin: 0;
        border-radius: var(--radius);
        max-height: 95vh;
    }

    .modal__player {
        border-radius: var(--radius) var(--radius) 0 0;
    }
}

@media (max-width: 480px) {
    .video-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .header__logo {
        font-size: 1.2rem;
    }

    .header__search input {
        height: 36px;
        font-size: 0.82rem;
    }

    .sort-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

/* ---------- Age gate ---------- */
.age-gate {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.age-gate.hidden {
    display: none;
}

.age-gate__box {
    text-align: center;
    max-width: 420px;
    padding: 40px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.age-gate__icon {
    font-size: 3rem;
    margin-bottom: 20px;
}

.age-gate__title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.age-gate__text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.6;
}

.age-gate__buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.age-gate__btn {
    padding: 12px 32px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.95rem;
    transition: all var(--transition);
}

.age-gate__btn--yes {
    background: var(--accent);
    color: white;
}

.age-gate__btn--yes:hover {
    background: var(--accent-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px var(--accent-glow);
}

.age-gate__btn--no {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.age-gate__btn--no:hover {
    border-color: var(--danger);
    color: var(--danger);
}
