:root {
    --primary: #1e6fd9;
    --primary-dark: #1557b0;
    --primary-light: #e8f2ff;
    --text-dark: #1a2b4a;
    --text-muted: #6b7c93;
    --border: #e2e8f0;
    --body-bg: #ffffff;
    --surface: #ffffff;
    --surface-muted: #f8fafc;
    --surface-hover: #f1f5f9;
    --navbar-bg: #ffffff;
    --hero-bg: linear-gradient(135deg, #f8fbff 0%, #e8f2ff 100%);
    --auth-bg: linear-gradient(135deg, #f8fbff 0%, #e8f2ff 100%);
    --loader-bg: #ffffff;
    --radius: 12px;
    --shadow: 0 4px 24px rgba(30, 111, 217, 0.08);
    --transition: all 0.3s ease;
}

[data-theme="dark"] {
    --primary: #4a9eff;
    --primary-dark: #1e6fd9;
    --primary-light: rgba(74, 158, 255, 0.15);
    --text-dark: #e8eef7;
    --text-muted: #94a3b8;
    --border: #334155;
    --body-bg: #0f172a;
    --surface: #1e293b;
    --surface-muted: #162032;
    --surface-hover: #273449;
    --navbar-bg: #1e293b;
    --hero-bg: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --auth-bg: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --loader-bg: #0f172a;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--text-dark);
    background: var(--body-bg);
    line-height: 1.6;
}

/* Loader */
.page-loader {
    position: fixed;
    inset: 0;
    background: var(--loader-bg);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}
.page-loader.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-spinner {
    width: 48px; height: 48px;
    border: 4px solid var(--primary-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Navbar */
.site-navbar {
    padding: 0.75rem 0;
    transition: var(--transition);
    background: var(--navbar-bg) !important;
    border-bottom: 1px solid var(--border);
}
.navbar { padding: 0.75rem 0; transition: var(--transition); }
[data-theme="dark"] .navbar-toggler-icon {
    filter: invert(1);
}
.navbar-brand { font-weight: 700; color: var(--text-dark) !important; }
.site-logo-link {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
    line-height: 1;
}
/* ── Website logo sizing (aspect ratio preserved via max-height + width:auto) ──
   Change these values to adjust logo size manually in code.
   Default image file: LMS.Web/wwwroot/images/mylondonexam-logo.png
   Admin upload path:  Admin → System Settings → Logo (overrides default)
   See README.md → "Website logo & sizing" */
.site-logo {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    object-fit: contain;
}
.site-logo--navbar { max-height: 56px; }      /* Public header (desktop) */
.site-logo--footer { max-height: 64px; }      /* Footer */
.site-logo--auth {
    max-height: 56px;                         /* Login / auth cards */
    margin: 0 auto 1rem;
}
.site-logo--auth-panel {
    max-height: 72px;                         /* Auth split left panel */
    margin-bottom: 1.25rem;
}
.site-logo--sidebar { max-height: 48px; }     /* Admin/Manager/Teacher/Student sidebar */
.brand-icon {
    width: 40px; height: 40px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem;
}
.nav-link {
    font-weight: 500;
    color: var(--text-muted) !important;
    padding: 0.5rem 1rem !important;
    border-radius: 8px;
    transition: var(--transition);
}
.nav-link:hover, .nav-link.active { color: var(--primary) !important; background: var(--primary-light); }
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    border-radius: 8px;
    font-weight: 600;
    transition: var(--transition);
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); transform: translateY(-1px); }
.btn-outline-primary { border-radius: 8px; font-weight: 600; color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); border-color: var(--primary); }

/* Hero */
.hero-section {
    background: var(--hero-bg);
    padding: 4rem 0;
    overflow: hidden;
}
.min-vh-75 { min-height: 75vh; display: flex; align-items: center; }
.hero-badge {
    display: inline-block;
    background: var(--primary-light);
    color: var(--primary);
    padding: 0.35rem 1rem;
    border-radius: 50px;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 1rem;
}
.hero-title { font-size: clamp(2rem, 5vw, 3.25rem); font-weight: 800; line-height: 1.15; margin-bottom: 1rem; }
.hero-subtitle { font-size: 1.15rem; color: var(--text-muted); max-width: 540px; }
.hero-visual {
    background: linear-gradient(135deg, var(--primary), #4a9eff);
    border-radius: 24px;
    height: 320px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow);
}
.hero-visual-icon { font-size: 8rem; color: rgba(255,255,255,0.9); }

/* Animations */
.animate-fade-up { animation: fadeUp 0.6s ease forwards; opacity: 0; }
.delay-1 { animation-delay: 0.15s; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }

/* Stats */
.stats-section { margin-top: -3rem; position: relative; z-index: 2; }
.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.75rem;
    text-align: center;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: var(--transition);
}
.stat-card:hover { transform: translateY(-4px); box-shadow: 0 8px 32px rgba(30,111,217,0.15); }
.stat-icon { font-size: 2rem; color: var(--primary); margin-bottom: 0.5rem; }
.stat-value { font-size: 2.25rem; font-weight: 800; color: var(--text-dark); }
.stat-label { color: var(--text-muted); font-size: 0.9rem; font-weight: 500; }

/* Sections */
.section-padding { padding: 5rem 0; }
.section-header { max-width: 600px; margin: 0 auto; }
.section-title { font-weight: 800; font-size: 2rem; margin-bottom: 0.5rem; }
.section-title-sm { font-weight: 700; font-size: 1.35rem; }
.section-subtitle { color: var(--text-muted); }

.page-hero {
    background: linear-gradient(135deg, var(--primary) 0%, #4a9eff 100%);
    color: #fff;
    padding: 4rem 0;
}
.page-hero h1 { font-weight: 800; margin-bottom: 0.5rem; }
.page-hero .lead { opacity: 0.9; margin-bottom: 0; }
.breadcrumb-light .breadcrumb-item a { color: rgba(255,255,255,0.8); text-decoration: none; }
.breadcrumb-light .breadcrumb-item.active { color: #fff; }

/* Cards */
.partner-card, .announcement-card, .course-card, .feature-card, .teacher-card, .content-card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 1.5rem;
    transition: var(--transition);
}
.partner-card { cursor: pointer; }
.partner-card:hover, .announcement-card:hover, .course-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
    border-color: var(--primary-light);
}
.partner-logo img { height: 56px; object-fit: contain; margin-bottom: 1rem; }
.partner-name { font-weight: 700; }
.partner-desc { color: var(--text-muted); font-size: 0.9rem; }
.partner-meta { display: flex; gap: 1rem; font-size: 0.85rem; color: var(--text-muted); margin-top: 0.75rem; }
.announcement-title { font-weight: 700; font-size: 1.1rem; }
.announcement-date { font-size: 0.85rem; color: var(--text-muted); }
.announcement-summary { color: var(--text-muted); font-size: 0.95rem; }

.filter-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}
.form-select, .form-control {
    border-radius: 8px;
    border-color: var(--border);
    background: var(--surface);
    color: var(--text-dark);
}
[data-theme="dark"] .form-select,
[data-theme="dark"] .form-control {
    background: var(--surface-muted);
    border-color: var(--border);
    color: var(--text-dark);
}
[data-theme="dark"] .form-control::placeholder {
    color: var(--text-muted);
}
[data-theme="dark"] .form-control:-webkit-autofill,
[data-theme="dark"] .form-control:-webkit-autofill:hover,
[data-theme="dark"] .form-control:-webkit-autofill:focus {
    -webkit-text-fill-color: #ffffff !important;
    caret-color: #ffffff;
    -webkit-box-shadow: 0 0 0 1000px var(--surface-muted) inset !important;
    box-shadow: 0 0 0 1000px var(--surface-muted) inset !important;
}
.form-select:focus, .form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }

/* Course cards */
.course-header { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: 1rem; }
.course-logo { width: 48px; height: 48px; object-fit: contain; }
.course-meta { display: grid; gap: 0.35rem; font-size: 0.9rem; color: var(--text-muted); margin-bottom: 1rem; }
.course-meta i { color: var(--primary); margin-right: 0.35rem; }
.course-availability { font-size: 0.875rem; font-weight: 600; padding: 0.5rem; border-radius: 8px; }
.course-availability.available { background: #ecfdf5; color: #059669; }
.course-availability.full { background: #fef2f2; color: #dc2626; }
.course-detail-logo { width: 72px; height: 72px; object-fit: contain; background: var(--surface); border-radius: 12px; padding: 8px; }
[data-theme="dark"] .course-accordion .accordion-button {
    background: var(--surface-muted);
    color: var(--text-dark);
}
[data-theme="dark"] .course-accordion .accordion-button:not(.collapsed) {
    background: var(--primary-light);
    color: var(--primary);
}
[data-theme="dark"] .accordion-body {
    background: var(--surface);
    color: var(--text-dark);
}
.course-accordion .accordion-item { border-radius: var(--radius) !important; margin-bottom: 0.75rem; overflow: hidden; border: 1px solid var(--border) !important; }
.course-accordion .accordion-button { font-weight: 600; }
.course-accordion .accordion-button:not(.collapsed) { background: var(--primary-light); color: var(--primary); }
.lesson-list { display: flex; flex-direction: column; gap: 0.75rem; }
.lesson-item {
    display: flex; align-items: center; gap: 1rem;
    padding: 0.75rem; background: var(--surface-muted); border-radius: 8px;
}
.lesson-number {
    width: 32px; height: 32px; background: var(--primary);
    color: #fff; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.85rem; flex-shrink: 0;
}

/* About */
.feature-card { padding: 2rem; }
.feature-icon {
    width: 64px; height: 64px; background: var(--primary-light);
    color: var(--primary); border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.75rem; margin: 0 auto 1rem;
}
.gallery-card { position: relative; border-radius: var(--radius); overflow: hidden; aspect-ratio: 4/3; }
.gallery-card img { width: 100%; height: 100%; object-fit: cover; transition: var(--transition); }
.gallery-card:hover img { transform: scale(1.05); }
.gallery-overlay {
    position: absolute; bottom: 0; left: 0; right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    color: #fff; padding: 1rem; font-size: 0.875rem; font-weight: 600;
}
.teacher-card { overflow: hidden; padding: 0; }
.teacher-photo { height: 200px; overflow: hidden; }
.teacher-photo img { width: 100%; height: 100%; object-fit: cover; }
.teacher-info { padding: 1.25rem; }
.teacher-subjects { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.5rem; }
.about-content p { margin-bottom: 1rem; }

/* Notices */
.notice-item {
    padding: 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1rem;
    transition: var(--transition);
}
.notice-item:hover { border-color: var(--primary-light); box-shadow: var(--shadow); }
.notice-item h5 a { color: var(--text-dark); text-decoration: none; }
.notice-item h5 a:hover { color: var(--primary); }

/* Timetable */
.timetable-wrapper { border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; }
.timetable-table { margin-bottom: 0; font-size: 0.85rem; }
.timetable-table th { background: var(--primary); color: #fff; text-align: center; padding: 0.75rem; white-space: nowrap; }
.timetable-table .time-col { background: var(--surface-muted); width: 120px; }
.timetable-table td { vertical-align: top; padding: 0.5rem; border-color: var(--border); min-width: 120px; }
.timetable-table td.has-class { background: var(--primary-light); }
.tt-class { display: flex; flex-direction: column; gap: 0.15rem; }
.tt-class strong { color: var(--primary-dark); font-size: 0.8rem; }
.tt-class small { color: var(--text-muted); font-size: 0.75rem; }

/* Contact */
.contact-info-card, .content-card { box-shadow: var(--shadow); }
.contact-item { display: flex; gap: 1rem; margin-bottom: 1.25rem; }
.contact-item i { font-size: 1.25rem; color: var(--primary); flex-shrink: 0; margin-top: 0.15rem; }
.contact-hours { background: none; border: none; font-family: inherit; font-size: inherit; white-space: pre-line; color: var(--text-muted); }
.social-links { display: flex; gap: 0.75rem; }
.social-links a {
    width: 40px; height: 40px; background: var(--primary-light);
    color: var(--primary); border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    text-decoration: none; transition: var(--transition);
}
.social-links a:hover { background: var(--primary); color: #fff; }
.template-placeholder {
    background: #fef3c7; color: #92400e;
    padding: 0.1rem 0.35rem; border-radius: 4px;
    font-family: monospace; font-size: 0.85em;
}
.template-editor { font-family: inherit; line-height: 1.8; }
.map-container { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }

/* Footer */
.site-footer { background: var(--text-dark); color: #fff; padding: 4rem 0 2rem; margin-top: 3rem; }
.footer-title { font-weight: 700; margin-bottom: 1rem; }
.footer-subtitle { font-weight: 600; margin-bottom: 1rem; color: rgba(255,255,255,0.9); }
.footer-links li { margin-bottom: 0.5rem; }
.footer-links a { color: rgba(255,255,255,0.6); text-decoration: none; transition: var(--transition); }
.footer-links a:hover { color: #fff; }

/* Auth */
.auth-body {
    min-height: 100vh;
    background: var(--auth-bg);
    display: flex; align-items: center; justify-content: center;
    padding: 2rem 1rem;
  position: relative;
}
.auth-theme-toggle {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 1050;
}
.auth-container { width: 100%; max-width: 480px; }
.auth-card {
    background: var(--surface);
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}
.auth-logo {
    width: 64px; height: 64px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.75rem;
    margin: 0 auto 1rem;
}

@media (max-width: 768px) {
    .section-padding { padding: 3rem 0; }
    .stats-section { margin-top: -1.5rem; }
    .hero-section { padding: 2.5rem 0; }
    .timetable-table { font-size: 0.75rem; }
    .site-logo--navbar { max-height: 44px; }   /* Public header (mobile/tablet) */
    .site-logo--auth-panel { max-height: 56px; }
    .site-logo--footer { max-height: 52px; }
}

/* Theme toggle */
.theme-toggle-btn {
    width: 42px;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: transform 0.35s ease, background-color 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease;
    box-shadow: var(--shadow);
}
.theme-toggle-btn:hover {
    transform: scale(1.08);
    border-color: var(--primary);
    box-shadow: 0 6px 20px rgba(30, 111, 217, 0.2);
}
.theme-toggle-btn:active {
    transform: scale(0.95);
}
.theme-icon-wrap {
    position: relative;
    width: 20px;
    height: 20px;
    display: block;
}
.theme-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: opacity 0.4s ease, transform 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}
[data-theme="light"] .theme-icon-sun {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}
[data-theme="light"] .theme-icon-moon {
    opacity: 0;
    transform: rotate(90deg) scale(0.3);
}
[data-theme="dark"] .theme-icon-sun {
    opacity: 0;
    transform: rotate(-90deg) scale(0.3);
}
[data-theme="dark"] .theme-icon-moon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}
.theme-toggle-btn.toggling {
    animation: themePulse 0.5s ease;
}
@keyframes themePulse {
    0% { transform: scale(1); }
    40% { transform: scale(1.15) rotate(15deg); }
    100% { transform: scale(1); }
}

[data-theme="dark"] .bg-light {
    background-color: var(--surface-muted) !important;
}
[data-theme="dark"] .text-muted {
    color: var(--text-muted) !important;
}
[data-theme="dark"] .btn-outline-secondary {
    color: var(--text-dark);
    border-color: var(--border);
}
[data-theme="dark"] .btn-link {
    color: var(--primary);
}
[data-theme="dark"] .alert-danger {
    background: rgba(220, 38, 38, 0.15);
    border-color: rgba(220, 38, 38, 0.35);
    color: #fca5a5;
}
