/* VelvetTube HD - Mobile-First Core Web Vitals Optimized CSS */
:root {
    --bg-primary: #0b0c10;
    --bg-secondary: #13151c;
    --bg-card: #191c26;
    --bg-elevated: #222634;
    --border-color: #2a2f42;
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --accent: #e11d48;
    --accent-hover: #f43f5e;
    --accent-soft: rgba(225, 29, 72, 0.14);
    --success: #10b981;
    --warning: #f59e0b;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --container-max: 1400px;
}

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

html {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

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

.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header & Navigation */
.site-header {
    background: rgba(19, 21, 28, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 0;
    flex-wrap: wrap;
}

.brand-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #fff;
}

.brand-badge {
    background: var(--accent);
    color: #fff;
    font-size: 0.75rem;
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-sm);
    font-weight: 700;
    text-transform: uppercase;
}

.search-form {
    flex: 1 1 260px;
    max-width: 480px;
    display: flex;
    position: relative;
}

.search-input {
    width: 100%;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.55rem 2.75rem 0.55rem 0.9rem;
    border-radius: var(--radius-md);
    font-size: 0.92rem;
}

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

.search-btn {
    position: absolute;
    right: 4px;
    top: 4px;
    bottom: 4px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: calc(var(--radius-md) - 3px);
    padding: 0 0.75rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
}

.search-btn:hover {
    background: var(--accent-hover);
}

/* Primary Category Nav (Requirement 5: Newest, Most Viewed, Top Rated, Long Videos) */
.nav-bar {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    overflow-x: auto;
    scrollbar-width: none;
}

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

.nav-list {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    list-style: none;
    padding: 0.5rem 0;
    white-space: nowrap;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.48rem 0.9rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-elevated);
}

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

/* Main Content Layout */
.main-content {
    flex: 1;
    padding: 1.5rem 0 2.5rem;
}

.section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.15rem;
    flex-wrap: wrap;
}

.section-title {
    font-size: clamp(1.2rem, 2.5vw, 1.6rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-subtitle {
    font-size: 0.88rem;
    color: var(--text-secondary);
}

/* Video Grid - Mobile First Responsive */
.video-grid {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 1.15rem;
}

@media (min-width: 500px) {
    .video-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 840px) {
    .video-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 1160px) {
    .video-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.video-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.18s ease, border-color 0.18s ease;
}

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

.thumb-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    overflow: hidden;
}

.thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.25s ease;
}

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

.duration-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.84);
    color: #fff;
    font-size: 0.76rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    font-variant-numeric: tabular-nums;
}

.hd-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: var(--accent);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 800;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    text-transform: uppercase;
}

.card-body {
    padding: 0.75rem 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex: 1;
}

.card-title {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-meta {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.78rem;
    color: var(--text-secondary);
    padding-top: 0.25rem;
}

.rating-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--success);
    font-weight: 600;
}

/* Video Player Container */
.player-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 1.75rem;
}

.player-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    max-height: 76vh;
}

.html5-video {
    width: 100%;
    height: 100%;
    display: block;
    background: #000;
}

.player-details {
    padding: 1.15rem 1.25rem;
}

.video-main-title {
    font-size: clamp(1.15rem, 2.4vw, 1.55rem);
    font-weight: 800;
    line-height: 1.3;
    margin-bottom: 0.75rem;
}

.video-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.video-stats {
    display: flex;
    align-items: center;
    gap: 1.15rem;
    flex-wrap: wrap;
    font-size: 0.88rem;
    color: var(--text-secondary);
}

/* Voting System Buttons */
.vote-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.vote-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem 0.95rem;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.vote-btn:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.vote-btn.voted {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.rating-bar-wrap {
    width: 120px;
    height: 6px;
    background: var(--bg-primary);
    border-radius: 99px;
    overflow: hidden;
}

.rating-bar-fill {
    height: 100%;
    background: var(--success);
    transition: width 0.3s ease;
}

.video-description {
    margin-top: 0.9rem;
    color: var(--text-secondary);
    font-size: 0.92rem;
    line-height: 1.6;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.4rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.page-link {
    padding: 0.5rem 0.9rem;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    font-size: 0.88rem;
    font-weight: 600;
}

.page-link:hover, .page-link.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* Tag Cloud Section (Requirement 3: Bottom of ALL pages, cached random independent tags) */
.tagcloud-section {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    padding: 1.75rem 0;
    margin-top: auto;
}

.tagcloud-box {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.85rem;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.36rem 0.78rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
}

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

/* Footer & DMCA / Contact Link (Requirement 7) */
.site-footer {
    background: #08090c;
    padding: 2rem 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.footer-grid {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1.15rem;
    list-style: none;
}

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

.footer-disclaimer {
    margin-top: 1rem;
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.5;
}

/* Forms & Cards (Contact / DMCA / Admin) */
.panel-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 720px) {
    .form-grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-control {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.62rem 1.2rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
}

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

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

.btn-secondary {
    background: var(--bg-elevated);
    border-color: var(--border-color);
    color: var(--text-primary);
}

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

.alert {
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.alert-success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid var(--success);
    color: #6ee7b7;
}

.alert-error {
    background: rgba(225, 29, 72, 0.15);
    border: 1px solid var(--accent);
    color: #fda4af;
}

/* 18+ Age Gate Modal */
.age-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(5, 6, 8, 0.92);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 1rem;
}

.age-modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    max-width: 460px;
    width: 100%;
    padding: 2rem 1.5rem;
    text-align: center;
}
