/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    width: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    background-image: url('../images/bg.jpg');
    background-repeat: repeat;
    background-attachment: fixed;
    overflow-x: hidden;
    width: 100%;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    overflow-x: hidden;
}

/* Header */
header {
    background-color: #2c3e50;
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: relative;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.logo-container {
    flex-shrink: 0;
}

.logo-container img {
    display: block;
    max-height: 60px;
    max-width: 100%;
    width: auto;
    height: 60px;
}

.logo-container .site-name {
    color: #f5f5f5;
    font-size: 1.8rem;
    font-weight: 400;
    white-space: nowrap;
}

header h1 {
    font-size: 1.8rem;
    margin: 0;
}

header h1 a {
    color: white;
    text-decoration: none;
}

/* Mobile Menu Toggle Button (Hidden on Desktop) */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 1001;
    -webkit-tap-highlight-color: transparent;
}

.mobile-menu-toggle span {
    width: 25px;
    height: 3px;
    background-color: white;
    border-radius: 2px;
    transition: all 0.3s ease;
    -webkit-transition: all 0.3s ease;
}

/* Mobile Menu Header (Hidden on Desktop) */
.mobile-menu-header {
    display: none;
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
    -webkit-transition: opacity 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

.mobile-menu-overlay.active {
    display: block;
    opacity: 1;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 2rem;
    align-items: center;
}

nav a {
    color: white;
    text-decoration: none;
    transition: opacity 0.3s;
}

nav a:hover {
    opacity: 0.8;
}

/* Header Search Form */
.search-menu-item {
    margin-left: 1rem;
}

.header-search-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-search-input {
    padding: 0.5rem 0.75rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 0.9rem;
    width: 200px;
    transition: all 0.3s;
}

.header-search-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.header-search-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.header-search-button {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    padding: 0.5rem;
    cursor: pointer;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.header-search-button:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Live Search Results */
.live-search-results {
    display: none;
    position: fixed;
    background: white;
    border: 2px solid #ddd;
    border-radius: 4px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 10000; /* Very high to be above everything */
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    min-width: 300px;
    max-width: 500px;
}

.live-search-item {
    display: block;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    color: #333;
    text-decoration: none;
    transition: background 0.2s;
}

.live-search-item:first-child {
    border-radius: 4px 4px 0 0;
}

.live-search-item:last-child {
    border-bottom: none;
    border-radius: 0 0 4px 4px;
}

.live-search-item:hover {
    background: #f5f5f5;
}

.live-search-title {
    font-weight: 500;
    color: #2c3e50;
    margin-bottom: 0.25rem;
    font-size: 0.95rem;
}

.live-search-meta {
    font-size: 0.85rem;
    color: #7f8c8d;
}

/* Main Content */
main {
    padding: 2rem 0;
    min-height: calc(100vh - 200px);
}

/* Page Title */
.page-title {
    margin-top: 2rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 3px solid #3498db;
}

/* Homepage Stats Boxes */
.stats a > div:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.2) !important;
}

/* Search Bar */
.search-container {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.search-form {
    display: flex;
    gap: 1rem;
}

.search-input {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.search-button {
    padding: 0.75rem 2rem;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
}

.search-button:hover {
    background-color: #2980b9;
}

/* Filter Section */
.filters {
    background: #dac770;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.filter-group {
    margin-bottom: 1rem;
}

.filter-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #5a5a5a;
}

.filter-group select {
    width: 100%;
    padding: 0.5rem;
    border: 2px solid #c5b55f;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    background: #f0e6a8;
    color: #5a5a5a;
}

.filter-group select:focus {
    outline: none;
    border-color: #b0a050;
    background: #ede0a0;
}

.clear-filters-button {
    display: block;
    width: 100%;
    padding: 0.5rem;
    background-color: #b0a050;
    color: white;
    text-align: center;
    text-decoration: none;
    border-radius: 4px;
    font-size: 1rem;
    transition: background-color 0.3s;
}

.clear-filters-button:hover {
    background-color: #9a8f45;
}

/* Video Grid */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
    width: 100%;
    max-width: 100%;
    contain: layout style;
}

.video-grid > * {
    min-height: 0;
    min-width: 0;
}

.video-card {
    background: #3a4d5e;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s, background 0.3s;
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 100%;
    width: 100%;
}

.video-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    background: #445b70;
}
}

.video-thumbnail {
    position: relative;
    background-color: #000;
    overflow: hidden;
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: 300px;
}

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

.play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background-color: rgba(255, 0, 0, 0.8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.play-icon::after {
    content: '';
    width: 0;
    height: 0;
    border-left: 20px solid white;
    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
    margin-left: 5px;
}

.video-info {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.video-title {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: #ffffff;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-title a {
    color: inherit;
    text-decoration: none;
}

.video-title a:hover {
    color: #3498db;
}

.video-meta {
    font-size: 0.9rem;
    color: #bdc3c7;
    margin-bottom: 0.5rem;
}

.video-description {
    font-size: 0.9rem;
    color: #ecf0f1;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-top: auto;
}
}

/* Single Video Page */
.video-player {
    background: #3a4d5e;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
    overflow: hidden;
}

.video-embed {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    background: #2c3e50;
    padding: 2rem;
    padding-bottom: calc(56.25% + 4rem);
}

.video-embed iframe {
    position: absolute;
    top: 2rem;
    left: 2rem;
    width: calc(100% - 4rem);
    height: calc(100% - 4rem);
}

.video-details {
    background: #3a4d5e;
    padding: 2rem;
}

.video-details h1 {
    margin-bottom: 1rem;
    color: #ffffff;
}

.video-details p {
    color: #ecf0f1 !important;
}

.video-details .meta-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
    padding: 1.5rem;
    background-color: rgba(0,0,0,0.2);
    border-radius: 4px;
}

.meta-item {
    display: flex;
    flex-direction: column;
}

.meta-label {
    font-weight: 600;
    color: #bdc3c7;
    font-size: 0.85rem;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.meta-value {
    color: #ffffff;
    font-size: 1rem;
}

.meta-value a {
    color: #dac770;
    text-decoration: none;
}

.meta-value a:hover {
    color: #f0e6a8;
    text-decoration: underline;
}

.meta-value a {
    color: #3498db;
    text-decoration: none;
}

.meta-value a:hover {
    text-decoration: underline;
}

/* Browse Lists */
.browse-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    min-height: 0;
    contain: layout;
}

.browse-card {
    background: #2c3e50;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s, background 0.3s;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.browse-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
    background: #34495e;
}

.browse-card h3 {
    margin-bottom: 0.5rem;
    color: #ffffff;
    line-height: 1.3;
    min-height: 2.6em;
}

.browse-card h3 a {
    color: inherit;
    text-decoration: none;
}

.browse-card h3 a:hover {
    color: #3498db;
}

.browse-card .count {
    color: #ecf0f1;
    font-size: 0.9rem;
}

.browse-card .date-range {
    color: #bdc3c7;
    font-size: 0.85rem;
    margin-top: auto;
    padding-top: 0.5rem;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 2rem 0;
}

.pagination a,
.pagination span {
    padding: 0.5rem 1rem;
    background: white;
    border: 2px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #2c3e50;
    transition: all 0.3s;
}

.pagination a:hover {
    background-color: #3498db;
    color: white;
    border-color: #3498db;
}

.pagination .current {
    background-color: #3498db;
    color: white;
    border-color: #3498db;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 3rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.no-results h2 {
    color: #7f8c8d;
    margin-bottom: 1rem;
}

/* Footer */
footer {
    background-color: #2c3e50;
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-top: 3rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        flex-direction: row;
        justify-content: space-between;
    }
    
    .logo-container img {
        height: 50px !important;
    }
    
    .logo-container .site-name {
        font-size: 1.3rem;
    }
    
    /* Show hamburger menu button */
    .mobile-menu-toggle {
        display: flex;
    }
    
    /* Off-Canvas Navigation */
    .main-nav {
        position: fixed;
        top: 0;
        right: -300px;
        width: 280px;
        height: 100vh;
        background-color: #2c3e50;
        z-index: 1000;
        transition: right 0.3s ease;
        -webkit-transition: right 0.3s ease;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        box-shadow: -2px 0 10px rgba(0, 0, 0, 0.3);
    }
    
    .main-nav.active {
        right: 0;
    }
    
    /* Mobile Menu Header */
    .mobile-menu-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 1.5rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .mobile-menu-header h3 {
        color: white;
        margin: 0;
        font-size: 1.2rem;
    }
    
    .mobile-menu-close {
        background: none;
        border: none;
        color: white;
        font-size: 2rem;
        cursor: pointer;
        padding: 0;
        line-height: 1;
        width: 30px;
        height: 30px;
        display: flex;
        align-items: center;
        justify-content: center;
        -webkit-tap-highlight-color: transparent;
    }
    
    .mobile-menu-close:hover {
        opacity: 0.7;
    }
    
    /* Vertical Navigation Menu */
    nav ul {
        flex-direction: column;
        gap: 0;
        padding: 0;
        align-items: stretch;
    }
    
    nav ul li {
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    nav ul li a {
        display: block;
        padding: 1.2rem 1.5rem;
        color: white;
        font-size: 1.1rem;
    }
    
    nav ul li a:hover {
        background-color: rgba(255, 255, 255, 0.1);
        opacity: 1;
    }
    
    /* Search in mobile menu */
    .search-menu-item {
        margin-left: 0;
        padding: 1.2rem 1.5rem;
        position: relative;
    }
    
    .header-search-form {
        width: 100%;
    }
    
    .header-search-input {
        flex: 1;
        width: auto;
    }
    
    /* Live search results in mobile */
    .live-search-results {
        position: static;
        margin-top: 0.5rem;
        border-radius: 4px;
    }
    
    .search-form {
        flex-direction: column;
    }
    
    .video-grid {
        grid-template-columns: 1fr;
    }
    
    .browse-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .logo-container img {
        height: 40px !important;
    }
    
    .logo-container .site-name {
        font-size: 1rem;
    }
    
    .main-nav {
        width: 250px;
        right: -250px;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    .video-info {
        padding: 1rem;
    }
    
    .video-player {
        padding: 1rem;
    }
}

/* Page Loading Spinner */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.3s ease-out;
}

.loader-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Optional: Alternative loader with multiple colors */
.loader-spinner-alt {
    width: 60px;
    height: 60px;
    border: 4px solid transparent;
    border-top-color: #3498db;
    border-right-color: #f1c40f;
    border-bottom-color: #3498db;
    border-left-color: #f1c40f;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.breadcrumb-nav nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.95rem;
}

.breadcrumb-nav a {
    color: #3498db;
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumb-nav a:hover {
    color: #2980b9;
    text-decoration: underline;
}

.breadcrumb-nav span {
    color: #999;
}

.breadcrumb-nav span:last-child {
    color: #666;
    font-weight: 500;
}

@media (max-width: 768px) {
    .breadcrumb-nav nav {
        font-size: 0.85rem;
    }
}

/* Breadcrumb Navigation - matches section headers on videos.php */
.breadcrumb-container {
    background: transparent;
    padding: 1rem 0 0.5rem 0;
    border-bottom: 3px solid #3498db;
    margin-bottom: 1.5rem;
}

.breadcrumb-container nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.breadcrumb-container a {
    color: #3498db;
    text-decoration: none;
    transition: color 0.2s, opacity 0.2s;
}

.breadcrumb-container a:hover {
    opacity: 0.8;
}

.breadcrumb-container span {
    color: #bdc3c7;
}

@media (max-width: 768px) {
    .breadcrumb-container nav {
        font-size: 0.8rem;
    }
}
