/* ===========================================================
   Uganda Mature Entry Exam Hub
   Merged Stylesheet (No Imports)
============================================================ */

/* ===========================================================
   VARIABLES
============================================================ */
:root {
    --primary: #0B3D91;
    --primary-hover: #082C6C;
    --secondary: #38BDF8;
    --secondary-hover: #0EA5E9;
    --accent: #2563EB;
    --success: #16A34A;
    --success-light: #DCFCE7;
    --warning: #F59E0B;
    --warning-light: #FEF3C7;
    --danger: #DC2626;
    --danger-light: #FEE2E2;
    --info: #0284C7;
    --info-light: #E0F2FE;
    --bg-body: #F8FAFC;
    --bg-card: #FFFFFF;
    --bg-card-hover: #F1F5F9;
    --header-bg: #FFFFFF;
    --sidebar-bg: #FFFFFF;
    --footer-bg: #0B3D91;
    --text-primary: #1E293B;
    --text-secondary: #475569;
    --text-muted: #64748B;
    --text-white: #FFFFFF;
    --border-color: #CBD5E1;
    --border-light: #E2E8F0;
    --link-color: var(--primary);
    --link-hover: var(--secondary);
    --btn-primary-bg: var(--primary);
    --btn-primary-hover: var(--primary-hover);
    --btn-secondary-bg: var(--secondary);
    --btn-secondary-hover: var(--secondary-hover);
    --font-heading: 'Merriweather', serif;
    --font-body: 'Inter', sans-serif;
    --fs-xs: .75rem;
    --fs-sm: .875rem;
    --fs-md: 1rem;
    --fs-lg: 1.125rem;
    --fs-xl: 1.5rem;
    --fs-2xl: 2rem;
    --fs-3xl: 2.6rem;
    --fs-4xl: 3.3rem;
    --fw-normal: 400;
    --fw-medium: 500;
    --fw-semibold: 600;
    --fw-bold: 700;
    --lh-normal: 1.6;
    --lh-heading: 1.25;
    --space-xs: .25rem;
    --space-sm: .5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 5rem;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-pill: 50px;
    --radius-circle: 50%;
    --shadow-sm: 0 2px 8px rgba(15,23,42,.06);
    --shadow-md: 0 8px 25px rgba(15,23,42,.10);
    --shadow-lg: 0 20px 45px rgba(15,23,42,.15);
    --transition-fast: .2s ease;
    --transition-normal: .3s ease;
    --transition-slow: .45s ease;
    --header-height: 75px;
    --sidebar-width: 270px;
    --container-width: 1280px;
    --z-dropdown: 1000;
    --z-sticky: 1010;
    --z-fixed: 1020;
    --z-modal: 1050;
    --z-tooltip: 1100;
}

/* ===========================================================
   RESET
============================================================ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font-body); background: var(--bg-body); color: var(--text-primary); line-height: var(--lh-normal); transition: background var(--transition-normal), color var(--transition-normal); }
img { max-width: 100%; display: block; }
a { text-decoration: none; color: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button, input, textarea, select { font-family: inherit; }
button { cursor: pointer; border: none; background: none; }
h1, h2, h3, h4, h5, h6 { margin: 0; line-height: var(--lh-heading); font-family: var(--font-heading); }
p { margin: 0; }

/* ===========================================================
   TYPOGRAPHY
============================================================ */
html { font-size: 16px; }
body { font-family: var(--font-body); font-size: var(--fs-md); font-weight: var(--fw-normal); line-height: var(--lh-normal); color: var(--text-primary); }
h1, h2, h3, h4, h5, h6 { font-family: var(--font-heading); color: var(--text-primary); font-weight: var(--fw-bold); line-height: var(--lh-heading); letter-spacing: -0.02em; }
h1 { font-size: var(--fs-4xl); }
h2 { font-size: var(--fs-3xl); }
h3 { font-size: var(--fs-2xl); }
h4 { font-size: var(--fs-xl); }
h5 { font-size: var(--fs-lg); }
h6 { font-size: var(--fs-md); }
p { color: var(--text-secondary); margin-bottom: 1rem; line-height: 1.8; }
.lead-text { font-size: 1.15rem; line-height: 1.8; color: var(--text-secondary); }
a { color: var(--primary); transition: var(--transition-fast); }
a:hover { color: var(--secondary); }
.text-primary { color: var(--primary); }
.text-secondary { color: var(--secondary); }
.text-muted { color: var(--text-muted); }
.text-white { color: white; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.fw-normal { font-weight: var(--fw-normal); }
.fw-medium { font-weight: var(--fw-medium); }
.fw-semibold { font-weight: var(--fw-semibold); }
.fw-bold { font-weight: var(--fw-bold); }
.section-title { text-align: center; margin-bottom: 1rem; }
.section-description { max-width: 700px; margin: 0 auto; text-align: center; color: var(--text-secondary); }
.hero-content h1 { font-size: clamp(2.2rem, 5vw, 3.8rem); line-height: 1.15; }
.hero-content h1 span { color: var(--secondary); }
.hero-content p { font-size: 1.15rem; max-width: 650px; }
@media(max-width:768px) { h1 { font-size: 2.2rem; } h2 { font-size: 1.8rem; } h3 { font-size: 1.4rem; } body { font-size: .95rem; } }

/* ===========================================================
   LAYOUT
============================================================ */
.container { width: 100%; max-width: var(--container-width); margin: 0 auto; padding-left: 1.25rem; padding-right: 1.25rem; }
.section { padding: var(--space-3xl) 0; }
.bg-light { background: var(--bg-card-hover); }

/* Top Bar */
.top-bar {
    background: var(--primary);
    color: var(--text-white);
    font-size: var(--fs-sm);
    position: relative;
    z-index: 100; /* Ensure top bar sits above the header */
}
.top-bar-content { min-height: 40px; display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.top-contact, .top-actions { display: flex; align-items: center; gap: 1.25rem; }
.top-bar a { color: white; transition: var(--transition-fast); }
.top-bar a:hover { color: var(--secondary); }
.top-register { background: var(--secondary); padding: .35rem .85rem; border-radius: var(--radius-pill); color: #082C6C !important; font-weight: 600; }

/* Header */
.site-header {
    background: var(--header-bg);
    position: sticky;
    top: 0;
    z-index: 50; /* Lower than top-bar */
    border-bottom: 1px solid var(--border-color);
    transition: background var(--transition-normal);
}
.header-container { height: var(--header-height); display: flex; align-items: center; justify-content: space-between; }

/* Brand */
.brand { display: flex; align-items: center; gap: .75rem; }
.brand-icon { width: 45px; height: 45px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-md); background: var(--primary); color: white; font-size: 1.4rem; }
.brand-text h1 { font-size: 1.1rem; font-family: var(--font-heading); color: var(--text-primary); }
.brand-text span { font-size: .8rem; color: var(--secondary); }

/* Navigation */
.main-nav ul { display: flex; align-items: center; gap: 1.8rem; }
.main-nav a { color: var(--text-secondary); font-weight: 500; position: relative; transition: var(--transition-fast); }
.main-nav a:hover, .main-nav a.active { color: var(--primary); }
.main-nav a.active::after { content: ""; position: absolute; left: 0; bottom: -8px; height: 2px; width: 100%; background: var(--secondary); }
.mobile-menu-toggle { display: none; font-size: 1.8rem; color: var(--text-primary); }

/* Hero */
.hero-section { padding: 5rem 0; background: linear-gradient(135deg, var(--bg-body), var(--bg-card)); }
.hero-grid { display: grid; grid-template-columns: repeat(2, 1fr); align-items: center; gap: 4rem; }
.hero-content h1 { margin-bottom: 1.5rem; }
.hero-content p { max-width: 600px; margin-bottom: 2rem; font-size: 1.1rem; }
.hero-actions { display: flex; gap: 1rem; margin-bottom: 2.5rem; }
.hero-highlights { display: flex; gap: 2rem; }
.hero-highlights div { display: flex; flex-direction: column; }
.hero-highlights strong { font-size: 1.2rem; color: var(--primary); }
.hero-highlights span { color: var(--text-muted); font-size: .9rem; }
.hero-image { display: flex; justify-content: center; }

/* Grids */
.cards-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; }
.features-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; }
.paper-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2rem; }
.steps-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; }

/* Stats */
.stats-section { padding: 4rem 0; background: var(--primary); }
.stats-section h2, .stats-section p { color: white; }

/* CTA */
.cta-section { padding: 4rem 0; }
.cta-box { text-align: center; padding: 3rem; }
.cta-box p { max-width: 700px; margin: 1rem auto 2rem; }

/* Footer */
.site-footer { background: var(--footer-bg); color: white; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 2rem; padding: 4rem 0; }
.footer-column h4 { color: white; margin-bottom: 1.2rem; }
.footer-column p { color: #CBD5E1; }
.footer-column ul { display: flex; flex-direction: column; gap: .75rem; }
.footer-column a { color: #CBD5E1; }
.footer-column a:hover { color: var(--secondary); }
.social-links { display: flex; gap: .75rem; margin-top: 1.5rem; }
.social-links a { width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: rgba(255,255,255,.1); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.15); padding: 1rem 0; }
.footer-bottom .container { display: flex; justify-content: space-between; align-items: center; }
.footer-links { display: flex; gap: 1.5rem; }

/* Dashboard */
.dashboard-layout { display: grid; grid-template-columns: var(--sidebar-width) 1fr; min-height: 100vh; }
.dashboard-content { padding: 2rem; }

/* ===========================================================
   COMPONENTS
============================================================ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; padding: .85rem 1.8rem; border-radius: var(--radius-pill); font-weight: 600; transition: var(--transition-normal); cursor: pointer; }
.btn-primary { background: var(--primary); color: white; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn-outline { border: 2px solid var(--primary); color: var(--primary); background: transparent; }
.btn-outline:hover { background: var(--primary); color: white; transform: translateY(-2px); }
.btn-secondary { background: var(--secondary); color: #082C6C; }
.btn-secondary:hover { opacity: .85; }

.badge { display: inline-flex; align-items: center; padding: .45rem 1rem; border-radius: var(--radius-pill); background: rgba(56,189,248,.15); color: var(--primary); font-size: .85rem; font-weight: 600; margin-bottom: 1.5rem; }

.exam-card { width: 100%; max-width: 380px; background: var(--bg-card); padding: 2.5rem; border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); border: 1px solid var(--border-color); text-align: center; }
.exam-card i { font-size: 3.5rem; color: var(--secondary); margin-bottom: 1rem; }
.exam-card h3 { margin-bottom: .75rem; }

.progress-box { margin-top: 2rem; text-align: left; }
.progress-box span { font-size: .85rem; color: var(--text-muted); }
.progress { width: 100%; height: 10px; background: var(--bg-card-hover); border-radius: var(--radius-pill); overflow: hidden; margin-top: .5rem; }
.progress-bar { height: 100%; width: 75%; background: var(--secondary); border-radius: inherit; }

.info-card, .feature-card, .paper-card, .step-card, .stat-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 2rem; transition: var(--transition-normal); }
.info-card:hover, .feature-card:hover, .paper-card:hover, .step-card:hover, .stat-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-md); }
.info-card i, .feature-card i { width: 55px; height: 55px; display: flex; align-items: center; justify-content: center; background: rgba(56,189,248,.15); color: var(--primary); border-radius: var(--radius-md); font-size: 1.5rem; margin-bottom: 1.25rem; }
.info-card h3, .feature-card h3 { margin-bottom: .8rem; }

.paper-number { display: inline-flex; padding: .4rem 1rem; background: var(--primary); color: white; border-radius: var(--radius-pill); font-weight: 600; margin-bottom: 1rem; }
.paper-card h3 { margin-bottom: 1rem; }
.paper-card ul { margin: 1.5rem 0; }
.paper-card li { padding: .45rem 0; color: var(--text-secondary); position: relative; padding-left: 1.2rem; }
.paper-card li::before { content: "✓"; position: absolute; left: 0; color: var(--secondary); font-weight: bold; }
.feature-card p { margin-top: .75rem; }

.step-number { width: 45px; height: 45px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--primary); color: white; font-weight: 700; margin-bottom: 1.2rem; }

.stat-card { text-align: center; background: rgba(255,255,255,.08); border: none; }
.stat-card i { font-size: 2rem; color: var(--secondary); margin-bottom: 1rem; }
.stat-card h2 { color: white; font-size: 2.5rem; }
.stat-card p { color: white; }

.cta-box { background: linear-gradient(135deg, var(--primary), var(--secondary)); border-radius: var(--radius-xl); color: white; text-align: center; }
.cta-box h2 { color: white; }
.cta-box p { color: white; opacity: .9; }
.cta-actions { display: flex; justify-content: center; gap: 1rem; }
.cta-box .btn-outline { border-color: white; color: white; }
.cta-box .btn-outline:hover { background: white; color: var(--primary); }

.social-links a { transition: var(--transition-fast); }
.social-links a:hover { background: var(--secondary); color: var(--primary); transform: translateY(-3px); }

@keyframes fadeUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.animate-up { animation: fadeUp .6s ease forwards; }

/* Theme Toggle */
.theme-toggle { background: none; border: none; font-size: 1.3rem; color: var(--text-secondary); cursor: pointer; padding: 0.25rem 0.6rem; border-radius: var(--radius-md); transition: var(--transition-fast); display: inline-flex; align-items: center; justify-content: center; }
.theme-toggle:hover { background: var(--bg-card-hover); color: var(--secondary); }
.top-bar .theme-toggle { color: rgba(255, 255, 255, 0.85); }
.top-bar .theme-toggle:hover { background: rgba(255, 255, 255, 0.15); color: white; }

/* ===========================================================
   DARK MODE
============================================================ */
[data-theme="dark"] {
    --bg-body: #0F172A;
    --bg-card: #1E293B;
    --bg-card-hover: #334155;
    --header-bg: #0F172A;
    --sidebar-bg: #162033;
    --footer-bg: #08162E;
    --text-primary: #F8FAFC;
    --text-secondary: #CBD5E1;
    --text-muted: #94A3B8;
    --border-color: #334155;
    --border-light: #475569;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.35);
    --shadow-md: 0 10px 25px rgba(0,0,0,0.45);
    --shadow-lg: 0 20px 45px rgba(0,0,0,0.55);
    --primary: #3B82F6;
    --primary-hover: #60A5FA;
    --secondary: #38BDF8;
}
[data-theme="dark"] .top-bar { background: #0F172A; border-bottom: 1px solid #334155; }
[data-theme="dark"] .exam-card { background: #1E293B; }
[data-theme="dark"] .stats-section { background: #0F172A; }
[data-theme="dark"] .btn-outline { border-color: #3B82F6; color: #3B82F6; }
[data-theme="dark"] .btn-outline:hover { background: #3B82F6; color: white; }
[data-theme="dark"] .badge { background: rgba(59, 130, 246, 0.2); color: #60A5FA; }
[data-theme="dark"] .info-card i, [data-theme="dark"] .feature-card i { background: rgba(59, 130, 246, 0.2); color: #60A5FA; }
[data-theme="dark"] .hero-section { background: linear-gradient(135deg, #0F172A, #1E293B); }
[data-theme="dark"] .cta-box { background: linear-gradient(135deg, #1E3A5F, #0F172A); }
[data-theme="dark"] .site-footer { background: #08162E; }

/* ===========================================================
   RESPONSIVE
============================================================ */
@media (max-width:1200px) { .cards-grid, .features-grid { grid-template-columns: repeat(2, 1fr); } .steps-grid { grid-template-columns: repeat(2, 1fr); } .stats-grid { grid-template-columns: repeat(2, 1fr); } .footer-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width:992px) {
    .main-nav ul { flex-direction: column; align-items: flex-start; padding: 1.5rem; gap: 1.2rem; }
    .main-nav { position: absolute; top: 75px; left: 0; width: 100%; background: var(--header-bg); border-top: 1px solid var(--border-color); display: none; }
    .main-nav.active { display: block; }
    .mobile-menu-toggle { display: block; }
    .hero-grid { grid-template-columns: 1fr; text-align: center; }
    .hero-actions { justify-content: center; }
    .hero-highlights { justify-content: center; }
    .top-bar-content { flex-direction: column; padding: .75rem 0; }
    .top-contact, .top-actions { flex-direction: column; gap: .5rem; }
    .footer-bottom .container { flex-direction: column; gap: 1rem; text-align: center; }
}
@media (max-width:768px) {
    .container { padding-left: 1rem; padding-right: 1rem; }
    .section { padding: 3rem 0; }
    .cards-grid, .features-grid, .paper-grid, .steps-grid, .stats-grid, .footer-grid { grid-template-columns: 1fr; }
    .hero-section { padding: 3rem 0; }
    .hero-actions { flex-direction: column; width: 100%; }
    .hero-actions .btn { width: 100%; }
    .hero-highlights { flex-direction: column; gap: 1rem; }
    .brand-text h1 { font-size: 1rem; }
    .brand-text span { display: none; }
}
@media (max-width:480px) {
    .hero-content h1 { font-size: 1.9rem; }
    .hero-content p { font-size: 1rem; }
    .brand-icon { width: 38px; height: 38px; }
    .mobile-menu-toggle { font-size: 1.5rem; }
    .cta-box { padding: 2rem 1rem; }
}

/*
===========================================================
USER DROPDOWN - Enhanced Appearance (Fixed Z-Index)
===========================================================
*/
.user-dropdown {
    position: relative;
    display: inline-block;
    z-index: 9999; /* High z-index to contain the dropdown */
}
.user-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.3rem 0.8rem;
    border-radius: var(--radius-pill);
    transition: var(--transition-fast);
    font-size: 0.95rem;
    line-height: 1.4;
}
.user-dropdown-toggle:hover {
    background: rgba(255, 255, 255, 0.12);
}
.user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--secondary);
    color: #082C6C;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
}
.user-name {
    white-space: nowrap;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-dropdown-toggle .bi-chevron-down {
    font-size: 0.7rem;
    transition: transform var(--transition-fast);
}
.user-dropdown-toggle[aria-expanded="true"] .bi-chevron-down {
    transform: rotate(180deg);
}

/* Dropdown Menu */
.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 200px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 0.5rem 0;
    display: none;
    z-index: 99999; /* Extremely high value to appear above all other elements */
    list-style: none;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s, transform 0.2s;
}
.user-dropdown-menu.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
}
.user-dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1.2rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition-fast);
    font-size: 0.95rem;
}
.user-dropdown-menu a:hover {
    background: var(--bg-card-hover);
    color: var(--primary);
}
.user-dropdown-menu a .bi {
    font-size: 1.1rem;
    width: 1.2rem;
    text-align: center;
}
.user-dropdown-menu .text-danger {
    color: var(--danger) !important;
}
.user-dropdown-menu .text-danger:hover {
    background: var(--danger-light);
    color: var(--danger) !important;
}
.dropdown-divider {
    margin: 0.4rem 0;
    border: none;
    border-top: 1px solid var(--border-color);
}

/* Mobile */
@media (max-width: 768px) {
    .user-name {
        max-width: 60px;
    }
}