/*
Theme Name: VideoTube
Theme URI: https://example.com
Author: Your Name
Author URI: https://example.com
Description: A YouTube-style video theme for WordPress with grid layouts and video embedding support
Version: 1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: videotube
*/

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #0f0f0f;
    color: #f1f1f1;
    line-height: 1.6;
}

a {
    color: #aaaaaa;
    text-decoration: none;
}

a:hover {
    color: #cccccc;
}

/* Header */
.site-header {
    background-color: #212121;
    padding: 12px 24px;
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid #303030;
}

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

.site-branding {
    display: flex;
    align-items: center;
    gap: 4px;
}

.site-title {
    font-size: 28px;
    font-weight: 600;
    color: #fff;
    margin: 0;
}

.site-title a {
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background-color: #ff0000;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
}

/* Navigation */
.main-navigation {
    flex-grow: 1;
    margin: 0 20px;
}

.main-navigation ul {
    list-style: none;
    display: flex;
    gap: 24px;
}

.main-navigation a {
    color: #f1f1f1;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 12px;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.main-navigation a:hover {
    background-color: #3f3f3f;
}

/* Search Form */
.search-form {
    display: flex;
    align-items: center;
    max-width: 600px;
    flex-grow: 1;
}

.search-form input[type="search"] {
    flex-grow: 1;
    padding: 10px 16px;
    background-color: #121212;
    border: 1px solid #303030;
    border-radius: 40px 0 0 40px;
    color: #f1f1f1;
    font-size: 14px;
    outline: none;
}

.search-form input[type="search"]:focus {
    border-color: #303030;
    background-color: #0f0f0f;
}

/* Hide the X (clear) button in search input */
.search-form input[type="search"]::-webkit-search-cancel-button {
    display: none;
    -webkit-appearance: none;
}

.search-form button {
    padding: 10px 20px;
    background-color: #303030;
    border: 1px solid #303030;
    border-left: none;
    border-radius: 0 40px 40px 0;
    color: #f1f1f1;
    cursor: pointer;
    font-size: 14px;
}

.search-form button:hover {
    background-color: #3f3f3f;
}

/* Main Content */
.site-content {
    max-width: 1728px;
    margin: 0 auto;
    padding: 24px 96px;
}

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

/* Sort Filter */
.sort-filter {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #303030;
}

.sort-btn {
    padding: 8px 20px;
    background-color: #272727;
    color: #f1f1f1;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.sort-btn:hover {
    background-color: #3f3f3f;
    color: #fff;
}

.sort-btn.active {
    background-color: #aaaaaa;
    color: #0f0f0f;
    font-weight: 600;
    border-color: #aaaaaa;
}

/* Video Card */
.video-card {
    background-color: transparent;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.2s;
}

.video-card:hover {
    transform: translateY(-4px);
}

.video-thumbnail {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    background-color: #272727;
    border-radius: 12px;
    overflow: hidden;
}

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

.video-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background-color: rgba(0, 0, 0, 0.8);
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
}

.video-views {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background-color: rgba(0, 0, 0, 0.8);
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
}

.video-info {
    padding: 12px 0;
}

.video-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    color: #f1f1f1;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

h2.video-title,
h3.video-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    margin: 0 0 6px 0;
}

.video-title a {
    color: #f1f1f1;
}

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

/* Single Video Page */
.single-video-container {
    max-width: 1280px;
    margin: 0 auto;
}

.video-player {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    background-color: #000;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 16px;
}

.video-loading-spinner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #000;
    z-index: 10;
    transition: opacity 0.3s ease;
}

.video-loading-spinner.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner-circle {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spinner-rotate 0.8s linear infinite;
}

@keyframes spinner-rotate {
    to { transform: rotate(360deg); }
}

.video-player iframe,
.video-player video,
.video-player embed {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.video-player iframe.loaded,
.video-player video.loaded,
.video-player embed.loaded {
    opacity: 1;
}

.video-header {
    margin-bottom: 24px;
}

.video-header h1 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #f1f1f1;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.video-title-text {
    flex: 1 1 auto;
    min-width: 0;
    line-height: 1.3;
}

.video-title-views {
    font-size: 14px;
    font-weight: 400;
    color: #aaaaaa;
    white-space: nowrap;
    flex-shrink: 0;
    align-self: flex-end;
    line-height: 1.3;
    margin-bottom: 2px;
}

/* Footer */
.site-footer {
    background-color: #212121;
    padding: 40px 24px 20px;
    margin-top: 60px;
    border-top: 1px solid #303030;
}

.footer-content {
    max-width: 1920px;
    margin: 0 auto;
    text-align: center;
}

.footer-content p {
    color: #aaa;
    font-size: 14px;
}

/* Responsive */
/* Tablet - 4 columns */
@media (max-width: 1024px) {
    .video-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 14px;
    }
    
    .site-content {
        padding: 16px 48px;
    }
    
    .sort-filter {
        gap: 8px;
        flex-wrap: wrap;
    }
    
    .sort-btn {
        padding: 7px 16px;
        font-size: 13px;
    }
}

/* Tablet Portrait and Mobile Landscape */
@media (max-width: 768px) {
    .site-header {
        padding: 8px 12px;
    }
    
    .header-container {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .site-branding {
        width: 100%;
        justify-content: center;
        text-align: center;
        margin-bottom: -4px;
    }
    
    .site-title {
        font-size: 28px;
    }
    
    .logo-icon {
        width: 28px;
        height: 28px;
    }
    
    /* Make search form responsive */
    .search-form {
        order: 3;
        width: 100%;
        max-width: 100%;
    }
    
    .search-form input[type="search"] {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Navigation */
    .main-navigation {
        order: 2;
        margin: 0;
        flex-grow: 0;
    }
    
    .main-navigation ul {
        gap: 8px;
        flex-wrap: wrap;
    }
    
    .main-navigation a {
        font-size: 13px;
        padding: 6px 10px;
    }
    
    /* Video Grid - 3 columns on tablet portrait */
    .video-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
    
    .site-content {
        padding: 12px 24px;
    }
    
    .video-info {
        padding: 8px 0;
    }
    
    .video-title {
        font-size: 13px;
    }
    
    .sort-filter {
        gap: 6px;
        margin-bottom: 16px;
    }
    
    .sort-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
}

/* Mobile - 2 columns */
@media (max-width: 480px) {
    .video-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .site-header {
        padding: 8px;
    }
    
    .header-container {
        gap: 6px;
    }
    
    .site-title {
        font-size: 26px;
    }
    
    .logo-icon {
        width: 24px;
        height: 24px;
        font-size: 14px;
    }
    
    .main-navigation ul {
        gap: 4px;
    }
    
    .main-navigation a {
        font-size: 12px;
        padding: 5px 8px;
    }
    
    .search-form input[type="search"],
    .search-form button {
        padding: 8px 12px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .site-content {
        padding: 8px 16px;
    }
    
    .sort-filter {
        gap: 4px;
        margin-bottom: 12px;
    }
    
    .sort-btn {
        padding: 5px 10px;
        font-size: 11px;
        flex: 1;
        text-align: center;
    }
    
    /* Single video page adjustments */
    .video-player {
        border-radius: 8px;
    }
    
    .video-header h1 {
        font-size: 16px;
    }
    
    .video-title-views {
        font-size: 12px;
    }
    
    /* Footer */
    .site-footer {
        padding: 24px 12px 16px;
        margin-top: 40px;
    }
    
    .footer-content p {
        font-size: 12px;
    }
}

/* Extra small screens */
@media (max-width: 360px) {
    .site-title span {
        display: none; /* Hide site title text, keep only logo */
    }
    
    .main-navigation a {
        font-size: 11px;
        padding: 4px 6px;
    }
}

/* Load More Button */
/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 40px 0 20px;
    width: 100%;
}

.pagination a,
.pagination span {
    background-color: #272727;
    color: #f1f1f1;
    border: 1px solid #3f3f3f;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s ease;
    min-width: 40px;
    text-align: center;
}

.pagination a:hover {
    background-color: #3f3f3f;
    border-color: #555;
    color: #f1f1f1;
}

.pagination .current {
    background-color: #aaaaaa;
    border-color: #aaaaaa;
    color: #0f0f0f;
    font-weight: 600;
}

.pagination .dots {
    background: transparent;
    border: none;
    padding: 10px 8px;
}

.pagination .prev,
.pagination .next {
    font-weight: 600;
}

/* Related Videos Section */
.related-videos {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid #303030;
}

.related-videos h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 24px;
    color: #f1f1f1;
}

/* Search Results */
.search-results .page-title {
    font-size: 24px;
    font-weight: 600;
    color: #f1f1f1;
    margin-bottom: 32px;
}

.search-results .page-title span {
    color: #f1f1f1;
}

.no-results {
    text-align: center;
    padding: 60px 20px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.no-results h2 {
    font-size: 24px;
    color: #f1f1f1;
    margin-bottom: 16px;
}

.no-results p {
    color: #aaa;
    font-size: 16px;
}

/* No Posts Message */
.no-posts {
    text-align: center;
    padding: 60px 20px;
    grid-column: 1 / -1;
}

.no-posts p {
    color: #aaa;
    font-size: 16px;
}

/* Responsive Pagination */
@media (max-width: 768px) {
    .pagination {
        gap: 6px;
        margin: 32px 0 20px;
    }
    
    .pagination a,
    .pagination span {
        padding: 8px 12px;
        font-size: 13px;
        min-width: 36px;
    }
}

@media (max-width: 480px) {
    .pagination {
        gap: 4px;
        margin: 24px 0 16px;
        flex-wrap: wrap;
    }
    
    .pagination a,
    .pagination span {
        padding: 7px 10px;
        font-size: 12px;
        min-width: 32px;
    }
    
    .related-videos h2,
    .search-results .page-title {
        font-size: 18px;
    }
}

/* 404 Error Page */
.error-404-page {
    max-width: 1280px;
    margin: 0 auto;
    padding: 60px 24px;
}

.error-content {
    text-align: center;
}

.error-title {
    font-size: 120px;
    font-weight: 700;
    color: #aaaaaa;
    margin: 0;
    line-height: 1;
}

.error-subtitle {
    font-size: 32px;
    font-weight: 600;
    color: #f1f1f1;
    margin: 20px 0;
}

.error-message {
    font-size: 16px;
    color: #aaa;
    max-width: 600px;
    margin: 0 auto 40px;
    line-height: 1.6;
}

.error-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-bottom: 60px;
}

.btn-home {
    display: inline-block;
    background-color: #aaaaaa;
    color: #0f0f0f;
    padding: 12px 32px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.2s;
}

.btn-home:hover {
    background-color: #cccccc;
    color: #0f0f0f;
}

.suggested-videos {
    margin-top: 60px;
}

.suggested-videos h3 {
    font-size: 20px;
    font-weight: 600;
    color: #f1f1f1;
    margin-bottom: 24px;
    text-align: center;
}

.suggested-videos .video-title {
    font-size: 14px;
}

.suggested-videos .video-grid {
    grid-template-columns: repeat(6, 1fr);
}

@media (max-width: 1024px) {
    .suggested-videos .video-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .error-404-page {
        padding: 40px 16px;
    }
    
    .error-title {
        font-size: 80px;
    }
    
    .error-subtitle {
        font-size: 24px;
    }
    
    .error-message {
        font-size: 14px;
    }
    
    .btn-home {
        padding: 10px 24px;
        font-size: 14px;
    }
    
    .suggested-videos {
        margin-top: 40px;
    }
    
    .suggested-videos h3 {
        font-size: 20px;
    }
    
    .suggested-videos .video-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .error-title {
        font-size: 60px;
    }
    
    .error-subtitle {
        font-size: 20px;
    }
}

/* Video Tags */
.video-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.video-tag {
    display: inline-block;
    background-color: #272727;
    color: #f1f1f1;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid #3f3f3f;
    transition: all 0.2s ease;
}

.video-tag:hover {
    background-color: #3f3f3f;
    border-color: #555;
    color: #f1f1f1;
}

@media (max-width: 768px) {
    .video-tags {
        gap: 6px;
        margin-top: 12px;
    }
    
    .video-tag {
        padding: 5px 12px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .video-tags {
        gap: 4px;
        margin-top: 10px;
    }
    
    .video-tag {
        padding: 4px 10px;
        font-size: 11px;
    }
}
