/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f7fa;
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

.nav-bar {
    display: none !important;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.container.has-sidebar {
    max-width: 100%;
    padding-left: 0;
    padding-right: 0;
}

.layout {
    display: grid;
    grid-template-columns: minmax(260px, 280px) 1fr;
    gap: 1.75rem;
    align-items: start;
    width: 100%;
    min-height: 100vh;
}

.sidebar-container {
    position: sticky;
    top: 0;
    align-self: stretch;
    height: 100vh;
}

.container.has-sidebar .layout {
    grid-template-columns: minmax(270px, 300px) minmax(0, 1fr);
}

.content-area {
    width: 100%;
    padding-right: 20px;
}

.container.has-sidebar .content-area {
    padding-top: max(2rem, env(safe-area-inset-top));
    padding-bottom: max(2rem, env(safe-area-inset-bottom));
    padding-left: 1.5rem;
}

/* Navigation */
.layout nav.nav-links {
    position: sticky;
    top: 0;
    align-self: start;
    width: 100%;
    max-width: 300px;
    background: linear-gradient(180deg, #0f172a 0%, #1f2a44 60%, #273654 100%);
    flex-direction: column;
    padding: 1.25rem 0.75rem 1.5rem;
    padding-top: 0;
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
    box-shadow: 0 12px 28px rgba(0,0,0,0.2);
    border-right: 1px solid rgba(255,255,255,0.08);
    z-index: 10;
    min-height: 100%;
    max-height: 100%;
    height: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.nav-middle {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex: 1;
}

.nav-bottom {
    margin-top: auto;
}

.nav-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.75rem 0.75rem 0.85rem 0.75rem;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}

.nav-heading {
    color: rgba(255,255,255,0.7);
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 0 1rem;
    margin: 0.25rem 0;
}

.layout nav.nav-links a {
    color: white;
    text-decoration: none;
    transition: color 0.25s, background-color 0.25s, transform 0.25s;
    padding: 0.9rem 1rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    position: relative;
}

.layout nav.nav-links a:hover {
    color: #9bc3ff;
    background-color: rgba(255, 255, 255, 0.08);
    transform: translateX(4px);
    box-shadow: 0 8px 18px rgba(0,0,0,0.14);
}

.layout nav.nav-links a::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: linear-gradient(135deg, #72e0ff, #a683ff);
    opacity: 0.7;
    box-shadow: 0 0 0 rgba(114,224,255,0.35);
    transition: transform 0.25s ease, opacity 0.25s ease, box-shadow 0.25s ease;
}

.layout nav.nav-links a:hover::before {
    transform: scale(1.2);
    opacity: 1;
    box-shadow: 0 0 0 6px rgba(114,224,255,0.18);
}

.nav-top {
    padding: 0.5rem 0.75rem 0.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.nav-logo-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-logo-mark {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    object-fit: contain;
    padding: 4px;
}

.nav-app-name {
    color: #f8fbff;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    margin-bottom: 0.1rem;
}

.nav-app-subtitle {
    color: rgba(255,255,255,0.7);
    font-size: 0.9rem;
}

.nav-user-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 0.9rem;
    background: rgba(255,255,255,0.06);
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.nav-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #a1c4fd 0%, #c2e9fb 100%);
    display: grid;
    place-items: center;
    color: #0f172a;
    font-weight: 800;
    letter-spacing: 0.3px;
}

.nav-user-name {
    color: #f8fbff;
    font-weight: 700;
    font-size: 1rem;
}

.nav-user-role {
    color: rgba(255,255,255,0.65);
    font-size: 0.9rem;
}

.nav-cta {
    background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 40%, #2563eb 100%);
    box-shadow: 0 12px 30px rgba(79, 70, 229, 0.35);
    border: none;
}

.quick-nav {
    margin: 1rem 0 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    background: white;
    padding: 0.75rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    position: sticky;
    top: max(10px, env(safe-area-inset-top));
    z-index: 950;
}

.quick-nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 0.85rem;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4ecff 100%);
    color: #1f2d3d;
    text-decoration: none;
    border-radius: 10px;
    border: 1px solid #dce4f2;
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.quick-nav-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(102, 126, 234, 0.15);
}

.search-box {
    display: flex;
    gap: 0.5rem;
}

.search-input {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    min-width: 200px;
}

.search-btn {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

.search-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* Main Content */
main {
    padding: 2rem 0;
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
    min-height: calc(100vh - 100px);
    margin-top: 0;
    padding-top: max(2rem, env(safe-area-inset-top));
}

main.container.has-sidebar {
    padding: 0;
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 3rem 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 0.85rem;
    margin-bottom: 1.6rem;
}

.stat-card {
    background: white;
    padding: 0.9rem;
    border-radius: 7px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

.stat-card h3 {
    color: #2c3e50;
    margin-bottom: 0.4rem;
    font-size: 0.95rem;
}

.stat-card p {
    color: #7f8c8d;
    font-size: 0.95rem;
}

/* Curriculum Section */
.curriculum-section {
    margin: 3rem 0;
}

.curriculum-section h2 {
    margin-bottom: 1.5rem;
    color: #2c3e50;
}


.curriculum-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.1rem;
}

.curriculum-card {
    background: white;
    padding: 1.25rem;
    border-radius: 7px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    transition: transform 0.3s, box-shadow 0.3s;
}

.curriculum-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.curriculum-card h3 {
    color: #2c3e50;
    margin-bottom: 0.4rem;
    font-size: 1.05rem;
}

.curriculum-card p {
    color: #7f8c8d;
    margin-bottom: 0.8rem;
    font-size: 0.97rem;
}

/* Subjects Grid */
.subjects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.1rem;
    margin-top: 1.6rem;
}

.subject-card {
    background: white;
    padding: 1.25rem;
    border-radius: 7px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    transition: transform 0.3s, box-shadow 0.3s;
}

.subject-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.subject-card h2 {
    color: #2c3e50;
    margin-bottom: 0.8rem;
    font-size: 1.25rem;
}

.subject-description {
    color: #555;
    margin-bottom: 0.8rem;
    line-height: 1.5;
    font-size: 0.98rem;
}

.topic-count {
    color: #7f8c8d;
    font-weight: bold;
    margin-bottom: 1rem;
}

/* Topics Section */
.topics-section {
    margin-top: 1.6rem;
}

.topics-section h2 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
}

.topics-grid {
    display: grid;
    gap: 0.85rem;
}

.topic-card {
    background: white;
    padding: 1rem;
    border-radius: 7px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    transition: transform 0.3s, box-shadow 0.3s;
}

.topic-card:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.topic-number {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
    font-size: 0.95rem;
}

.topic-content {
    flex: 1;
}

.topic-content h3 {
    color: #2c3e50;
    margin-bottom: 0.4rem;
    font-size: 1.05rem;
}

.topic-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* Recent Topics */
.recent-topics {
    margin: 3rem 0;
}

.recent-topics h2 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
}

.topics-list {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

.topic-item {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #ecf0f1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.topic-item:last-child {
    border-bottom: none;
}

.topic-item:hover {
    background-color: #f8f9fa;
}

.topic-name {
    color: #2c3e50;
    font-weight: 500;
}

.status {
    color: #27ae60;
    font-size: 0.9rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* Breadcrumb */
.breadcrumb {
    padding: 1rem 0;
    color: #7f8c8d;
}

.breadcrumb a {
    color: #667eea;
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

/* Subject Header */
.subject-header {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.subject-header h1 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.subject-level {
    color: #7f8c8d;
    font-size: 1.1rem;
}

/* Info Section */
.info-section {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
}

.info-section h2 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.info-section p {
    color: #555;
    line-height: 1.8;
}

/* Content Display */
.content-header {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.content-header h1 {
    color: #2c3e50;
}

.badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
}

.content-display {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.content-section {
    margin-bottom: 2rem;
}

.content-section h2 {
    color: #2c3e50;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #ecf0f1;
}

.content-text {
    color: #555;
    line-height: 1.8;
    white-space: pre-wrap;
}

.content-list {
    list-style-position: inside;
    color: #555;
}

.content-list li {
    margin-bottom: 0.5rem;
    padding-left: 1rem;
}

.nested-content {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 4px;
    margin-top: 0.5rem;
}

.nested-item {
    margin-bottom: 0.5rem;
    color: #555;
}

/* Search Results */
.search-page {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.search-query {
    color: #7f8c8d;
    margin-bottom: 2rem;
}

.search-results {
    margin-top: 2rem;
}

.search-result-item {
    padding: 1.5rem;
    border-bottom: 1px solid #ecf0f1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.search-result-item:last-child {
    border-bottom: none;
}

.result-type {
    background-color: #ecf0f1;
    color: #7f8c8d;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.85rem;
    margin-right: 1rem;
}

.search-result-item h3 {
    color: #2c3e50;
    flex: 1;
}

.no-results {
    text-align: center;
    padding: 3rem;
    color: #7f8c8d;
}

.error-message {
    background: white;
    padding: 3rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
}

/* Footer */
footer {
    background-color: #2c3e50;
    color: white;
    padding: 2rem 0;
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    padding-bottom: max(2rem, env(safe-area-inset-bottom));
    margin-top: 3rem;
    text-align: center;
}

/* ===================================
   WELCOME / LANDING PAGE STYLES
   =================================== */
.welcome-nav {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #e8eef6;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
}

.welcome-nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.welcome-logo h2 {
    margin: 0;
    font-size: 1.35rem;
    color: #1f2937;
}

.welcome-nav-menu {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.welcome-nav-links {
    list-style: none;
    display: flex;
    gap: 1rem;
    align-items: center;
}

.welcome-nav a {
    color: #111827;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease, transform 0.2s ease;
}

.welcome-nav a:hover {
    color: #2563eb;
    transform: translateY(-1px);
}

.btn-get-started-nav,
.btn-get-started-hero {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.85rem 1.4rem;
    border-radius: 12px;
    background: linear-gradient(135deg, #4f46e5 0%, #2563eb 100%);
    color: white !important;
    font-weight: 700;
    border: none;
    box-shadow: 0 10px 30px rgba(37, 99, 235, 0.25);
}

.welcome-hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
}

.welcome-hamburger span {
    width: 22px;
    height: 2px;
    background: #111827;
    border-radius: 2px;
}

.hero-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    align-items: center;
    gap: 2rem;
    padding: 3rem 20px 2rem;
    background: linear-gradient(135deg, #eef2ff 0%, #e0f2fe 100%);
    border-radius: 24px;
    margin-top: 1.5rem;
}

.hero-content {
    max-width: 560px;
}

.hero-title {
    font-size: clamp(2rem, 3vw, 2.75rem);
    color: #0f172a;
    line-height: 1.2;
    margin-bottom: 1rem;
}

.hero-subtitle {
    color: #334155;
    font-size: 1.05rem;
    margin-bottom: 1.5rem;
}

.hero-decoration {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    justify-items: center;
}

.floating-card {
    width: 130px;
    height: 110px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    font-size: 2rem;
    background: white;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.08);
}

.section-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 20px;
}

.section-title {
    font-size: 2rem;
    color: #0f172a;
    margin-bottom: 0.5rem;
}

.section-subtitle {
    color: #475569;
    margin-bottom: 2rem;
}

.features-grid,
.services-grid,
.partner-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
}

.feature-card,
.service-item,
.partner-card {
    background: white;
    padding: 1.5rem;
    border-radius: 18px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    border: 1px solid #e5e7eb;
}

.feature-icon,
.service-icon,
.partner-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: #eef2ff;
    font-size: 1.35rem;
    margin-bottom: 0.75rem;
}

.about-section .about-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    align-items: center;
}

.about-text p {
    color: #475569;
    margin-bottom: 1rem;
}

.about-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.stat-item {
    background: #f8fafc;
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
}

.stat-number {
    font-size: 1.5rem;
    font-weight: 800;
    color: #1d4ed8;
}

.btn-view-details {
    padding: 0.9rem 1.25rem;
    border-radius: 12px;
    border: none;
    background: #111827;
    color: white;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

.partner-cta {
    margin-top: 2rem;
    padding: 1.5rem;
    border-radius: 16px;
    background: linear-gradient(135deg, #4f46e5 0%, #2563eb 100%);
    color: white;
    display: grid;
    gap: 0.75rem;
}

.cta-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.btn-partner-primary,
.btn-partner-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.85rem 1.2rem;
    border-radius: 12px;
    font-weight: 700;
    text-decoration: none;
}

.btn-partner-primary {
    background: white;
    color: #1f2937;
}

.btn-partner-secondary {
    border: 1px solid rgba(255, 255, 255, 0.6);
    color: white;
}

.faq-container {
    display: grid;
    gap: 1rem;
}

.faq-item {
    background: white;
    border-radius: 14px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05);
}

.faq-question {
    padding: 1rem 1.25rem;
    font-weight: 700;
    color: #0f172a;
    cursor: pointer;
}

.faq-answer {
    padding: 0 1.25rem 1rem;
    color: #475569;
    display: none;
}

.faq-item.active .faq-answer {
    display: block;
}

.contact-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
}

.contact-item {
    background: white;
    padding: 1.25rem;
    border-radius: 14px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.contact-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.welcome-footer {
    background: #0f172a;
    color: white;
    margin-top: 3rem;
    padding: 3rem 20px 2rem;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.footer-section h4 {
    margin-bottom: 0.75rem;
}

.footer-section ul {
    list-style: none;
    display: grid;
    gap: 0.4rem;
    padding: 0;
}

.footer-section a {
    color: #e2e8f0;
    text-decoration: none;
}

.footer-section a:hover {
    color: white;
}

.footer-bottom {
    max-width: 1200px;
    margin: 2rem auto 0;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.subject-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 2000;
}

.subject-overlay.active {
    display: flex;
}

.subject-overlay-content {
    background: white;
    width: min(1000px, 100%);
    max-height: 85vh;
    border-radius: 18px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
}

.overlay-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.overlay-header-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn-download-pdf {
    padding: 0.65rem 1rem;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    background: #0f172a;
    color: white;
    cursor: pointer;
}

.close-overlay-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
}

.overlay-body {
    padding: 1.25rem 1.5rem;
    overflow: auto;
    flex: 1;
}

.loading-spinner {
    text-align: center;
    padding: 2rem 0;
    color: #475569;
}

@media (max-width: 900px) {
    .welcome-nav-menu {
        position: absolute;
        inset: 64px 16px auto;
        background: white;
        border: 1px solid #e5e7eb;
        border-radius: 14px;
        padding: 1rem;
        flex-direction: column;
        align-items: flex-start;
        display: none;
        box-shadow: 0 18px 40px rgba(0, 0, 0, 0.12);
    }

    .welcome-nav-menu.active {
        display: flex;
    }

    .welcome-nav-links {
        flex-direction: column;
        width: 100%;
    }

    .welcome-hamburger {
        display: flex;
    }
}

/* ===================================
   RESPONSIVE TABLES
   =================================== */
table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

table th,
table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #ecf0f1;
}

table tbody tr:hover {
    background-color: #f8f9fa;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ===================================
   RESPONSIVE FORMS
   =================================== */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
select,
textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    border: 2px solid #ddd;
    border-radius: 6px;
    transition: all 0.3s ease;
    box-sizing: border-box;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Touch-friendly buttons */
button,
.btn,
input[type="submit"] {
    min-height: 44px;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    touch-action: manipulation;
}

/* ===================================
   RESPONSIVE IMAGES & MEDIA
   =================================== */
img {
    max-width: 100%;
    height: auto;
}

/* ===================================
   RESPONSIVE DESIGN - MOBILE FIRST
   =================================== */

/* Small Mobile (max-width: 480px) */
@media (max-width: 480px) {
    body {
        font-size: 14px;
    }

    .container {
        padding: 0 15px;
    }

    .sidebar-container {
        position: relative;
        height: auto;
    }

    .layout {
        grid-template-columns: 1fr;
    }

    .layout nav.nav-links {
        position: relative;
        max-width: 100%;
        top: 0;
        box-shadow: 0 8px 20px rgba(0,0,0,0.18);
        min-height: auto;
        max-height: none;
        height: auto;
        overflow: visible;
    }

    .logo {
        font-size: 1.2rem;
    }

    .layout nav.nav-links {
        width: 100%;
        max-width: 100%;
        min-height: auto;
        max-height: none;
        height: auto;
        overflow: visible;
    }

    .search-box {
        flex-direction: column;
        padding: 1rem;
        width: 100%;
    }

    .search-input {
        min-width: 100%;
        width: 100%;
    }

    .search-btn {
        width: 100%;
    }

    .hero h1 {
        font-size: 1.75rem;
        line-height: 1.3;
    }

    .hero p {
        font-size: 1rem;
    }

    .hero {
        padding: 2rem 0;
    }

    main {
        padding: 1rem 0;
    }

    .stats-grid,
    .curriculum-grid,
    .subjects-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .stat-card,
    .curriculum-card,
    .subject-card {
        padding: 1.25rem;
    }

    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        padding: 1.25rem;
    }

    .topic-card {
        flex-direction: column;
        padding: 1rem;
    }

    .topic-actions {
        flex-direction: column;
        width: 100%;
    }

    .topic-actions .btn {
        width: 100%;
    }

    .search-result-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        padding: 1rem;
    }

    .btn {
        width: 100%;
        text-align: center;
    }

    table th,
    table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.875rem;
    }

    .subject-header,
    .info-section,
    .content-display {
        padding: 1.25rem;
    }

    .subject-header h1 {
        font-size: 1.5rem;
    }

    footer {
        padding: 1.5rem 0;
        font-size: 0.875rem;
    }
}

/* Mobile (481px - 767px) */
@media (min-width: 481px) and (max-width: 767px) {
    body {
        font-size: 15px;
    }

    .container {
        padding: 0 20px;
    }

    .logo {
        font-size: 1.3rem;
    }

    .layout nav.nav-links {
        width: 100%;
        max-width: 100%;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .stats-grid,
    .curriculum-grid,
    .subjects-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .topic-card {
        flex-direction: row;
    }

    .topic-actions {
        flex-wrap: wrap;
    }

    .search-result-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}

/* Tablet (768px - 991px) */
@media (min-width: 768px) and (max-width: 991px) {
    .container {
        max-width: 720px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .curriculum-grid,
    .subjects-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Desktop (992px - 1199px) */
@media (min-width: 992px) and (max-width: 1199px) {
    .container {
        max-width: 960px;
    }

    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Large Desktop (1200px and up) */
@media (min-width: 1200px) {
    .container {
        max-width: 1200px;
    }
}

/* ===================================
   TOUCH OPTIMIZATION
   =================================== */
@media (hover: none) and (pointer: coarse) {
    /* Touch devices */
    a,
    button,
    .btn,
    input[type="submit"],
    input[type="button"] {
        min-height: 44px;
        min-width: 44px;
    }

    .topic-card:hover,
    .subject-card:hover,
    .curriculum-card:hover {
        transform: none;
    }

    .topic-card:active,
    .subject-card:active,
    .curriculum-card:active {
        transform: scale(0.98);
    }
}

/* ===================================
   LANDSCAPE ORIENTATION OPTIMIZATIONS
   =================================== */
@media (max-width: 767px) and (orientation: landscape) {
    .hero {
        padding: 1.5rem 0;
    }

    .hero h1 {
        font-size: 1.5rem;
    }

    main {
        padding: 1rem 0;
    }

    .layout nav.nav-links {
        max-height: calc(100vh - 50px);
    }
}

/* ===================================
   PRINT STYLES
   =================================== */
@media print {
    footer,
    .btn,
    button {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }

    .container {
        max-width: 100%;
    }
}

/* Locale bar styles */
.locale-bar {
    background: #f5f7fb;
    border-bottom: 1px solid #e4e7ef;
    padding: 10px 16px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.locale-control {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #374151;
}

.locale-select {
    padding: 6px 10px;
    border: 1px solid #d0d7e2;
    border-radius: 8px;
    background: white;
    font-size: 14px;
    color: #111827;
}

.locale-country-label {
    font-weight: 600;
    color: #111827;
}

.locale-group {
    gap: 6px;
}

.language-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999;
    padding: 16px;
}

.language-modal[aria-hidden="false"] {
    display: flex;
}

.language-modal__dialog {
    background: #ffffff;
    border-radius: 12px;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 10px 40px rgba(17, 24, 39, 0.18);
}

.language-modal__body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.inline-locale label {
    font-weight: 600;
}
