:root {
    --primary: #a766ff;
    --primary-dark: #8c42ff;
    --secondary: #ff8c66;
    --dark-bg: #0f0c1d;
    --card-bg: #1e1a30;
    --card-hover: #2a2440;
    --text: #e0e0e0;
    --text-secondary: #b0b0b0;
    --success: #4ade80;
    --warning: #f59e0b;
    --error: #ef4444;
    --transition: all 0.3s ease;
    --border-radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', 'Arial', sans-serif; /* YouTube-like font */
    background: linear-gradient(135deg, var(--dark-bg) 0%, #1a0d2e 100%);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex; /* Use flexbox for overall layout */
    flex-direction: column; /* Stack header, main, footer vertically */
    overflow-x: hidden;
}

/* Header styles - Removed this section as header is removed from HTML */

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    padding: 5px 0; /* Add some padding for click area */
}

.logo-icon {
    background: var(--primary);
    width: 35px;
    height: 35px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: white;
    box-shadow: 0 3px 8px rgba(167, 102, 255, 0.4);
}

.logo-text {
    font-size: 22px;
    font-weight: 700;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tagline {
    display: none; /* This will hide the subtitle */
}

/* Main content area */
main {
    flex-grow: 1; /* Allow main content to take up available space */
    padding-top: 20px; /* Adjusted padding to remove gap after header */
    padding-bottom: 90px; /* Space for fixed footer */
    display: flex;
    flex-direction: column;
}

/* Search bar */
.search-container {
    max-width: 700px;
    margin: 0 auto 30px; /* Adjusted margin */
    position: relative;
    padding: 0 20px;
}

.search-bar {
    display: flex;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50px;
    padding: 6px;
    border: 1px solid rgba(167, 102, 255, 0.3);
    transition: var(--transition);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.search-bar:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(167, 102, 255, 0.3);
    background: rgba(255, 255, 255, 0.12);
}

.search-bar input {
    flex: 1;
    padding: 14px 20px;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 1rem;
    outline: none;
    border-radius: 50px 0 0 50px;
}

.search-bar input::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

.search-bar button {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 0 30px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-bar button:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 10px rgba(167, 102, 255, 0.3);
}

/* Video grid */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px; /* Adjusted gap */
    padding: 0 5%;
    max-width: 1500px;
    margin: 0 auto;
    min-height: 300px;
    position: relative;
}

/* Landscape card layout */
.video-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: var(--transition);
    position: relative;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
    transform: translateY(0);
    cursor: pointer;
    display: flex;
    flex-direction: row;
    height: 180px; /* Adjusted height for better visual balance */
}

.video-card:hover {
    transform: translateY(-8px);
    background: var(--card-hover);
    box-shadow: 0 18px 35px rgba(0, 0, 0, 0.35);
}

.video-thumb {
    width: 50%; /* Increased thumbnail width */
    height: 100%;
    object-fit: cover;
    display: block;
    filter: brightness(0.9);
    transition: filter 0.3s ease;
}

.video-card:hover .video-thumb {
    filter: brightness(1);
}

.card-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    background: linear-gradient(45deg, #ff004c, #ff7e00); /* Vibrant badge */
    color: white;
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 0.8rem;
    font-weight: 600;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    text-transform: uppercase;
}

.card-content {
    padding: 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.video-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 3; /* Allow more lines for title */
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--text);
}

.video-meta {
    display: flex;
    flex-direction: column; /* Stack meta info on small cards */
    gap: 5px; /* Spacing between meta items */
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.video-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 50%; /* Match thumbnail width */
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
    pointer-events: none;
}

.video-card:hover .play-overlay {
    opacity: 1;
}

.play-icon {
    width: 65px;
    height: 65px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    color: white;
    box-shadow: 0 5px 15px rgba(167, 102, 255, 0.5);
    transition: transform 0.3s ease;
}

.video-card:hover .play-icon {
    transform: scale(1.1);
}

/* No results / Error message */
.no-results, .error-message {
    grid-column: 1 / -1; /* Span across all columns */
    text-align: center;
    padding: 50px 20px;
    color: var(--text-secondary);
}

.no-results i, .error-message i {
    font-size: 4rem;
    color: var(--primary);
    margin-bottom: 20px;
}

.error-message i {
    color: var(--error);
}

.no-results h3, .error-message h3 {
    font-size: 2rem;
    color: var(--text);
    margin-bottom: 10px;
}

.no-results p, .error-message p {
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}


/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 18px;
    margin: 60px 0 30px;
    flex-wrap: wrap;
    padding: 0 20px;
}

.pagination button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 50px;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 10px rgba(167, 102, 255, 0.3);
}

.pagination button:disabled {
    background: rgba(167, 102, 255, 0.2);
    color: rgba(255, 255, 255, 0.5);
    cursor: not-allowed;
    box-shadow: none;
}

.page-info {
    font-weight: 500;
    font-size: 1.05rem;
    background: rgba(255, 255, 255, 0.08);
    padding: 12px 25px;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Footer */
footer {
    background: rgba(15, 12, 29, 0.95);
    color: var(--text-secondary);
    text-align: center;
    padding: 15px;
    position: fixed; /* Fixed footer */
    width: 100%;
    bottom: 0;
    border-top: 1px solid rgba(167, 102, 255, 0.15);
    box-shadow: 0 -3px 15px rgba(0, 0, 0, 0.25);
    z-index: 90;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.social-links a {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin: 0 8px; /* Spacing between icons */
    transition: var(--transition);
}

.social-links a:hover {
    color: var(--primary);
    transform: translateY(-3px);
}

/* Loading Spinner */
.loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    display: none;
    z-index: 50;
    background-color: var(--primary-dark);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(167, 102, 255, 0.5);
}

.loading-spinner::before,
.loading-spinner::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    opacity: 0;
    animation: pulse 2s infinite ease-out;
    box-shadow: 0 0 0 0 rgba(167, 102, 255, 0.7);
}

.loading-spinner::after {
    animation-delay: 1s;
    background-color: var(--primary);
    box-shadow: 0 0 0 0 rgba(167, 102, 255, 0.7);
}

@keyframes pulse {
    0% { transform: scale(0.1); opacity: 0.7; box-shadow: 0 0 0 0 rgba(167, 102, 255, 0.7); }
    70% { transform: scale(1); opacity: 0.3; box-shadow: 0 0 0 25px rgba(167, 102, 255, 0); }
    100% { transform: scale(1); opacity: 0; box-shadow: 0 0 0 50px rgba(167, 102, 255, 0); }
}

.loading-spinner.active { display: block; }

/* Responsive design */
@media (max-width: 1024px) {
    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); /* Slightly smaller cards */
        gap: 25px;
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: flex-start;
    }
    .logo {
        margin-bottom: 0; /* Remove margin from logo on smaller screens */
    }
    .search-container {
        margin-top: 20px;
        margin-bottom: 25px;
    }
    .video-grid {
        grid-template-columns: 1fr; /* Single column layout */
        gap: 15px; /* Reduced gap for mobile */
        padding: 0 15px; /* Adjusted padding */
    }
    .video-card {
        flex-direction: row;
        height: 120px; /* Smaller height for mobile cards */
    }
    .video-thumb {
        width: 45%; /* Adjusted thumbnail width for smaller cards */
    }
    .play-overlay {
        width: 45%;
    }
    .card-content {
        padding: 10px 12px;
    }
    .video-title {
        font-size: 1rem;
        -webkit-line-clamp: 2; /* Adjust line clamp for smaller titles */
    }
    .video-meta {
        font-size: 0.8rem;
    }
    .play-icon {
        width: 50px; /* Smaller play icon */
        height: 50px;
        font-size: 20px;
    }
    .pagination {
        margin: 40px 0 20px;
        gap: 10px;
    }
    .pagination button {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    .page-info {
        padding: 10px 15px;
        font-size: 0.9rem;
    }
    footer .footer-content {
        flex-direction: column;
        gap: 10px;
    }
    .social-links a {
        margin: 0 5px;
    }

    .no-results h3, .error-message h3 {
        font-size: 1.5rem;
    }
    .no-results p, .error-message p {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .search-bar input {
        padding: 10px 15px;
        font-size: 0.9rem;
    }
    .search-bar button {
        padding: 0 20px;
        font-size: 0.9rem;
    }
    .video-card {
        height: 100px;
    }
    .video-title {
        font-size: 0.9rem;
    }
    .video-meta {
        font-size: 0.75rem;
    }
    .play-icon {
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
    /* Removed header padding adjustment for small screens */
    /* header {
        padding: 10px 15px;
    } */
    .go-back {
        padding-left: 15px;
    }
}