/* ===== CSS Variables ===== */
:root {
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-card: #1e1e1e;
    --bg-hover: #252525;
    --bg-input: #2a2a2a;
    --border: #333;
    --border-light: #444;
    --text-primary: #f0f0f0;
    --text-secondary: #a0a0a0;
    --text-muted: #666;
    --accent: #6C63FF;
    --accent-hover: #5a52e0;
    --accent-light: rgba(108, 99, 255, 0.15);
    --danger: #e74c3c;
    --danger-hover: #c0392b;
    --success: #2ecc71;
    --warning: #f39c12;
    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 16px;
    --shadow: 0 4px 20px rgba(0,0,0,0.4);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
    --transition: 0.2s ease;
    --header-height: 64px;
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }
img, video { max-width: 100%; display: block; }
ul { list-style: none; }
button { cursor: pointer; font-family: inherit; }

/* ===== Layout ===== */
.container { max-width: 1280px; margin: 0 auto; padding: 0 20px; }
.main-content { flex: 1; padding-top: var(--header-height); }

/* ===== Header ===== */
.site-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--header-height);
    background: rgba(15,15,15,0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
}
.header-inner {
    display: flex;
    align-items: center;
    gap: 24px;
    height: var(--header-height);
}
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.2rem;
    flex-shrink: 0;
}
.logo:hover { color: var(--accent); }
.main-nav {
    display: flex;
    gap: 4px;
    flex: 1;
}
.main-nav a {
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition);
}
.main-nav a:hover { color: var(--text-primary); background: var(--bg-hover); }
.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    padding: 6px;
    margin-left: auto;
}
.mobile-menu-btn span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all var(--transition);
}
.mobile-nav {
    display: none;
    flex-direction: column;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 12px 20px;
    gap: 4px;
}
.mobile-nav.open { display: flex; }
.mobile-nav a {
    color: var(--text-secondary);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-weight: 500;
}
.mobile-nav a:hover { color: var(--text-primary); background: var(--bg-hover); }

/* ===== User Menu ===== */
.user-menu { position: relative; }
.user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition);
}
.user-btn:hover { border-color: var(--accent); background: var(--bg-hover); }
.avatar {
    width: 28px;
    height: 28px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
}
.user-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-width: 160px;
    box-shadow: var(--shadow);
    overflow: hidden;
    z-index: 100;
}
.user-dropdown.open { display: block; }
.user-dropdown a {
    display: block;
    padding: 10px 16px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    transition: all var(--transition);
}
.user-dropdown a:hover { color: var(--text-primary); background: var(--bg-hover); }
.user-dropdown hr { border: none; border-top: 1px solid var(--border); margin: 4px 0; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    transition: all var(--transition);
    cursor: pointer;
    white-space: nowrap;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); color: white; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(108,99,255,0.4); }
.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text-primary); border-color: var(--border-light); background: var(--bg-hover); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: var(--danger-hover); color: white; }
.btn-sm { padding: 5px 12px; font-size: 0.8rem; }
.btn-lg { padding: 12px 28px; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }

/* ===== Forms ===== */
.form-group { margin-bottom: 20px; }
.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}
.form-control {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color var(--transition);
    outline: none;
}
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.form-control::placeholder { color: var(--text-muted); }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.form-hint { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 0.8rem; color: var(--danger); margin-top: 4px; }

/* ===== Alerts ===== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 0.9rem;
    border-left: 4px solid;
}
.alert-error { background: rgba(231,76,60,0.1); border-color: var(--danger); color: #ff6b6b; }
.alert-success { background: rgba(46,204,113,0.1); border-color: var(--success); color: #5dde8e; }
.alert-info { background: rgba(108,99,255,0.1); border-color: var(--accent); color: #9d97ff; }

/* ===== Cards ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all var(--transition);
}
.card:hover { border-color: var(--border-light); transform: translateY(-2px); box-shadow: var(--shadow); }
.card-body { padding: 20px; }

/* ===== Video Grid ===== */
.section { padding: 40px 0; }
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
}
.section-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
}
.section-title span { color: var(--accent); }
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}
.video-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all var(--transition);
    cursor: pointer;
}
.video-card:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: 0 8px 30px rgba(108,99,255,0.2); }
.video-thumb {
    position: relative;
    aspect-ratio: 16/9;
    background: var(--bg-secondary);
    overflow: hidden;
}
.video-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}
.video-card:hover .video-thumb img { transform: scale(1.05); }
.play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.3);
    opacity: 0;
    transition: opacity var(--transition);
}
.video-card:hover .play-overlay { opacity: 1; }
.play-btn-icon {
    width: 52px;
    height: 52px;
    background: rgba(108,99,255,0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}
.video-info { padding: 14px; }
.video-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.video-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.8rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}
.video-meta-item { display: flex; align-items: center; gap: 4px; }
.video-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    background: var(--accent-light);
    color: var(--accent);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all var(--transition);
}
.tag:hover { background: var(--accent); color: white; }
.folder-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background: rgba(243,156,18,0.15);
    color: var(--warning);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* ===== Folder Grid ===== */
.folder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}
.folder-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: all var(--transition);
    cursor: pointer;
}
.folder-card:hover { border-color: var(--warning); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(243,156,18,0.15); }
.folder-icon {
    width: 48px;
    height: 48px;
    background: rgba(243,156,18,0.15);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--warning);
}
.folder-name { font-weight: 600; font-size: 1rem; color: var(--text-primary); }
.folder-count { font-size: 0.8rem; color: var(--text-muted); }

/* ===== Hero ===== */
.hero {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    padding: 80px 0 60px;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 50% 50%, rgba(108,99,255,0.1) 0%, transparent 60%);
    animation: pulse 8s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } }
.hero-content { position: relative; z-index: 1; }
.hero h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #fff 0%, #a78bfa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.hero p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 560px;
    margin: 0 auto 32px;
}
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ===== Search ===== */
.search-bar {
    display: flex;
    gap: 10px;
    max-width: 600px;
    margin: 0 auto 40px;
}
.search-bar .form-control { flex: 1; }

/* ===== Page Header ===== */
.page-header {
    padding: 40px 0 24px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 40px;
}
.page-header h1 { font-size: 2rem; font-weight: 700; margin-bottom: 8px; }
.page-header p { color: var(--text-secondary); }
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb-sep { color: var(--text-muted); }

/* ===== Upload ===== */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 60px 40px;
    text-align: center;
    transition: all var(--transition);
    cursor: pointer;
    background: var(--bg-secondary);
}
.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--accent);
    background: var(--accent-light);
}
.upload-zone-icon { color: var(--text-muted); margin-bottom: 16px; }
.upload-zone h3 { font-size: 1.1rem; margin-bottom: 8px; }
.upload-zone p { color: var(--text-muted); font-size: 0.875rem; }
.upload-progress {
    background: var(--bg-input);
    border-radius: 4px;
    height: 6px;
    overflow: hidden;
    margin-top: 12px;
    display: none;
}
.upload-progress-bar {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

/* ===== Video Player Page ===== */
.video-player-wrap {
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 16/9;
    width: 100%;
}
.video-player-wrap video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.video-detail-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 28px;
    align-items: start;
}
.video-detail-title { font-size: 1.5rem; font-weight: 700; margin: 20px 0 8px; }
.video-detail-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--text-muted);
    font-size: 0.875rem;
    flex-wrap: wrap;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}
.video-detail-desc { color: var(--text-secondary); line-height: 1.7; }
.sidebar-title { font-size: 1rem; font-weight: 600; margin-bottom: 16px; color: var(--text-primary); }
.related-video {
    display: flex;
    gap: 12px;
    padding: 10px;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
    cursor: pointer;
}
.related-video:hover { background: var(--bg-hover); }
.related-thumb {
    width: 120px;
    flex-shrink: 0;
    aspect-ratio: 16/9;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-secondary);
}
.related-thumb img { width: 100%; height: 100%; object-fit: cover; }
.related-info { flex: 1; min-width: 0; }
.related-title { font-size: 0.85rem; font-weight: 500; color: var(--text-primary); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.related-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }

/* ===== Auth Pages ===== */
.auth-page {
    min-height: calc(100vh - var(--header-height));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}
.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow);
}
.auth-logo { text-align: center; margin-bottom: 32px; }
.auth-logo svg { margin: 0 auto 12px; }
.auth-logo h1 { font-size: 1.5rem; font-weight: 700; }
.auth-logo p { color: var(--text-muted); font-size: 0.875rem; margin-top: 4px; }
.auth-footer { text-align: center; margin-top: 24px; font-size: 0.875rem; color: var(--text-muted); }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--text-muted); font-size: 0.8rem; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ===== Tags Page ===== */
.tags-cloud { display: flex; flex-wrap: wrap; gap: 10px; }
.tag-large {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition);
}
.tag-large:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
.tag-count { font-size: 0.75rem; color: var(--text-muted); }

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
}
.empty-state svg { margin: 0 auto 20px; opacity: 0.4; }
.empty-state h3 { font-size: 1.2rem; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { font-size: 0.9rem; margin-bottom: 24px; }

/* ===== Pagination ===== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 40px;
    flex-wrap: wrap;
}
.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition);
}
.page-link:hover { border-color: var(--accent); color: var(--accent); }
.page-link.active { background: var(--accent); border-color: var(--accent); color: white; }

/* ===== Stats Bar ===== */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin-bottom: 40px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
}
.stat-value { font-size: 2rem; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

/* ===== Footer ===== */
.site-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 24px 0;
    margin-top: auto;
}
.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}
.footer-logo { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--text-secondary); }
.footer-copy { font-size: 0.8rem; color: var(--text-muted); }
.footer-nav { display: flex; gap: 16px; }
.footer-nav a { font-size: 0.8rem; color: var(--text-muted); }
.footer-nav a:hover { color: var(--accent); }

/* ===== Utilities ===== */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 32px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.flex { display: flex; } .flex-wrap { flex-wrap: wrap; } .gap-2 { gap: 16px; } .items-center { align-items: center; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .video-detail-layout { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .main-nav, .header-actions { display: none; }
    .mobile-menu-btn { display: flex; }
    .site-header { height: auto; min-height: var(--header-height); }
    .header-inner { flex-wrap: wrap; }
    .hero { padding: 60px 0 40px; }
    .grid-2 { grid-template-columns: 1fr; }
    .footer-inner { flex-direction: column; text-align: center; }
    .auth-card { padding: 28px 20px; }
    .video-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
}
@media (max-width: 480px) {
    .video-grid { grid-template-columns: 1fr; }
    .folder-grid { grid-template-columns: 1fr 1fr; }
    .hero h1 { font-size: 1.8rem; }
}
