/* ===== Vibe Harmony - Gallery First Design ===== */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&family=Inter:wght@400;500;600&display=swap');

:root {
    --brand-primary: #8b5cf6;
    --brand-secondary: #ec4899;
    --gradient-primary: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
    --bg-main: #0f172a;
    --bg-surface: #1e293b;
    --bg-elevated: #334155;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-glass: rgba(255, 255, 255, 0.08);
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
    --shadow-glow: 0 0 20px rgba(139, 92, 246, 0.3);
}

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

body {
    background: var(--bg-main);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
}

h1, h2, h3, button { font-family: 'Outfit', sans-serif; }

/* Ambient */
.ambient-glow {
    position: fixed;
    top: -20%; left: -10%;
    width: 50vw; height: 50vw;
    background: radial-gradient(circle, rgba(139,92,246,0.12) 0%, transparent 70%);
    filter: blur(80px);
    z-index: -1;
    pointer-events: none;
}
.ambient-glow-2 {
    position: fixed;
    bottom: -20%; right: -10%;
    width: 60vw; height: 60vw;
    background: radial-gradient(circle, rgba(236,72,153,0.08) 0%, transparent 70%);
    filter: blur(100px);
    z-index: -1;
    pointer-events: none;
}

/* ==================== HEADER ==================== */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-glass);
    padding: 0.75rem 1.5rem;
}

.header-inner {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.logo-icon {
    width: 36px; height: 36px;
    background: var(--gradient-primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: var(--shadow-glow);
}

.logo-text {
    font-size: 1.3rem;
    font-weight: 700;
    background: linear-gradient(to right, #fff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Nav Pills */
.nav-pills {
    display: flex;
    background: rgba(30, 41, 59, 0.5);
    padding: 0.2rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-glass);
}

.nav-pill {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-pill:hover { color: var(--text-main); background: rgba(255,255,255,0.05); }
.nav-pill.active { background: var(--bg-elevated); color: var(--text-main); }

/* ==================== MAIN CONTENT ==================== */
.main-content {
    max-width: 1600px;
    margin: 0 auto;
    padding: 1rem 1.5rem 2rem;
}

/* Controls Bar */
.controls-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.search-wrapper {
    position: relative;
    flex: 1;
    min-width: 150px;
    max-width: 300px;
}

.search-input {
    width: 100%;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid var(--border-glass);
    padding: 0.6rem 1rem 0.6rem 2.5rem;
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-size: 0.9rem;
}

.search-input:focus {
    outline: none;
    border-color: var(--brand-primary);
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 16px; height: 16px;
    pointer-events: none;
}

.controls-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.btn {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid var(--border-glass);
    color: var(--text-main);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.2s ease;
}

.btn:hover { background: var(--bg-elevated); }
.btn-primary { background: var(--gradient-primary); border: none; }
.btn-primary:hover { filter: brightness(1.1); }
.btn-sm { padding: 0.4rem 0.6rem; font-size: 0.75rem; }

.count-badge {
    background: rgba(139, 92, 246, 0.2);
    color: var(--brand-primary);
    padding: 0.4rem 0.7rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 700;
}

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

.video-grid.wall-mode {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 6px;
}

.video-card {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    background: var(--bg-surface);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    min-height: 100px; /* Ensure visibility */
}

.video-card:hover {
    transform: scale(1.03);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    z-index: 5;
}

/* THUMBNAIL - Fixed to show full image immediately */
.thumb-img {
    display: block;
    width: 100%;
    aspect-ratio: 9 / 16;
    object-fit: cover;
    background: #000;
}

.card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 40%);
    opacity: 0;
    transition: opacity 0.2s ease;
    display: flex;
    align-items: flex-end;
    padding: 0.75rem;
}

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

.card-date {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.8);
}

/* ==================== VIDEO VIEW ==================== */
#videoView {
    min-height: 100vh;
}

.video-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-glass);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(255,255,255,0.1);
    border: none;
    color: var(--text-main);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: background 0.2s ease;
    text-decoration: none;
}

.back-btn:hover { background: rgba(255,255,255,0.2); }

.video-meta-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.account-tag {
    background: rgba(139, 92, 246, 0.2);
    color: var(--brand-primary);
    padding: 0.3rem 0.7rem;
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 600;
}

.video-date {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.video-id {
    color: var(--text-dim);
    font-size: 0.75rem;
    font-family: monospace;
    background: rgba(0,0,0,0.3);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
}

.video-actions-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
}

.autoplay-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Toggle Switch */
.switch {
    position: relative;
    width: 36px; height: 20px;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: rgba(255,255,255,0.2);
    border-radius: 20px;
    transition: 0.3s;
}

.slider:before {
    content: "";
    position: absolute;
    height: 14px; width: 14px;
    left: 3px; bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}

input:checked + .slider { background: var(--brand-primary); }
input:checked + .slider:before { transform: translateX(16px); }

/* Video Container */
.video-container {
    position: relative;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: 70vh;
}

.video-container video {
    width: 100%;
    max-height: 70vh;
    display: block;
}

.nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px; height: 48px;
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 10;
}

.video-container:hover .nav-arrow { opacity: 1; }
.nav-arrow:hover { background: var(--brand-primary); transform: translateY(-50%) scale(1.1); }
.nav-arrow.prev { left: 1rem; }
.nav-arrow.next { right: 1rem; }

/* Video Details */
.video-details {
    max-width: 800px;
    margin: 0 auto;
    padding: 1.5rem;
}

.detail-section {
    margin-bottom: 1.5rem;
}

.section-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.section-label svg { width: 14px; height: 14px; }

.description-text {
    background: rgba(0,0,0,0.2);
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-glass);
    line-height: 1.6;
    font-size: 0.9rem;
}

/* Comments */
.comments-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.comment {
    background: rgba(0,0,0,0.2);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    border: 1px solid var(--border-glass);
}

.comment.own-comment {
    background: rgba(139, 92, 246, 0.1);
    border-color: rgba(139, 92, 246, 0.3);
}

.comment-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
}

.comment-author { font-weight: 600; color: var(--text-main); }
.comment-text { font-size: 0.85rem; line-height: 1.4; }

.comment-form {
    display: flex;
    gap: 0.5rem;
}

.comment-input {
    flex: 1;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border-glass);
    padding: 0.6rem 0.8rem;
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: 0.85rem;
    resize: none;
    height: 40px;
}

.comment-input:focus {
    outline: none;
    border-color: var(--brand-primary);
    height: 70px;
}

.send-btn {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--gradient-primary);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.send-btn:hover { transform: scale(1.1); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 10px; }

/* Responsive */
.mobile-only { display: none; }
.desktop-only { display: flex; }

.mobile-nav-wrapper { position: relative; }

.mobile-select {
    width: 100%;
    appearance: none;
    background: var(--bg-elevated);
    border: 1px solid var(--border-glass);
    color: var(--text-main);
    padding: 0.6rem 2rem 0.6rem 0.8rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

.select-icon {
    position: absolute;
    right: 0.6rem; top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--text-muted);
    width: 16px; height: 16px;
}

@media (max-width: 768px) {
    .desktop-only { display: none; }
    .mobile-only { display: block; }
    
    .header { padding: 0.5rem 1rem; }
    .header-inner { flex-wrap: wrap; }
    
    .logo-text { font-size: 1.1rem; }
    
    .main-content { padding: 0.75rem; }
    
    .controls-bar { gap: 0.5rem; }
    .search-wrapper { max-width: none; min-width: 100%; order: -1; }
    
    .btn-label { display: none; }
    
    .video-grid.wall-mode {
        grid-template-columns: repeat(4, 1fr);
        gap: 3px;
    }
    
    .video-header {
        padding: 0.5rem 1rem;
        gap: 0.5rem;
    }
    
    .back-btn span { display: none; }
    
    .video-details { padding: 1rem; }
    
    .nav-arrow { opacity: 0.7; width: 40px; height: 40px; }
}

@media (max-width: 480px) {
    .video-grid.wall-mode {
        grid-template-columns: repeat(3, 1fr);
    }
}
