:root {
    /* Base Colors (Light Mode) */
    --bg-color: rgb(241, 244, 236);
    --card-bg: rgb(253, 253, 252);
    --text-primary: rgb(9, 9, 11);
    --text-secondary: #606060;
    --primary-yellow: #eab308;
    --hover-yellow: #ca9a04;
    --header-bg: rgba(253, 253, 252, 0.95);
    --border-color: rgba(0, 0, 0, 0.05);

    /* Typography */
    --font-primary: 'PT Sans', sans-serif;
}

/* Dark Mode Variables */
.dark {
    --bg-color: #1a1a1a;
    --card-bg: #262626;
    --text-primary: #f5f5f5;
    --text-secondary: #a3a3a3;
    --header-bg: rgba(38, 38, 38, 0.95);
    --border-color: rgba(255, 255, 255, 0.1);
}

@import url('https://fonts.googleapis.com/css2?family=PT+Sans:wght@400;700&display=swap');

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

body {
    font-family: var(--font-primary);
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow-x: hidden;
    line-height: 1.5;
}

/* Header */
.main-header {
    background-color: var(--header-bg);
    padding: 0.8rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(8px);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    text-decoration: none;
    white-space: nowrap;
}

.logo span {
    color: var(--primary-yellow);
    margin-left: 4px;
    margin-right: 4px;
}

/* Search Bar - Rounded style */
.search-container {
    flex: 0 1 500px;
    display: flex;
    align-items: center;
    background-color: #fff;
    border-radius: 9999px;
    /* Fully rounded */
    padding: 4px 6px;
    border: 1px solid #e2e8f0;
    transition: all 0.2s;
}

.search-container:focus-within {
    border-color: #cbd5e1;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.05);
}

.search-input {
    width: 100%;
    padding: 0.5rem 0 0.5rem 1rem;
    border: none;
    background: transparent;
    outline: none;
    font-size: 0.95rem;
    color: var(--text-primary);
    font-family: var(--font-primary);
}

.search-btn {
    padding: 0.5rem 1.2rem;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1rem;
    color: #94a3b8;
    transition: color 0.2s;
}

.search-btn:hover {
    color: var(--primary-yellow);
}

/* Grid Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.video-grid {
    display: grid;
    /* Responsive grid logic */
    grid-template-columns: repeat(1, 1fr);
    gap: 1.5rem;
}

@media (min-width: 640px) {
    .video-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

@media (min-width: 1280px) {
    .video-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.loading,
.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.error-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem;
    color: #dc2626; /* Red */
    font-size: 1.1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.error-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

/* Video Card */
.video-card {
    background-color: var(--card-bg);
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid rgba(0, 0, 0, 0.02);
}

.video-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.thumbnail-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background-color: #eee;
    overflow: hidden;
}

.thumbnail-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    opacity: 0;
    transition: opacity 0.2s;
    font-size: 0.9rem;
}

.video-card:hover .play-icon {
    opacity: 1;
}

.card-content {
    padding: 1rem;
}

.video-title {
    font-size: 1rem;
    /* approx 16px */
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.4;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.modal:not(.hidden) {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    width: 90%;
    max-width: 900px;
    background: transparent;
    position: relative;
}

.close-btn {
    position: absolute;
    top: -40px;
    right: -10px;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    background: none;
    border: none;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.close-btn:hover {
    opacity: 1;
}

.video-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Footer */
.sticky-footer {
    background-color: var(--bg-color);
    /* Matches page bg */
    padding: 2rem 1rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.sticky-footer a {
    color: inherit;
    text-decoration: underline;
    margin: 0 4px;
}

.sticky-footer a:hover {
    color: var(--text-primary);
}

.hidden {
    display: none !important;
}

@media (max-width: 640px) {
    .header-content {
        flex-direction: column;
        align-items: stretch;
    }

    .search-container {
        flex: 1;
        width: 100%;
    }

    .container {
        padding: 1rem;
    }
}