/* --- CSS VARIABLES & RESET --- */
:root {
    --primary-color: #4f46e5;
    --secondary-color: #818cf8;
    --accent-color: #0ea5e9;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-color: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --transition: all 0.3s ease;
}

/* Dark Mode Variables */
body.dark-mode {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --text-color: #f1f5f9;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: var(--transition);
    line-height: 1.6;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }

/* --- NAVIGATION --- */
nav {
    background-color: var(--card-bg);
    padding: 1rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow);
    border-bottom: 1px solid var(--border-color);
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-links {
    display: flex;
    gap: 20px;
}

.nav-links a {
    font-weight: 500;
    transition: var(--transition);
}

.nav-links a:hover {
    color: var(--primary-color);
}

.theme-toggle {
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 20px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    font-size: 0.9rem;
    transition: var(--transition);
}

.theme-toggle:hover {
    background: var(--primary-color);
    color: white;
}

/* --- HERO SECTION --- */
.hero {
    text-align: center;
    padding: 4rem 1rem;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    margin-bottom: 2rem;
}

.hero h1 { font-size: 2.5rem; margin-bottom: 1rem; }
.hero p { font-size: 1.2rem; opacity: 0.9; max-width: 600px; margin: 0 auto; }

/* --- SUBJECT CARDS (HOME) --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.section-title {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 2rem;
    color: var(--text-color);
}

.subject-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 4rem;
}

.card {
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    border-color: var(--primary-color);
}

.card-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.card h3 { margin-bottom: 0.5rem; font-size: 1.5rem; }
.card p { color: var(--text-muted); margin-bottom: 1.5rem; flex-grow: 1; }

.btn {
    display: inline-block;
    padding: 10px 20px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 6px;
    font-weight: 600;
    transition: var(--transition);
    border: none;
    cursor: pointer;
}

.btn:hover {
    background-color: var(--secondary-color);
    transform: scale(1.05);
}

/* --- SUBJECT PAGE LAYOUT --- */
.page-header {
    background-color: var(--card-bg);
    padding: 2rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-header h2 { color: var(--primary-color); }

/* --- CONTENT SECTIONS --- */
.content-section {
    background-color: var(--card-bg);
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.content-section h3 {
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--accent-color);
    padding-left: 10px;
    color: var(--text-color);
}

/* --- TABLES --- */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: var(--bg-color);
    color: var(--primary-color);
    font-weight: 600;
}

tr:hover { background-color: var(--bg-color); }

/* --- SEARCH BAR --- */
.search-container {
    margin-bottom: 1.5rem;
}

#searchInput {
    width: 100%;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    color: var(--text-color);
    font-size: 1rem;
}

/* --- FOOTER --- */
footer {
    background-color: var(--card-bg);
    text-align: center;
    padding: 2rem;
    margin-top: 4rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
}

/* --- BACK TO TOP --- */
#backToTop {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: none;
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 15px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow);
    font-size: 1.2rem;
}

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
    .nav-links { display: none; } /* Simplified for mobile */
    .hero h1 { font-size: 2rem; }
    .page-header { flex-direction: column; gap: 1rem; text-align: center; }
}