/* Base styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    transition: background-color 0.3s, color 0.3s;
    animation: fadeIn 1s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

header {
    background: linear-gradient(135deg, var(--header-bg), var(--header-accent));
    color: var(--header-text);
    padding: 1rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hamburger {
    position: absolute;
    left: 1rem;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.hamburger:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.hamburger span {
    width: 25px;
    height: 3px;
    background-color: var(--header-text);
    transition: all 0.3s ease;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="2" fill="rgba(255,255,255,0.1)"/></svg>') repeat;
    animation: float 20s linear infinite;
}

@keyframes float {
    0% { transform: translateX(-100px); }
    100% { transform: translateX(100px); }
}

.logo {
    width: 50px;
    height: 50px;
    margin: 0 auto 0.5rem;
    animation: spin 10s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.container {
    display: flex;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

main {
    flex: 1;
    padding-right: 2rem;
}

section {
    margin-bottom: 2rem;
    animation: slideInUp 0.5s ease-out;
}

section h2 {
    cursor: pointer;
    transition: color 0.3s ease;
}

section h2:hover {
    color: var(--accent-color);
}

@keyframes slideInUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.videos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.grades-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.grade-card {
    background: linear-gradient(135deg, var(--card-bg), var(--sidebar-bg));
    border-radius: 12px;
    padding: 2rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 2px solid transparent;
    font-weight: bold;
    font-size: 1.2rem;
}

.grade-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    border-color: var(--accent-color);
}

.grade-section {
    margin-top: 2rem;
    padding-top: 1rem;
}

.grade-section h3 {
    color: var(--accent-color);
    margin-bottom: 1rem;
    font-size: 1.5rem;
    text-align: center;
}



.video-item {
    background-color: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    width: 300px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: bounceIn 0.6s ease-out;
    margin-bottom: 1rem;
}

@keyframes bounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.05); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); opacity: 1; }
}

.video-item:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.video-item h3 {
    padding: 0.5rem;
    margin: 0;
    font-size: 1.1rem;
    background: linear-gradient(45deg, var(--text-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: center;
}

.video-item iframe,
.video-item video {
    width: 100%;
    height: 200px;
    border: none;
}

.sidebar {
    width: 300px;
    background: linear-gradient(135deg, var(--sidebar-bg), var(--sidebar-accent));
    padding: 1rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    animation: slideInRight 0.5s ease-out;
    position: fixed;
    top: 0;
    right: -300px;
    height: 100vh;
    z-index: 1000;
    transition: right 0.3s ease;
    overflow-y: auto;
    display: none;
}

.sidebar.active {
    display: block;
    right: 0;
}

.sidebar nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar nav ul li {
    margin-bottom: 0.5rem;
}

.sidebar nav ul li a {
    color: var(--sidebar-text);
    text-decoration: none;
    display: block;
    padding: 0.5rem;
    border-radius: 8px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.sidebar nav ul li a:hover {
    background-color: var(--accent-color);
    color: #fff;
}

@media (min-width: 769px) {
    .sidebar {
        position: relative;
        right: auto;
        height: auto;
        overflow-y: visible;
    }

    .sidebar.active {
        right: auto;
    }
}

@media (max-width: 768px) {
    .container {
        flex-direction: column;
        padding: 0.5rem;
    }

    main {
        padding-right: 0;
    }

    .videos {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .grades-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .grade-card {
        padding: 1.5rem 0.5rem;
        font-size: 1rem;
    }

    .video-item {
        width: 100%;
        margin-bottom: 1rem;
    }

    header {
        padding: 0.5rem;
        flex-direction: column;
        gap: 0.5rem;
    }

    .hamburger {
        position: static;
        align-self: flex-start;
    }

    h1 {
        font-size: 1.2rem;
    }

    .logo {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 480px) {
    .grades-grid {
        grid-template-columns: 1fr;
    }

    .grade-card {
        padding: 1rem 0.5rem;
        font-size: 0.9rem;
    }

    .videos {
        gap: 0.5rem;
    }

    .video-item iframe,
    .video-item video {
        height: 150px;
    }

    header {
        padding: 0.5rem;
    }

    h1 {
        font-size: 1rem;
    }

    .sidebar {
        width: 100%;
        right: -100%;
    }

    .sidebar.active {
        right: 0;
    }

    .footer-content {
        padding: 0 0.5rem;
        gap: 0.5rem;
    }

    .whatsapp-link {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }
}

/* Responsive sidebar widths for different devices */
@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar {
        width: 280px;
        right: -280px;
    }
}

@media (min-width: 1025px) and (max-width: 1440px) {
    .sidebar {
        width: 320px;
        right: -320px;
    }
}

@media (min-width: 1441px) {
    .sidebar {
        width: 350px;
        right: -350px;
    }
}

@keyframes slideInRight {
    from { transform: translateX(30px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.sidebar-section {
    margin-bottom: 1.5rem;
}

.sidebar-section h3 {
    margin-top: 0;
    color: var(--sidebar-text);
    position: relative;
}

.sidebar-section h3::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 30px;
    height: 2px;
    background: var(--accent-color);
    animation: grow 0.5s ease-out;
}

@keyframes grow {
    from { width: 0; }
    to { width: 30px; }
}

.sidebar-section a {
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.3s ease;
    position: relative;
}

.sidebar-section a::before {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent-color);
    transition: width 0.3s ease;
}

.sidebar-section a:hover::before {
    width: 100%;
}

.sidebar-section a:hover {
    color: var(--accent-color);
}

/* Form styles */
form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 400px;
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

label {
    font-weight: bold;
    color: var(--text-color);
}

input, select, button {
    padding: 0.75rem;
    border: 2px solid var(--input-border);
    border-radius: 8px;
    background-color: var(--input-bg);
    color: var(--input-text);
    transition: all 0.3s ease;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 10px rgba(74, 144, 226, 0.3);
}

button {
    background: linear-gradient(135deg, var(--button-bg), var(--button-accent));
    color: var(--button-text);
    cursor: pointer;
    border: none;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

button:hover::before {
    left: 100%;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

button:active {
    transform: translateY(0);
}

/* Light theme */
:root {
    --bg-color: #f0f8ff;
    --text-color: #2c3e50;
    --header-bg: #667eea;
    --header-accent: #764ba2;
    --header-text: #fff;
    --card-bg: #ffffff;
    --sidebar-bg: #f8f9fa;
    --sidebar-accent: #e9ecef;
    --sidebar-text: #495057;
    --link-color: #667eea;
    --accent-color: #ff6b6b;
    --input-bg: #ffffff;
    --input-text: #2c3e50;
    --input-border: #dee2e6;
    --button-bg: #667eea;
    --button-accent: #764ba2;
    --button-text: #fff;
    --button-hover: #5a67d8;
}

/* Dark theme */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #1a1a2e;
        --text-color: #e0e0e0;
        --header-bg: #16213e;
        --header-accent: #0f3460;
        --header-text: #fff;
        --card-bg: #0f3460;
        --sidebar-bg: #16213e;
        --sidebar-accent: #1a1a2e;
        --sidebar-text: #e0e0e0;
        --link-color: #5dade2;
        --accent-color: #ff6b6b;
        --input-bg: #0f3460;
        --input-text: #e0e0e0;
        --input-border: #333;
        --button-bg: #5dade2;
        --button-accent: #3498db;
        --button-text: #fff;
        --button-hover: #2980b9;
    }
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
}

/* Loading and error states */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--accent-color);
    font-weight: bold;
}

.error {
    text-align: center;
    padding: 2rem;
    color: #e74c3c;
    background-color: rgba(231, 76, 60, 0.1);
    border-radius: 8px;
    margin: 1rem 0;
}

.no-videos {
    text-align: center;
    padding: 2rem;
    color: var(--text-color);
    font-style: italic;
    background-color: var(--card-bg);
    border-radius: 8px;
    margin: 1rem 0;
}

/* Footer styles */
footer {
    background: linear-gradient(135deg, var(--header-bg), var(--header-accent));
    color: var(--header-text);
    padding: 1.5rem 0;
    margin-top: 3rem;
    text-align: center;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.footer-content p {
    margin: 0;
    font-size: 0.9rem;
}

.whatsapp-link {
    color: var(--header-text);
    text-decoration: none;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 25px;
    transition: all 0.3s ease;
    font-weight: bold;
}

.whatsapp-link:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* Auth forms styles */
.auth-container {
    max-width: 400px;
    margin: 2rem auto;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.auth-tabs {
    display: flex;
    background: var(--header-bg);
}

.auth-tab {
    flex: 1;
    padding: 1rem;
    background: none;
    border: none;
    color: var(--header-text);
    cursor: pointer;
    transition: background-color 0.3s;
}

.auth-tab.active {
    background: var(--accent-color);
}

.auth-form {
    padding: 2rem;
}

.auth-form.hidden {
    display: none;
}

.auth-form h2 {
    margin-top: 0;
    color: var(--text-color);
}

.auth-form form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-form label {
    font-weight: bold;
    color: var(--text-color);
}

.auth-form input,
.auth-form select {
    padding: 0.75rem;
    border: 2px solid var(--input-border);
    border-radius: 8px;
    background-color: var(--input-bg);
    color: var(--input-text);
    transition: border-color 0.3s;
}

.auth-form input:focus,
.auth-form select:focus {
    outline: none;
    border-color: var(--accent-color);
}

.auth-form button {
    padding: 0.75rem;
    background: linear-gradient(135deg, var(--button-bg), var(--button-accent));
    color: var(--button-text);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.3s;
}

.auth-form button:hover {
    transform: translateY(-2px);
}

.error-message {
    color: #e74c3c;
    font-weight: bold;
    margin-top: 0.5rem;
}
