/*
Theme Name: Video Theme v4 (Ad Support)
Theme URI: https://example.com
Description: Clean video theme with ad banner support - square cards, clean layout
Version: 4.5
Author: Your Name
*/

/* ===================================
   RESET & BASE
   =================================== */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #333;
    background: #f5f5f5;
}

a {
    color: #0073aa;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

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

/* ===================================
   HEADER
   =================================== */

.site-header {
    background: #fff;
    border-bottom: 1px solid #ddd;
    padding: 20px 0;
}

.header-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
}

.site-title a {
    color: #333;
    text-decoration: none;
}

/* Main Navigation - Desktop */
.main-nav {
    display: flex;
    gap: 30px;
    list-style: none;
}

.main-nav a {
    color: #333;
    font-weight: 500;
    text-decoration: none;
    padding: 5px 10px;
}

.main-nav a:hover {
    color: #0073aa;
}

/* Search Form in Header */
.search-form {
    display: flex;
    align-items: center;
    gap: 5px;
}

.search-field {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    width: 200px;
    font-family: inherit;
}

.search-field:focus {
    outline: none;
    border-color: #0073aa;
}

.search-submit {
    background: #0073aa;
    color: #fff;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-submit:hover {
    background: #005a87;
}

.search-submit .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* Hamburger Menu - Hidden on Desktop */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
}

.menu-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background: #333;
    margin: 5px 0;
    transition: 0.3s;
}

/* ===================================
   AD BANNERS
   =================================== */

.ad-banner {
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    overflow: hidden;
}

.ad-banner-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 15px 20px;
    text-align: center;
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Header Ad Banner */
.header-ad-banner {
    margin-bottom: 0;
    border-left: none;
    border-right: none;
}

/* Sidebar Ad Banner */
.sidebar-ad-banner {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Footer Ad Banner */
.footer-ad-banner {
    margin-top: 40px;
    margin-bottom: 0;
    border-left: none;
    border-right: none;
}

/* Video-Style Ad Card */
.video-ad-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 2px solid #ffd700; /* Gold border to differentiate */
    position: relative;
}

.video-ad-wrapper {
    position: relative;
    width: 100%;
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fafafa;
}

.video-ad-content {
    width: 100%;
    padding: 15px;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Ad Badge */
.ad-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #ffd700;
    color: #333;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* ===================================
   PAGE LAYOUT
   =================================== */

.page-wrapper {
    width: 100%;
    padding: 40px 20px;
}

.content-wrapper {
    max-width: 1600px;
    margin: 0 auto;
}

/* Layout with Sidebar */
.content-wrapper.has-sidebar {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 40px;
}

/* Limit to 3 columns max when sidebar enabled (thumbnails too small otherwise) */
.content-wrapper.has-sidebar .video-grid {
    grid-template-columns: repeat(min(var(--columns), 3), 1fr);
}

/* Category filter also limited to 3 columns when sidebar enabled */
.content-wrapper.has-sidebar .category-filter-below .category-list-grid {
    grid-template-columns: repeat(min(var(--columns), 3), 1fr) !important;
}

/* Layout without Sidebar */
.content-wrapper.no-sidebar {
    max-width: 1600px;
}

.main-content {
    min-width: 0; /* Important for grid */
}

/* ===================================
   VIDEO GRID - THE IMPORTANT PART
   =================================== */

/* Section Titles */
.section-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 20px;
    color: #333;
}

/* Featured Videos Section */
.featured-videos-section {
    margin-bottom: 50px;
    padding-bottom: 30px;
    border-bottom: 2px solid #e0e0e0;
}

.featured-videos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.featured-video-card .video-thumbnail {
    position: relative;
}

.featured-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #ff6b00;
    color: #fff;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    z-index: 10;
}

/* Videos Section Header */
.videos-section {
    margin-bottom: 40px;
}

.videos-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

/* Sort Options */
.sort-options {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sort-options label {
    font-size: 14px;
    font-weight: 500;
    color: #666;
}

.sort-select {
    padding: 8px 30px 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
    font-family: inherit;
}

.sort-select:focus {
    outline: none;
    border-color: #0073aa;
}

/* Main Video Grid */
.video-grid {
    display: grid;
    grid-template-columns: repeat(var(--columns, 4), 1fr);
    gap: 30px;
    margin-bottom: 40px;
}

/* ===================================
   VIDEO CARDS
   =================================== */

.video-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Square aspect ratio for consistent card shape */
.video-card::before {
    content: '';
    display: block;
    padding-top: 100%; /* 1:1 aspect ratio (square) */
}

.video-card {
    aspect-ratio: 1 / 1; /* Modern browsers */
}

.video-card::before {
    content: none; /* Remove when aspect-ratio is supported */
}

@supports (aspect-ratio: 1 / 1) {
    .video-card::before {
        display: none;
    }
}

.video-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

/* Prevent hover effect on ad cards */
.video-ad-card:hover {
    transform: none;
}

.video-link {
    display: flex;
    flex-direction: column;
    color: inherit;
    text-decoration: none;
    height: 100%;
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

@supports (aspect-ratio: 1 / 1) {
    .video-link {
        position: relative;
    }
}

.video-thumbnail {
    position: relative;
    width: 100%;
    flex: 0 0 70%; /* Thumbnail takes 70% of card height */
    background: #000;
    overflow: hidden;
}

.video-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #222;
}

.video-placeholder .dashicons {
    font-size: 60px;
    color: #666;
}

.video-info {
    padding: 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.video-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Limit to 2 lines */
    -webkit-box-orient: vertical;
    text-align: center;
}

/* Legacy - no longer used but kept for backward compatibility */
.video-meta {
    font-size: 14px;
    color: #666;
    margin-top: auto;
}

.video-excerpt {
    font-size: 13px;
    color: #666;
    margin-top: 8px;
    line-height: 1.4;
}

.search-count {
    color: #666;
    font-size: 16px;
    margin-top: 10px;
}

/* ===================================
   CATEGORY FILTER
   =================================== */

.category-filter {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

/* Category filter below videos - more spacing */
.category-filter-below {
    margin-top: 40px;
    margin-bottom: 0;
}

.category-filter-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #333;
    text-align: center;
}

/* Default flexbox layout for inline filter */
.category-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    list-style: none;
}

/* 4-column grid layout for filter below videos - matches video grid */
.category-list-grid {
    display: grid;
    grid-template-columns: repeat(var(--columns, 4), 1fr);
    gap: 30px;
}

/* Ensure it uses the same variable on desktop */
.category-filter-below .category-list-grid {
    grid-template-columns: repeat(var(--columns, 4), 1fr) !important;
    gap: 30px !important;
}

.category-list li {
    margin: 0;
}

.category-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #f0f0f0;
    color: #333;
    border-radius: 4px;
    text-decoration: none;
    transition: all 0.3s;
    font-size: 14px;
    height: 100%;
}

.category-list a:hover {
    background: #0073aa;
    color: #fff;
    text-decoration: none;
}

.category-list a.active {
    background: #0073aa;
    color: #fff;
}

.category-name {
    font-weight: 500;
}

.category-count {
    font-size: 13px;
    opacity: 0.8;
}

/* ===================================
   SIDEBAR
   =================================== */

.sidebar {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
}

.sidebar .widget {
    margin-bottom: 30px;
}

.sidebar .widget:last-child {
    margin-bottom: 0;
}

.sidebar .widget-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #0073aa;
}

.sidebar ul {
    list-style: none;
}

.sidebar li {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.sidebar li:last-child {
    border-bottom: none;
}

/* ===================================
   PAGINATION
   =================================== */

.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 40px;
}

.pagination a,
.pagination span {
    padding: 10px 15px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.pagination .current {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
}

/* ===================================
   PAGE HEADERS
   =================================== */

.page-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #0073aa;
}

.page-title {
    font-size: 32px;
    margin-bottom: 10px;
}

.category-description {
    color: #666;
    margin-top: 10px;
}

.no-videos {
    background: #fff;
    padding: 40px;
    border-radius: 8px;
    text-align: center;
}

/* ===================================
   FOOTER
   =================================== */

.site-footer {
    background: #333;
    color: #fff;
    padding: 30px 20px;
    margin-top: 60px;
    text-align: center;
}

/* ===================================
   SUBMIT VIDEO PAGE
   =================================== */

.submission-info {
    color: #666;
    font-size: 14px;
}

.submission-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.submission-success h2 {
    margin-top: 0;
    color: #155724;
}

.video-submission-form-wrapper {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    max-width: 800px;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.form-group input[type="text"],
.form-group input[type="url"],
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    font-family: inherit;
}

.form-group input[type="file"] {
    display: block;
    margin-top: 5px;
}

.form-group textarea {
    resize: vertical;
}

.form-help {
    display: block;
    font-size: 13px;
    color: #666;
    margin-top: 5px;
}

.category-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.submit-button {
    background: #0073aa;
    color: #fff;
    border: none;
    padding: 15px 40px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s;
}

.submit-button:hover {
    background: #005a87;
}

.form-note {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
    font-size: 14px;
    color: #666;
}

.form-note p {
    margin: 5px 0;
}

.login-required {
    background: #fff;
    padding: 40px;
    border-radius: 8px;
    text-align: center;
}

.login-required h2 {
    margin-bottom: 15px;
}

.login-link {
    display: inline-block;
    background: #0073aa;
    color: #fff;
    padding: 12px 30px;
    border-radius: 4px;
    text-decoration: none;
    margin-top: 20px;
}

.login-link:hover {
    background: #005a87;
    text-decoration: none;
}

/* ===================================
   RESPONSIVE - MOBILE/TABLET
   =================================== */

/* Tablets and below - Hide sidebar, show hamburger */
@media (max-width: 900px) {
    
    /* Hide desktop nav, show hamburger */
    .main-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #fff;
        flex-direction: column;
        gap: 0;
        padding: 10px 0;
        border-bottom: 1px solid #ddd;
        z-index: 1000;
    }
    
    .main-nav.active {
        display: flex;
    }
    
    .main-nav li {
        border-bottom: 1px solid #eee;
    }
    
    .main-nav a {
        display: block;
        padding: 15px 20px;
    }
    
    .menu-toggle {
        display: block;
    }
    
    /* Search form on mobile */
    .search-form {
        width: 100%;
        margin-top: 15px;
    }
    
    .search-field {
        flex: 1;
        width: auto;
    }
    
    .header-container {
        flex-wrap: wrap;
    }
    
    /* Force single column layout */
    .content-wrapper.has-sidebar {
        grid-template-columns: 1fr;
    }
    
    /* Hide sidebar completely */
    .sidebar {
        display: none;
    }
    
    /* Adjust video grid for tablets */
    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 20px;
    }
    
    /* Category filter matches video grid columns on tablets */
    .category-filter-below .category-list-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)) !important;
        gap: 20px;
    }
    
    /* Featured videos on tablets */
    .featured-videos-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }
    
    /* Videos header stacks on mobile */
    .videos-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .sort-options {
        width: 100%;
    }
    
    .sort-select {
        flex: 1;
    }
    
    /* Ad banners on mobile */
    .ad-banner-container {
        padding: 10px 15px;
        min-height: 60px;
    }
}

/* Small tablets */
@media (max-width: 768px) {
    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }
    
    /* Category filter matches video grid columns */
    .category-filter-below .category-list-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important;
        gap: 15px;
    }
}

/* Smaller tablets */
@media (max-width: 640px) {
    /* This breakpoint removed - category filter now uses auto-fill like video grid */
}

/* Mobile */
@media (max-width: 600px) {
    .video-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .page-wrapper {
        padding: 20px 15px;
    }
    
    .category-filter {
        padding: 15px;
    }
    
    .category-filter-title {
        font-size: 16px;
        margin-bottom: 15px;
    }
    
    /* Category filter - single column to match video grid */
    .category-filter-below .category-list-grid {
        grid-template-columns: 1fr !important;
        gap: 20px;
    }
    
    .category-list a {
        padding: 10px 14px;
        font-size: 14px;
    }
    
    .page-title {
        font-size: 24px;
    }
    
    /* Video ad adjustments for mobile */
    .video-ad-wrapper {
        min-height: 200px;
    }
}
