:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --accent: #f59e0b;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --glass: rgba(30, 41, 59, 0.7);
    --border: rgba(255, 255, 255, 0.1);
    --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Noto Sans Arabic', 'Outfit', sans-serif;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
}

/* Splash Screen */
.splash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-dark);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.6s ease-out, visibility 0.6s;
}

.splash.hidden {
    opacity: 0;
    visibility: hidden;
}

.splash-content {
    text-align: center;
    animation: fadeInScale 0.8s ease-out;
}

.splash-logo {
    width: 120px;
    height: 120px;
    margin-bottom: 20px;
    filter: drop-shadow(0 0 20px rgba(37, 99, 235, 0.4));
}

.splash-title {
    font-family: 'Outfit', sans-serif;
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(to right, #60a5fa, #2563eb);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 30px;
}

.loader {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    margin: 0 auto;
    animation: spin 1s linear infinite;
}

/* Header */
.header {
    position: sticky;
    top: 0;
    background: var(--glass);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    z-index: 100;
    padding: 15px 0;
}

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

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo {
    width: 36px;
    height: 36px;
}

.brand-name {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.5px;
}

.search-bar {
    position: relative;
    width: 100%;
    max-width: 400px;
}

.search-bar input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 45px 10px 15px;
    color: white;
    font-family: inherit;
    transition: all 0.3s;
}

.search-bar input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.1);
}

.search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    fill: var(--text-muted);
}

/* Main Content */
.main-content {
    max-width: 1200px;
    margin: 30px auto 100px;
    padding: 0 20px;
}

.filters {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    overflow-x: auto;
    padding-bottom: 5px;
}

.filter-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 8px 20px;
    border-radius: 999px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    white-space: nowrap;
    transition: all 0.3s;
}

.filter-btn:hover {
    border-color: var(--primary);
    color: white;
}

.filter-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* Grid */
.subjects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.subject-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 24px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.subject-card:hover {
    transform: translateY(-10px);
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.subject-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.1) 0%, transparent 70%);
    z-index: 0;
}

.subject-header {
    margin-bottom: 15px;
}

.grade-badge {
    display: inline-block;
    padding: 4px 10px;
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 6px;
    margin-bottom: 10px;
}

.subject-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.subject-stats {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.unit-list {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.unit-item {
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.unit-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--border);
}

.unit-title-small {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 5px;
}

.lesson-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.lesson-btn {
    font-size: 0.75rem;
    padding: 4px 10px;
    background: rgba(37, 99, 235, 0.1);
    color: #60a5fa;
    border-radius: 4px;
    text-decoration: none;
    transition: all 0.2s;
}

.lesson-btn:hover {
    background: var(--primary);
    color: white;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: none;
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    width: 95%;
    height: 90%;
    max-width: 1000px;
    background: white;
    border-radius: 24px;
    position: relative;
    overflow: hidden;
    animation: modalIn 0.4s ease-out;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    background: var(--bg-dark);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.close-btn svg {
    width: 24px;
    height: 24px;
    fill: white;
}

#lesson-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Mobile Nav */
.mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--glass);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    padding: 12px 0 25px;
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-muted);
    text-decoration: none;
    gap: 4px;
    transition: all 0.3s;
}

.nav-item svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.nav-item span {
    font-size: 0.7rem;
    font-weight: 600;
}

.nav-item.active {
    color: var(--primary);
}

/* Animations */
@keyframes spin {
    100% { transform: rotate(360deg); }
}

@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(50px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
    }
    .search-bar {
        max-width: 100%;
    }
    .main-content {
        margin-top: 20px;
    }
    .brand-name {
        font-size: 1.1rem;
    }
    .splash-title {
        font-size: 2rem;
    }
}
