/* ============================================================
   EduFern App Theme — matches app.portal.edufern.co.za layout
   Uses existing EduFern blue colour palette
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&display=swap');

/* ── Design tokens ── */
:root {
    --ef-blue:        #3ca9d2;
    --ef-blue-dark:   #2d86a8;
    --ef-blue-mid:    #5bbfe0;
    --ef-blue-light:  #b8e4f5;
    --ef-blue-pale:   #e8f7fd;
    --ef-green:       #8bc34a;
    --ef-green-dark:  #7cb342;
    --ef-sidebar-bg:  #3ca9d2;
    --ef-topbar-bg:   #3ca9d2;
    --ef-body-bg:     #eef7fc;
    --ef-white:       #ffffff;
    --ef-text:        #2c3e50;
    --ef-text-light:  #5d6d7e;
    --ef-text-muted:  #95a5a6;
    --ef-border:      #c5e6f5;
    --ef-shadow:      0 2px 8px rgba(60,169,210,0.14);
    --ef-radius:      8px;
    --ef-sidebar-w:   165px;
    --ef-topbar-h:    62px;
}

/* ── Reset base ── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    font-family: 'Nunito', 'Segoe UI', Arial, sans-serif;
    font-size: 14px;
    background: var(--ef-body-bg);
    color: var(--ef-text);
    height: 100%;
    margin: 0;
    padding: 0;
}

/* ── TOP BAR ── */
.ef-topbar {
    background: var(--ef-topbar-bg);
    height: var(--ef-topbar-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px 0 0;
    position: sticky;
    top: 0;
    z-index: 1040;
    box-shadow: 0 2px 8px rgba(0,0,0,0.18);
    overflow: visible;
}

.ef-topbar-logo {
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: transparent;
    height: 100%;
    width: var(--ef-sidebar-w);
    padding: 0 14px;
    flex-shrink: 0;
    text-decoration: none;
}

.ef-logo-img {
    max-height: 38px;
    max-width: 160px;
    width: auto;
    object-fit: contain;
}

.ef-logo-text {
    font-size: 1.35rem;
    font-weight: 900;
    color: white;
    letter-spacing: 0.5px;
    line-height: 1;
}

.ef-logo-sub {
    font-size: 0.5rem;
    color: rgba(255,255,255,0.65);
    letter-spacing: 1.4px;
    text-transform: uppercase;
    margin-top: 2px;
}

.ef-topbar-center {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 0 18px;
    gap: 10px;
}

.ef-school-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.15);
    border-radius: 20px;
    padding: 4px 12px 4px 6px;
    border: 1px solid rgba(255,255,255,0.25);
}

.ef-school-logo {
    height: 30px;
    width: auto;
    max-width: 80px;
    object-fit: contain;
    border-radius: 4px;
    background: white;
    padding: 2px;
}

.ef-school-name {
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ef-topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
}

/* User avatar circle */
.ef-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    border: 2px solid rgba(255,255,255,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 800;
    color: white;
    cursor: pointer;
    text-transform: uppercase;
}

.ef-user-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    color: white !important;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 6px 10px;
    border-radius: 20px;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.25);
    transition: background 0.2s;
}

.ef-user-dropdown-toggle:hover {
    background: rgba(255,255,255,0.22);
    color: white !important;
}

.ef-user-dropdown-toggle .dropdown-toggle::after {
    border-top-color: white;
}

/* ── LAYOUT SHELL ── */
.ef-layout-body {
    display: flex;
    min-height: calc(100vh - var(--ef-topbar-h));
}

/* ── SIDEBAR ── */
.ef-sidebar {
    width: var(--ef-sidebar-w);
    background: var(--ef-sidebar-bg);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    padding: 12px 0 20px;
    position: sticky;
    top: var(--ef-topbar-h);
    height: calc(100vh - var(--ef-topbar-h));
    overflow-y: auto;
}

/* ── SIDEBAR SCHOOL BLOCK ── */
.ef-sidebar-school {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 10px 14px;
    margin: 0 8px 10px;
    background: rgba(255,255,255,0.12);
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.2);
    text-align: center;
}

.ef-sidebar-school-logo {
    width: 56px;
    height: 56px;
    object-fit: contain;
    border-radius: 8px;
    background: white;
    padding: 4px;
    margin-bottom: 6px;
}

.ef-sidebar-school-name {
    font-size: 0.7rem;
    font-weight: 700;
    color: white;
    line-height: 1.3;
    word-break: break-word;
}

.ef-sidebar-school-abbr {
    font-size: 0.6rem;
    color: rgba(255,255,255,0.7);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

.ef-nav-section {
    margin-bottom: 4px;
}

.ef-nav-section-label {
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.5);
    padding: 10px 14px 4px;
}

.ef-nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    color: rgba(255,255,255,0.88) !important;
    text-decoration: none !important;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: 0 20px 20px 0;
    margin-right: 8px;
    transition: background 0.18s, color 0.18s;
    white-space: nowrap;
    overflow: hidden;
}

.ef-nav-link i {
    width: 18px;
    text-align: center;
    flex-shrink: 0;
    font-size: 0.95rem;
    opacity: 0.85;
}

.ef-nav-link:hover,
.ef-nav-link.active {
    background: rgba(255,255,255,0.2);
    color: white !important;
}

.ef-nav-link.active {
    background: rgba(255,255,255,0.25);
    font-weight: 700;
}

/* ── MAIN CONTENT ── */
.ef-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.ef-page-header {
    background: var(--ef-white);
    border-bottom: 1px solid var(--ef-border);
    padding: 12px 20px;
    font-size: 1rem;
    font-weight: 800;
    color: var(--ef-blue-dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.ef-content {
    padding: 20px;
    flex: 1;
}

/* ── ALERT OVERRIDES ── */
.alert {
    border-radius: var(--ef-radius);
    border: none;
    border-left: 4px solid transparent;
    padding: 12px 16px;
    font-size: 0.88rem;
    box-shadow: var(--ef-shadow);
}

.alert-success { border-left-color: var(--ef-green); background: rgba(139,195,74,0.1); }
.alert-danger  { border-left-color: #e74c3c;         background: rgba(231,76,60,0.08);  }
.alert-info    { border-left-color: var(--ef-blue);  background: rgba(60,169,210,0.1);  }

/* ── CARD OVERRIDES ── */
.card {
    border: 1px solid var(--ef-border) !important;
    border-radius: var(--ef-radius) !important;
    box-shadow: var(--ef-shadow) !important;
    background: var(--ef-white);
}

.card:hover {
    box-shadow: 0 6px 24px rgba(60,169,210,0.18) !important;
    transform: translateY(-1px);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card-header {
    background: var(--ef-blue) !important;
    color: white !important;
    border-radius: var(--ef-radius) var(--ef-radius) 0 0 !important;
    border-bottom: none !important;
    font-weight: 700;
    font-size: 0.88rem;
    padding: 10px 16px;
}

/* ── TABLE OVERRIDES ── */
.table thead th {
    background: var(--ef-blue) !important;
    color: white !important;
    border: none !important;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 10px 12px;
}

.table tbody tr:hover {
    background: var(--ef-blue-pale) !important;
}

/* ── BUTTON OVERRIDES ── */
.btn-primary {
    background: var(--ef-blue) !important;
    border-color: var(--ef-blue) !important;
    font-weight: 700;
    border-radius: 6px;
}

.btn-primary:hover {
    background: var(--ef-blue-dark) !important;
    border-color: var(--ef-blue-dark) !important;
}

.btn-success {
    background: var(--ef-green) !important;
    border-color: var(--ef-green) !important;
    font-weight: 700;
    border-radius: 6px;
}

.btn-success:hover {
    background: var(--ef-green-dark) !important;
    border-color: var(--ef-green-dark) !important;
}

/* ── DROPDOWN (top-right user menu) ── */
.dropdown-menu {
    border: 1px solid var(--ef-border);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.14);
    padding: 6px 0;
    font-size: 0.85rem;
}

.dropdown-item {
    padding: 9px 18px;
    font-weight: 600;
    color: var(--ef-text);
    transition: background 0.15s;
}

.dropdown-item:hover {
    background: var(--ef-blue-pale);
    color: var(--ef-blue-dark);
}

.dropdown-item i { width: 20px; text-align: center; }

/* ── FOOTER ── */
.ef-footer {
    background: var(--ef-white);
    border-top: 1px solid var(--ef-border);
    padding: 12px 20px;
    font-size: 0.78rem;
    color: var(--ef-text-muted);
    text-align: center;
}

.ef-footer a { color: var(--ef-blue); text-decoration: none; font-weight: 600; }
.ef-footer a:hover { color: var(--ef-blue-dark); }

/* ── HOME PAGE (landing) ── */
.ef-hero {
    background: #ffffff;
    color: #333333;
    padding: 60px 20px;
    text-align: center;
    border-radius: 0;
}

.ef-hero h1 {
    font-size: 2.8rem;
    font-weight: 900;
    margin-bottom: 12px;
}

.ef-hero p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 28px;
}

.ef-stat-card {
    background: white;
    border-radius: var(--ef-radius);
    padding: 24px;
    text-align: center;
    box-shadow: var(--ef-shadow);
}

.ef-stat-card .stat-number {
    font-size: 2rem;
    font-weight: 900;
    color: var(--ef-blue);
}

.ef-stat-card .stat-label {
    font-size: 0.82rem;
    color: var(--ef-text-muted);
    font-weight: 600;
}

.ef-feature-card {
    background: white;
    border-radius: var(--ef-radius);
    padding: 24px;
    text-align: center;
    box-shadow: var(--ef-shadow);
    border-top: 3px solid var(--ef-blue);
    height: 100%;
}

.ef-feature-card i {
    font-size: 2rem;
    color: var(--ef-blue);
    margin-bottom: 12px;
}

/* ── RESPONSIVE MOBILE ── */
@media (max-width: 768px) {
    .ef-sidebar {
        display: none;
    }

    .ef-topbar-logo {
        width: auto;
        padding: 0 12px;
    }

    .ef-school-badge {
        display: none;
    }

    .ef-content {
        padding: 12px;
    }

    .ef-topbar-center {
        display: none;
    }
}

/* Mobile sidebar toggle */
.ef-mobile-nav-toggle {
    display: none;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    border-radius: 6px;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 1.1rem;
    margin-left: 10px;
}

@media (max-width: 768px) {
    .ef-mobile-nav-toggle { display: flex; align-items: center; }
}

.ef-sidebar.mobile-open {
    display: flex;
    position: fixed;
    top: var(--ef-topbar-h);
    left: 0;
    height: calc(100vh - var(--ef-topbar-h));
    z-index: 1030;
}

/* Legacy Bootstrap nav hidden — layout uses sidebar */
.ef-legacy-nav { display: none !important; }

/* ── Utility colour aliases (used in existing views) ── */
.text-edufearn-purple { color: var(--ef-blue) !important; }
.text-edufearn-green  { color: var(--ef-green) !important; }
.bg-edufearn-purple   { background: var(--ef-blue) !important; }
.bg-edufearn-green    { background: var(--ef-green) !important; }

.btn-edufearn-primary {
    background: var(--ef-blue) !important;
    border-color: var(--ef-blue) !important;
    color: white !important;
    font-weight: 700;
    border-radius: 6px;
    padding: 10px 24px;
}
.btn-edufearn-primary:hover {
    background: var(--ef-blue-dark) !important;
    border-color: var(--ef-blue-dark) !important;
    color: white !important;
}

.btn-edufearn-secondary {
    background: var(--ef-green) !important;
    border-color: var(--ef-green) !important;
    color: white !important;
    font-weight: 700;
    border-radius: 6px;
    padding: 10px 24px;
}
.btn-edufearn-secondary:hover {
    background: var(--ef-green-dark) !important;
    border-color: var(--ef-green-dark) !important;
    color: white !important;
}
