:root {
    /* Colors */
    --primary-color: #003366;
    /* Babylon Blue approx */
    --secondary-color: #fca311;
    /* Accent Gold/Orange */
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --text-color: #333333;
    --text-muted: #6c757d;
    --border-color: #e5e5e5;

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 2rem;
    --spacing-lg: 4rem;

    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Cairo', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-sm);
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

/* Header Professional Redesign */
:root {
    --header-purple: #7b2cbf;
    /* Academic Purple */
    --header-dark-blue: #002b5c;
    /* Deep Blue */
    --header-gold: #ffb703;
}

.top-bar {
    height: 8px;
    background: var(--header-purple);
    width: 100%;
}

.main-header {
    background: #fff;
    padding: 1rem 0;
    border-bottom: 5px solid var(--header-dark-blue);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-md);
}

.main-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.logo-img {
    height: 70px;
    width: auto;
}

.logo-text {
    text-align: right;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.logo-text h1 {
    font-size: 1.6rem;
    color: var(--header-dark-blue);
    font-weight: 800;
    line-height: 1.2;
    margin: 0;
}

.logo-text p {
    font-size: 0.9rem;
    color: #555;
    margin: 0;
    font-weight: 500;
}

/* Custom "Professor Login" Pill Button */
.btn-login {
    border: 1px solid var(--header-dark-blue);
    background: #fff;
    color: var(--header-dark-blue);
    padding: 0.5rem 2rem;
    border-radius: 50px;
    font-weight: 700;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.btn-login:hover {
    background: var(--header-dark-blue);
    color: #fff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* General Buttons (Keeping legacy support) */
.btn {
    padding: 0.5rem 1.5rem;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background-color: var(--secondary-color);
    color: #fff;
}

.btn-primary:hover {
    background-color: #e08e0b;
    transform: translateY(-2px);
}

.btn-outline {
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    background: transparent;
}

.btn-outline:hover {
    background: var(--primary-color);
    color: #fff;
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, var(--primary-color) 0%, #001f3f 100%);
    color: #fff;
    padding: var(--spacing-lg) 0;
    text-align: center;
}

.hero-section h2 {
    font-size: 2rem;
    margin-bottom: var(--spacing-md);
}

.search-box {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    display: flex;
}

.search-box input {
    width: 100%;
    padding: 1rem 1.5rem;
    padding-left: 3.5rem;
    /* Space for button */
    border-radius: 50px;
    border: none;
    font-family: inherit;
    font-size: 1rem;
    box-shadow: var(--shadow-md);
}

.search-box input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(252, 163, 17, 0.3);
}

.search-box button {
    position: absolute;
    left: 5px;
    top: 5px;
    height: calc(100% - 10px);
    width: 50px;
    border-radius: 50%;
    /* Circle button */
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Filters */
.filters-section {
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    padding: var(--spacing-sm) 0;
}

.filters-scroll {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 5px;
    scrollbar-width: thin;
}

.filter-chip {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1.2rem;
    border-radius: 20px;
    white-space: nowrap;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text-muted);
    transition: all 0.2s;
}

.filter-chip:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.filter-chip.active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

/* Video Grid */
.videos-section {
    padding: var(--spacing-md) 0;
    min-height: 50vh;
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--spacing-md);
}

.video-card {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.video-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.thumbnail-wrapper {
    position: relative;
    padding-top: 56.25%;
    /* 16:9 Aspect Ratio */
    background: #000;
}

.thumbnail-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-content {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.tag {
    font-size: 0.75rem;
    color: var(--primary-color);
    background: rgba(0, 51, 102, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    align-self: flex-start;
}

.card-content h3 {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: auto;
}

.card-content .professor {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.card-content .date {
    font-size: 0.75rem;
    color: #999;
}

/* Spinner */
.spinner-container {
    display: flex;
    justify-content: center;
    padding: 2rem;
    width: 100%;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-left-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

/* Stats Bar */
.stats-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    font-weight: 700;
    color: var(--header-dark-blue);
    background: #fff;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    width: fit-content;
    border-right: 4px solid var(--secondary-color);
}

.badge {
    background: var(--header-dark-blue);
    color: #fff;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.9em;
    min-width: 30px;
    text-align: center;
}

.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }

    .hero-section h2 {
        font-size: 1.5rem;
    }
}