/* ============================================================
   FreeAVPlay Design System
   Theme: Blue-Purple gradient (#1a8cff → #7c3aed)
   Layout: Top navigation + Footer (no sidebar)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a28;
    --bg-card-hover: #22223a;
    --border-color: #2a2a40;
    --text-primary: #f0f0f5;
    --text-secondary: #8888a0;
    --accent: #1a8cff;
    --accent-purple: #7c3aed;
    --accent-gradient: linear-gradient(135deg, #1a8cff, #7c3aed);
    --accent-glow: rgba(26, 140, 255, 0.15);
    --header-height: 64px;
    --max-width: 1400px;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: inherit; text-decoration: none; }

/* ============================================================
   TOP HEADER / NAVIGATION
   ============================================================ */
.top-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 10, 15, 0.92);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    height: var(--header-height);
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    height: 100%;
    gap: 20px;
}

.logo-link {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.logo-link img {
    height: 32px;
    width: auto;
}

/* Desktop Nav */
.nav-menu {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
    flex-wrap: wrap;
}
.nav-menu::-webkit-scrollbar { display: none; }

.nav-item {
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: 8px;
    transition: all 0.2s;
    white-space: nowrap;
}

.nav-item:hover {
    color: var(--text-primary);
    background: var(--accent-glow);
}

.nav-item.active {
    color: #fff;
    background: var(--accent-gradient);
}

.nav-divider {
    width: 1px;
    height: 20px;
    background: var(--border-color);
    margin: 0 6px;
    flex-shrink: 0;
}

/* Category dropdown */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-btn {
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    border-radius: 8px;
    transition: all 0.2s;
    white-space: nowrap;
}

.nav-dropdown-btn:hover {
    color: var(--text-primary);
    background: var(--accent-glow);
}

.nav-dropdown-btn svg {
    width: 12px;
    height: 12px;
    transition: transform 0.2s;
}

.nav-dropdown:hover .nav-dropdown-btn svg {
    transform: rotate(180deg);
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 8px;
    min-width: 180px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    z-index: 200;
}

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

.nav-dropdown-menu a {
    display: block;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text-secondary);
    border-radius: 6px;
    transition: all 0.15s;
}

.nav-dropdown-menu a:hover {
    color: #fff;
    background: var(--accent-glow);
}

.nav-dropdown-menu .menu-label {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--accent);
    font-weight: 700;
    padding: 8px 12px 4px;
    letter-spacing: 0.5px;
}

/* Header actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    margin-left: auto;
}

.search-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
}

.search-toggle:hover {
    color: var(--text-primary);
    background: var(--accent-glow);
}

.search-toggle svg {
    width: 20px;
    height: 20px;
}

/* Search overlay */
.search-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(10px);
    z-index: 300;
    justify-content: center;
    padding-top: 20vh;
}

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

.search-box {
    width: 90%;
    max-width: 600px;
}

.search-box form {
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 18px 24px;
    padding-right: 50px;
    background: var(--bg-secondary);
    border: 2px solid var(--accent);
    color: #fff;
    font-size: 18px;
    border-radius: 16px;
    outline: none;
    font-family: 'Inter', sans-serif;
}

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

.search-close {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 24px;
}

/* Mobile menu button */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
}

.mobile-menu-btn svg {
    width: 24px;
    height: 24px;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
    flex: 1;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 20px;
    width: 100%;
}

/* Page headers */
.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 1.6em;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 0.9em;
    margin-top: 4px;
}

/* Sort bar */
.sort-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.sort-btn {
    padding: 6px 16px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    background: var(--bg-card);
    color: var(--text-secondary);
    transition: all 0.2s;
    border: 1px solid transparent;
}

.sort-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-color);
}

.sort-btn.active {
    background: var(--accent-gradient);
    color: #fff;
}

/* ============================================================
   VIDEO GRID
   ============================================================ */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.video-card {
    background: var(--bg-card);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.25s ease;
    border: 1px solid transparent;
}

.video-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
    box-shadow: 0 8px 30px var(--accent-glow);
}

.video-thumb-wrap {
    position: relative;
    padding-top: 56.25%;
    overflow: hidden;
    background: #111;
}

.video-thumb-wrap img {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

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

.video-meta {
    padding: 10px 12px;
}

.video-title {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--text-primary);
}

.video-info {
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-secondary);
    display: flex;
    gap: 10px;
}

/* ============================================================
   VIDEO DETAIL PAGE
   ============================================================ */
.video-page-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 24px;
}

.video-main-col { min-width: 0; }

.player-container {
    position: relative;
    padding-top: 56.25%;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 16px;
}

.player-container iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.video-details h1 {
    font-size: 1.3em;
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.3;
}

.video-stats {
    display: flex;
    gap: 15px;
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 16px;
}

/* Movie Info Card */
.movie-info-card {
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
    overflow: hidden;
}

.movie-info-header {
    padding: 14px 18px;
    font-weight: 600;
    font-size: 14px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, rgba(26,140,255,0.08), rgba(124,58,237,0.08));
}

.movie-info-body {
    padding: 6px 18px;
}

.movie-info-row {
    display: flex;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    font-size: 13px;
}

.movie-info-row:last-child { border-bottom: none; }

.info-label {
    width: 100px;
    flex-shrink: 0;
    color: var(--text-secondary);
    font-weight: 500;
}

.info-value {
    flex: 1;
    color: var(--text-primary);
}

.info-link {
    color: var(--accent);
    margin-right: 8px;
    transition: color 0.2s;
}

.info-link:hover {
    color: var(--accent-purple);
}

.code-badge {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

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

.tag {
    padding: 3px 10px;
    background: rgba(26,140,255,0.1);
    border: 1px solid rgba(26,140,255,0.2);
    border-radius: 20px;
    font-size: 12px;
    color: var(--accent);
    transition: all 0.2s;
}

.tag:hover {
    background: rgba(26,140,255,0.2);
    border-color: var(--accent);
}

/* Related & Popular */
.related-section {
    margin-top: 24px;
}

.section-title {
    font-size: 1.1em;
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--accent);
    display: inline-block;
}

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

/* Popular Sidebar */
.popular-sidebar {
    position: sticky;
    top: calc(var(--header-height) + 20px);
    align-self: start;
}

.sidebar-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--accent-purple);
}

.popular-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.popular-item {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s;
}

.popular-item:hover {
    background: var(--bg-card);
}

.popular-rank {
    font-size: 14px;
    font-weight: 800;
    color: var(--accent);
    min-width: 20px;
    text-align: center;
}

.popular-thumb {
    width: 80px;
    height: 45px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
}

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

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

.popular-title {
    font-size: 12px;
    font-weight: 500;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.popular-views {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
    text-align: center;
    margin: 30px 0;
    display: flex;
    justify-content: center;
    gap: 5px;
    flex-wrap: wrap;
}

.page-btn {
    padding: 8px 14px;
    background: var(--bg-card);
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.page-btn:hover {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.page-btn.active {
    background: var(--accent-gradient);
    color: #fff;
    font-weight: 700;
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    margin-top: 40px;
    padding: 32px 20px;
}

.footer-inner {
    max-width: var(--max-width);
    margin: 0 auto;
}

.footer-top {
    display: flex;
    justify-content: space-between;
    gap: 40px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.footer-brand img {
    height: 28px;
    margin-bottom: 10px;
}

.footer-brand p {
    font-size: 12px;
    color: var(--text-secondary);
    max-width: 300px;
    line-height: 1.6;
}

.footer-links {
    display: flex;
    gap: 40px;
    flex-wrap: wrap;
}

.footer-col h4 {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--accent);
    font-weight: 700;
    margin-bottom: 10px;
    letter-spacing: 0.5px;
}

.footer-col a {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    padding: 3px 0;
    transition: color 0.2s;
}

.footer-col a:hover { color: var(--text-primary); }

.footer-bottom {
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.footer-legal {
    display: flex;
    gap: 20px;
    margin-top: 8px;
    flex-wrap: wrap;
}

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

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

.age-badge {
    display: inline-block;
    background: linear-gradient(135deg, #e50914, #ff4444);
    color: #fff;
    font-weight: 700;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    margin-right: 6px;
}

/* ============================================================
   AD BOXES
   ============================================================ */
.ad-box { margin-bottom: 12px; }
.ad-pc { display: block; text-align: center; margin-bottom: 16px; }
.ad-mobile { display: none; text-align: center; margin-bottom: 10px; }

/* ============================================================
   MOBILE SIDEBAR OVERLAY (for mobile menu)
   ============================================================ */
.mobile-nav-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    z-index: 150;
}

.mobile-nav-overlay.active { display: block; }

.mobile-nav-panel {
    position: fixed;
    top: 0;
    right: -300px;
    width: 280px;
    height: 100%;
    background: var(--bg-secondary);
    z-index: 200;
    transition: right 0.3s ease;
    overflow-y: auto;
    padding: 20px;
}

.mobile-nav-panel.open { right: 0; }

.mobile-nav-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    float: right;
    padding: 5px;
}

.mobile-nav-panel .mobile-nav-links {
    margin-top: 40px;
}

.mobile-nav-panel .mobile-nav-links a {
    display: block;
    padding: 10px 0;
    font-size: 14px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    transition: color 0.2s;
}

.mobile-nav-panel .mobile-nav-links a:hover,
.mobile-nav-panel .mobile-nav-links a.active {
    color: var(--accent);
}

.mobile-nav-panel .mobile-nav-links .menu-label {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--accent);
    font-weight: 700;
    padding-top: 14px;
    letter-spacing: 0.5px;
    border: none;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
    .video-page-layout {
        grid-template-columns: 1fr;
    }
    .popular-sidebar {
        position: static;
    }
}

@media (max-width: 768px) {
    .nav-menu { display: none; }
    .mobile-menu-btn { display: block; }
    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 10px;
    }
    .related-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
    .header-inner { padding: 0 12px; }
    .main-content { padding: 12px; }
    .footer-top { flex-direction: column; gap: 20px; }
}

@media (max-width: 500px) {
    .ad-pc { display: none; }
    .ad-mobile { display: block; }
    .video-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .video-meta { padding: 8px; }
    .video-title { font-size: 12px; }
}
