/* ==========================================================================
   1. GLOBAL VARIABLES & BASE RESET
   ========================================================================== */
:root {
    --bg-color: #0f0f0f;
    --header-bg: #222222;
    --text-main: #ffffff;
    --text-dim: #aaaaaa;
    --accent: #ff0000;
    --card-bg: #1a1a1a;
    --border-color: #333333;
    --separator: #ffffff; /* White line for dark theme */
}

[data-theme="light"] {
    --bg-color: #ececec;
    --header-bg:#f7f7f7;
    --text-main: #1a1a1a;
    --text-dim: #555555;
    --card-bg: #ffffff;
    --border-color: #d1d1d1;
    --separator: #333333; /* Dark grey line for light theme */
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    transition: background 0.3s ease;
}

/* ==========================================================================
   2. HEADER & NAVIGATION
   ========================================================================== */
.header-block {
    background: var(--header-bg);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: none; /* Always none here */
}

.primary-nav {
    display: grid;
    grid-template-columns: 50px 1fr 50px;
    align-items: center;
    height: 60px;
    padding: 0 15px;
    border-bottom: 1px solid var(--separator); 
}

@media (min-width: 1024px) {
    .primary-nav {
        display: flex;
        justify-content: space-between;
        max-width: 85%;
        margin: 0 auto;
        border-bottom: none; 
    }
}

.site-logo {
    display: flex;
    justify-content: center;
}

.site-logo img {
    height: 32px;
    width: auto;
}

.search-wrapper {
    display: flex;
    justify-content: flex-end;
}

.menu-toggle, .search-toggle {
    background: transparent;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    font-size: 22px;
    padding: 5px;
}

/* Desktop Menu Logic */
.desktop-menu { display: none; }

@media (min-width: 1024px) {
    .primary-nav {
        display: flex;
        justify-content: space-between;
        max-width: 85%;
        margin: 0 auto;
    }
    .menu-toggle { display: none; }
    .desktop-menu { display: flex; list-style: none; gap: 30px; font-weight: 500; }
    .desktop-menu a { color: var(--text-main); text-decoration: none; }
    .desktop-menu a:hover { color: var(--accent); }
}

/* ==========================================================================
   3. MOBILE SECONDARY BAR (TAGS/SEARCH)
   ========================================================================== */
.mobile-secondary-bar {
    background: var(--header-bg);
    display: flex;
    align-items: center;
    height: 50px;
    padding: 0 15px;
    border: none !important; 
}

.mobile-tags-container {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    width: 100%;
    scrollbar-width: none;
    align-items: center;
}

.mobile-tags-container::-webkit-scrollbar { display: none; }

.mobile-tags-container a {
    background: var(--card-bg);
    color: var(--text-main);
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 12px;
    white-space: nowrap;
    border: 1px solid var(--border-color);
    text-decoration: none; /* No underline */
    box-shadow: none;      /* No shadow */
    display: inline-flex;
    align-items: center;
}

/* Search Box Logic */
.mobile-search-full { width: 100%; display: none; }
.search-flex { display: flex; gap: 5px; width: 100%; }

.mobile-input-field {
    flex: 1;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    outline: none;
    border: 1px solid var(--border-color);
}

/* High Contrast Flip for Input */
[data-theme="dark"] .mobile-input-field { background: #ffffff; color: #000; }
[data-theme="light"] .mobile-input-field { background: #333333; color: #fff; }

.inner-search-btn {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 0 10px;
    border-radius: 4px;
}

/* Desktop Dropdown behavior */
@media (min-width: 1024px) {
    #tagsArea { display: none !important; }
   .mobile-secondary-bar {
        border: 1px solid var(--separator);
        border-top: none;
        display: none;
        position: absolute;
        top: 61px;
        right: 7.5%;
        width: 320px;
        background: var(--header-bg);
        border-radius: 0 0 8px 8px;
        height: auto;
        padding: 10px;
        box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    }
    .secondary-bar-active { display: block !important; }
}

/* ==========================================================================
   4. MOBILE DROPDOWN MENU (COMPACT)
   ========================================================================== */
.mobile-menu {
    display: none; 
    position: absolute;
    top: 65px; /* Positioned just below the primary nav */
    left: 15px;
    width: auto; 
    min-width: 180px;
    background: var(--header-bg);
    flex-direction: column;
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    border: 1px solid var(--border-color);
    z-index: 999;
}

.mobile-menu.active { 
    display: flex; 
}

.mobile-menu a {
    padding: 12px 15px;
    font-size: 1rem;
    color: var(--text-main);
    text-decoration: none;
    border-bottom: none; /* No dividing lines */
    border-radius: 4px;
}

.mobile-menu a:hover {
    background: rgba(255, 255, 255, 0.1);
}


/* ==========================================================================
   5. VIDEO GRID & CARD STYLING
   ========================================================================== */
.main-content { 
    padding: 20px 10px; 
}

/* Base: 1 Column for Mobile */
.video-grid {
    display: grid;
    gap: 20px 15px;
    grid-template-columns: 1fr;
}

/* Tablet: 2 Columns */
@media (min-width: 600px) {
    .video-grid { 
        grid-template-columns: repeat(2, 1fr); 
    }
}

/* DESKTOP: 3 Columns (Restored your layout) */
@media (min-width: 1024px) {
    .main-content { 
        padding: 40px 7.5%; 
    }
    .video-grid { 
        grid-template-columns: repeat(3, 1fr); 
    }
}

/* INDIVIDUAL CARD STYLING */
.video-card {
    background: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.thumb-container {
    position: relative;
    aspect-ratio: 16/9;
    background: #000;
}

.thumb-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Badge Overlays */
.badge {
    position: absolute;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: bold;
    border-radius: 3px;
    z-index: 5;
}

.badge-fresh {
    top: 8px;
    left: 8px;
    background: var(--accent);
    color: #fff;
}

.badge-hd {
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Info Section below image */
.v-info {
    padding: 12px;
}

.v-title {
    font-size: 14px;
    margin-bottom: 10px;
    /* Truncation Logic */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; 
}

.v-title a {
    color: var(--text-main);
    text-decoration: none;
}

/* Meta Row: Date and Duration */
.v-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-dim);
}

.v-duration-box {
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 5px;
    border-radius: 4px;
    font-weight: 500;
}

/* ==========================================================================
   6. PAGINATION
   ========================================================================== */
.pagination-container {
    display: flex;
    justify-content: center;
    margin: 40px 0;
    padding: 0 15px;
}

.pagination {
    display: flex;
    list-style: none;
    gap: 8px;
    align-items: center;
}

.page-item {
    display: flex;
    align-items: center;
}

.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 5px;
    background: var(--card-bg);
    color: var(--text-main);
    text-decoration: none;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
}

/* Hover State */
.page-link:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-2px);
}

/* Active Page Style */
.page-item.active .page-link {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
}

/* Dots Styling */
.page-item.dots {
    color: var(--text-dim);
    padding: 0 5px;
    font-weight: bold;
}

/* Disabled/Arrow Styling */
.page-item.disabled .page-link {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Mobile Adjustments */
@media (max-width: 480px) {
    .pagination { gap: 5px; }
    .page-link {
        min-width: 35px;
        height: 35px;
        font-size: 13px;
    }
}

/* ==========================================================================
   7. FOOTER STYLING
   ========================================================================== */
.site-footer {
    background: var(--header-bg);
    padding: 50px 20px 20px;
    margin-top: 60px;
    border-top: 1px solid var(--separator);
}

.footer-grid {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    /* Forces 2 columns for links on ALL screens */
    grid-template-columns: repeat(2, 1fr); 
    gap: 30px;
}

/* The Paragraph Column: Spans both columns to stay on top */
.footer-description {
    grid-column: span 2; 
    margin-bottom: 20px;
}

.footer-description p {
    color: var(--text-dim);
    line-height: 1.6;
    font-size: 14px;
    margin: 0;
}

.footer-col h4 {
    margin-bottom: 15px;
    font-size: 15px;
    color: var(--accent);
    text-transform: uppercase;
}

.footer-links {
    list-style: none;
    padding: 0;
}

.footer-links li {
    margin-bottom: 10px;
}

.footer-links a {
    color: var(--text-dim);
    font-size: 13px;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--accent);
}

/* Copyright Line */
.copyright-line {
    text-align: center;
    padding-top: 30px;
    margin-top: 40px;
    border-top: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-dim);
}

/* DESKTOP ADJUSTMENT: Prepped for future 3rd link column */
@media (min-width: 1024px) {
    .footer-grid {
        /* On desktop, we can use 3 columns if you add more links later */
        grid-template-columns: repeat(3, 1fr); 
    }
    
    .footer-description {
        /* On desktop, the paragraph spans all 3 columns */
        grid-column: span 3; 
    }
}