/* ── Design Tokens ─────────────────────────────────────────────────────────── */
:root {
    /* Brand palette (South African flag) */
    --brand-navy:    #001a6e;
    --brand-blue:    #002395;
    --brand-green:   #007749;
    --brand-yellow:  #FFB81C;

    /* Backwards-compat aliases */
    --blue:          #002395;
    --green:         #007749;
    --yellow:        #FFB81C;
    --white:         #FFFFFF;
    --dark-gray:     #0A1628;

    /* Surfaces */
    --surface:       #FFFFFF;
    --bg:            #F5F7FC;
    --bg-alt:        #EDF0FA;
    --gray:          #F5F7FC;

    /* Borders */
    --border:        #DDE3F0;
    --border-strong: #BEC8DF;

    /* Text */
    --text-1:        #0A1628;
    --text-2:        #475569;
    --text-3:        #8996AE;

    /* Elevation */
    --shadow-xs:  0 1px 2px rgba(10,22,40,0.06);
    --shadow-sm:  0 1px 4px rgba(10,22,40,0.07), 0 2px 8px rgba(10,22,40,0.04);
    --shadow-md:  0 4px 16px rgba(10,22,40,0.08), 0 2px 6px rgba(10,22,40,0.04);
    --shadow-lg:  0 12px 36px rgba(10,22,40,0.10), 0 4px 12px rgba(10,22,40,0.05);
    --shadow-xl:  0 24px 64px rgba(10,22,40,0.12), 0 8px 20px rgba(10,22,40,0.06);
}

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

html, body {
    font-family: 'Inter', 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: var(--bg);
    color: var(--text-1);
}

h1:focus { outline: none; }

/* Custom scrollbar */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* Focus rings */
*:focus-visible {
    outline: 2px solid var(--brand-blue);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ── Typography helpers ────────────────────────────────────────────────────── */
.text-navy   { color: var(--brand-navy) !important; }
.text-blue   { color: var(--brand-blue) !important; }
.text-green  { color: var(--brand-green) !important; }
.text-yellow { color: var(--brand-yellow) !important; }
.text-muted  { color: var(--text-3) !important; }

/* ── Blazor Error UI ───────────────────────────────────────────────────────── */
@keyframes blazorErrorSlideIn {
    from { opacity: 0; transform: translateX(40px); }
    to   { opacity: 1; transform: translateX(0); }
}

#blazor-error-ui {
    color-scheme: light only;
    background: #fff;
    border-left: 4px solid #ef4444;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    box-sizing: border-box;
    display: none;
    max-width: 400px;
    padding: 14px 42px 14px 16px;
    position: fixed;
    right: 20px;
    top: 20px;
    z-index: 99999;
    font-size: 0.875rem;
    color: var(--text-1);
    animation: blazorErrorSlideIn 0.3s ease;
}
#blazor-error-ui::before { content: "⚠️"; margin-right: 8px; }
#blazor-error-ui .dismiss {
    cursor: pointer; position: absolute; right: 12px; top: 50%;
    transform: translateY(-50%); font-size: 1rem; color: var(--text-3); line-height: 1;
}
#blazor-error-ui .dismiss:hover { color: #ef4444; }
#blazor-error-ui .reload { color: var(--brand-blue); font-weight: 600; margin-left: 6px; text-decoration: underline; }

.blazor-error-boundary {
    background: #fff8f8; border: 1px solid #fca5a5; border-radius: 10px;
    padding: 1rem 1.25rem; color: #991b1b;
}
.blazor-error-boundary::after { content: "An error has occurred." }

/* ── Skeleton Screens ──────────────────────────────────────────────────────── */
@keyframes skeleton-shimmer {
    0%   { background-position: -1200px 0; }
    100% { background-position:  1200px 0; }
}
.skeleton {
    background: linear-gradient(
        100deg,
        #eaecf4 0%,
        #eaecf4 30%,
        #f5f6fb 50%,
        #eaecf4 70%,
        #eaecf4 100%
    );
    background-size: 2400px 100%;
    animation: skeleton-shimmer 1.8s ease-in-out infinite;
    border-radius: 8px;
}
.sk-line       { height: 14px; margin-bottom: 10px; }
.sk-line-sm    { height: 10px; margin-bottom: 8px; }
.sk-line-lg    { height: 20px; margin-bottom: 12px; }
.sk-line-title { height: 28px; margin-bottom: 16px; width: 55%; border-radius: 10px; }
.sk-circle     { border-radius: 50%; }
.sk-avatar     { width: 48px; height: 48px; border-radius: 50%; flex-shrink: 0; }
.sk-badge      { height: 24px; width: 88px; border-radius: 20px; display: inline-block; }
.sk-btn        { height: 40px; border-radius: 10px; }
.sk-image      { width: 100%; border-radius: 10px 10px 0 0; }
.sk-stat-card  { background: white; border-radius: 14px; padding: 20px; box-shadow: var(--shadow-sm); border: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.sk-stat-icon  { width: 40px; height: 40px; border-radius: 10px; }
.sk-table-row  { display: flex; gap: 16px; padding: 14px 16px; border-bottom: 1px solid var(--bg-alt); align-items: center; }
.sk-card       { background: white; border-radius: 14px; padding: 20px; box-shadow: var(--shadow-sm); border: 1px solid var(--border); margin-bottom: 16px; overflow: hidden; }
.sk-form-field { margin-bottom: 20px; }
.sk-label      { height: 12px; width: 120px; margin-bottom: 8px; }
.sk-input      { height: 44px; border-radius: 8px; }

/* ── Premium Animations & Transitions ─────────────────────────────────────── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-28px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes slideInRight {
    from { opacity: 0; transform: translateX(28px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.92); }
    to   { opacity: 1; transform: scale(1); }
}
@keyframes bounceIn {
    0%   { opacity: 0; transform: scale(0.75); }
    55%  { opacity: 1; transform: scale(1.06); }
    80%  { transform: scale(0.97); }
    100% { opacity: 1; transform: scale(1); }
}
@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50%       { transform: translateY(-10px); }
}
@keyframes heroOrb {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33%       { transform: translate(20px, -15px) scale(1.06); }
    66%       { transform: translate(-10px, 10px) scale(0.97); }
}
@keyframes gradientShift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
@keyframes dotPulse {
    0%, 100% { transform: scale(1);   opacity: 1; }
    50%       { transform: scale(1.5); opacity: 0.6; }
}
@keyframes shimmerSlide {
    0%   { background-position: -600px 0; }
    100% { background-position:  600px 0; }
}
@keyframes progressFill {
    from { width: 0; }
    to   { width: 100%; }
}
@keyframes spinSlow {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
@keyframes successBounce {
    0%   { transform: scale(0); opacity: 0; }
    60%  { transform: scale(1.2); opacity: 1; }
    80%  { transform: scale(0.95); }
    100% { transform: scale(1); }
}
@keyframes pageEnter {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Entry animations */
.anim-fade-in       { animation: fadeIn 0.4s ease both; }
.anim-fade-in-up    { animation: fadeInUp 0.55s cubic-bezier(0.22,1,0.36,1) both; }
.anim-fade-in-down  { animation: fadeInDown 0.5s cubic-bezier(0.22,1,0.36,1) both; }
.anim-slide-left    { animation: slideInLeft 0.5s cubic-bezier(0.22,1,0.36,1) both; }
.anim-slide-right   { animation: slideInRight 0.5s cubic-bezier(0.22,1,0.36,1) both; }
.anim-scale-in      { animation: scaleIn 0.45s cubic-bezier(0.22,1,0.36,1) both; }
.anim-bounce-in     { animation: bounceIn 0.6s cubic-bezier(0.22,1,0.36,1) both; }
.anim-float         { animation: float 3.5s ease-in-out infinite; }
.anim-success       { animation: successBounce 0.55s cubic-bezier(0.22,1,0.36,1) both; }
.anim-page-enter    { animation: pageEnter 0.5s cubic-bezier(0.22,1,0.36,1) both; }

/* Stagger delays — finer granularity, wider range */
.delay-1  { animation-delay: 0.05s; }
.delay-2  { animation-delay: 0.10s; }
.delay-3  { animation-delay: 0.15s; }
.delay-4  { animation-delay: 0.20s; }
.delay-5  { animation-delay: 0.25s; }
.delay-6  { animation-delay: 0.30s; }
.delay-7  { animation-delay: 0.38s; }
.delay-8  { animation-delay: 0.46s; }
.delay-9  { animation-delay: 0.54s; }
.delay-10 { animation-delay: 0.62s; }
.delay-11 { animation-delay: 0.70s; }
.delay-12 { animation-delay: 0.80s; }

/* ── Live Status Dots ──────────────────────────────────────────────────────── */
.sk-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.sk-dot-live   { background: #10b981; animation: dotPulse 1.6s ease-in-out infinite; }
.sk-dot-warn   { background: #f59e0b; animation: dotPulse 2s ease-in-out infinite; }
.sk-dot-danger { background: #ef4444; animation: dotPulse 1.4s ease-in-out infinite; }
.sk-dot-idle   { background: var(--text-3); }

/* ── Shimmer text (gradient animated) ─────────────────────────────────────── */
.sk-shimmer-text {
    background: linear-gradient(90deg, var(--brand-navy), var(--brand-blue), var(--brand-green), var(--brand-navy));
    background-size: 300% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 4s ease infinite;
}

/* ── Top loading bar ───────────────────────────────────────────────────────── */
.sk-loading-bar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--brand-blue), var(--brand-green), var(--brand-yellow));
    background-size: 200% 100%;
    z-index: 99998;
    animation: gradientShift 1.2s linear infinite, progressFill 2s cubic-bezier(0.22,1,0.36,1) both;
    transform-origin: left;
    border-radius: 0 2px 2px 0;
}

/* ── Hero orb decoration ───────────────────────────────────────────────────── */
.sk-hero-orb {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    animation: heroOrb 8s ease-in-out infinite;
    opacity: 0.18;
    filter: blur(40px);
}

/* ── Stat counter animation ────────────────────────────────────────────────── */
.sk-stat-anim { animation: fadeInUp 0.6s cubic-bezier(0.22,1,0.36,1) both; }

/* ── Floating action button ────────────────────────────────────────────────── */
.sk-fab {
    position: fixed;
    bottom: 28px; right: 28px;
    width: 52px; height: 52px;
    border-radius: 50%;
    background: var(--brand-blue);
    color: white;
    border: none;
    box-shadow: var(--shadow-lg);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.22,1,0.36,1), box-shadow 0.2s;
    z-index: 1000;
}
.sk-fab:hover { transform: scale(1.1) translateY(-2px); box-shadow: var(--shadow-xl); }
.sk-fab:active { transform: scale(0.96); }

/* ── Animated gradient button ─────────────────────────────────────────────── */
.sk-btn-gradient {
    background: linear-gradient(135deg, var(--brand-blue), var(--brand-navy), var(--brand-blue));
    background-size: 200% 200%;
    color: white;
    border: none;
    border-radius: 10px;
    padding: 10px 22px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    animation: gradientShift 4s ease infinite;
}
.sk-btn-gradient:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,35,149,0.25); }
.sk-btn-gradient:active { transform: translateY(0); }

/* ── Premium Components ────────────────────────────────────────────────────── */
.sk-card-premium {
    background: #fff;
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: transform 0.28s cubic-bezier(0.22,1,0.36,1), box-shadow 0.28s;
    will-change: transform;
}
.sk-card-premium:hover { transform: translateY(-4px) scale(1.005); box-shadow: var(--shadow-lg); }

.sk-hero {
    background: linear-gradient(150deg, rgba(0,26,110,0.95) 0%, rgba(0,35,149,0.90) 55%, rgba(0,119,73,0.82) 100%),
                url('/uni-campus-placeholder.jpg') center/cover no-repeat;
    color: #fff;
    border-radius: 20px;
    position: relative;
    overflow: hidden;
}
.sk-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 80% 50%, rgba(255,184,28,0.12) 0%, transparent 60%);
    pointer-events: none;
}
.sk-hero::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--brand-yellow), rgba(255,184,28,0.2), transparent);
}

.sk-stat-premium {
    background: #fff;
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.22s, box-shadow 0.22s;
}
.sk-stat-premium:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.sk-stat-icon        { width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; flex-shrink: 0; }
.sk-stat-icon-blue   { background: rgba(0,35,149,0.08);   color: var(--brand-blue); }
.sk-stat-icon-green  { background: rgba(0,119,73,0.08);   color: var(--brand-green); }
.sk-stat-icon-gold   { background: rgba(255,184,28,0.12); color: #a06e00; }
.sk-stat-icon-red    { background: rgba(220,38,38,0.08);  color: #dc2626; }
.sk-stat-value       { font-size: 1.75rem; font-weight: 800; color: var(--text-1); line-height: 1; }
.sk-stat-label       { font-size: 0.8rem; color: var(--text-3); font-weight: 500; margin-top: 2px; }

/* ── Table ─────────────────────────────────────────────────────────────────── */
.sk-table-wrap  { background: #fff; border-radius: 16px; border: 1px solid var(--border); box-shadow: var(--shadow-sm); overflow: hidden; }
.sk-table       { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.sk-table thead tr   { background: var(--bg); border-bottom: 1.5px solid var(--border); }
.sk-table thead th   { padding: 12px 16px; font-weight: 600; color: var(--text-2); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; }
.sk-table tbody tr   { border-bottom: 1px solid var(--border); transition: background 0.15s; }
.sk-table tbody tr:last-child { border-bottom: none; }
.sk-table tbody tr:hover { background: var(--bg); }
.sk-table tbody td   { padding: 14px 16px; color: var(--text-1); vertical-align: middle; }

/* ── Status Badges ─────────────────────────────────────────────────────────── */
.sk-badge-success { background: rgba(0,119,73,0.10);   color: #005c38; border-radius: 20px; padding: 3px 10px; font-size: 0.75rem; font-weight: 600; }
.sk-badge-warning { background: rgba(255,184,28,0.12); color: #7a5200; border-radius: 20px; padding: 3px 10px; font-size: 0.75rem; font-weight: 600; }
.sk-badge-info    { background: rgba(0,35,149,0.08);   color: #002395; border-radius: 20px; padding: 3px 10px; font-size: 0.75rem; font-weight: 600; }
.sk-badge-danger  { background: rgba(220,38,38,0.08);  color: #b91c1c; border-radius: 20px; padding: 3px 10px; font-size: 0.75rem; font-weight: 600; }
.sk-badge-neutral { background: var(--bg-alt);         color: var(--text-2); border-radius: 20px; padding: 3px 10px; font-size: 0.75rem; font-weight: 600; }

/* ── Page Header ───────────────────────────────────────────────────────────── */
.sk-page-header   { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; gap: 16px; flex-wrap: wrap; }
.sk-page-title    { font-size: 1.5rem; font-weight: 800; color: var(--brand-navy); letter-spacing: -0.03em; margin: 0; }
.sk-page-subtitle { font-size: 0.875rem; color: var(--text-2); margin: 4px 0 0; }

/* ── Glass ─────────────────────────────────────────────────────────────────── */
.sk-glass {
    background: rgba(255,255,255,0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.5);
    border-radius: 16px;
}

/* ── Accent ────────────────────────────────────────────────────────────────── */
.sk-accent-rule { width: 40px; height: 4px; background: var(--brand-yellow); border-radius: 2px; margin: 8px 0 16px; }

/* ── Global Card & MudBlazor overrides ────────────────────────────────────── */
.mud-card {
    transition: transform 0.28s cubic-bezier(0.22,1,0.36,1), box-shadow 0.28s cubic-bezier(0.22,1,0.36,1);
    border: 1px solid var(--border) !important;
    will-change: transform;
}
.mud-card:hover { transform: translateY(-4px) scale(1.005); box-shadow: var(--shadow-lg) !important; }
.mud-appbar { border-bottom: 1px solid var(--border) !important; }
.mud-button-root {
    font-family: 'Inter', 'Roboto', sans-serif !important;
    letter-spacing: 0 !important;
    transition: transform 0.18s cubic-bezier(0.22,1,0.36,1), box-shadow 0.18s !important;
}
.mud-button-root:hover  { transform: translateY(-1px) !important; }
.mud-button-root:active { transform: translateY(0) scale(0.98) !important; }
.mud-input-root   { font-family: 'Inter', 'Roboto', sans-serif !important; }
.mud-input-outlined:hover .mud-notched-outline { border-color: var(--brand-blue) !important; }
.mud-input-control { transition: all 0.2s !important; }

/* ── Page-level enter transition ──────────────────────────────────────────── */
.page-enter-active { animation: pageEnter 0.45s cubic-bezier(0.22,1,0.36,1) both; }

/* ── Generic interactive transitions ─────────────────────────────────────── */
a { transition: color 0.15s ease; }
button { transition: transform 0.18s cubic-bezier(0.22,1,0.36,1), box-shadow 0.18s, background 0.18s, opacity 0.18s; }
button:active:not(:disabled) { transform: scale(0.97) !important; }
.btn { transition: transform 0.18s cubic-bezier(0.22,1,0.36,1), box-shadow 0.2s, background 0.18s !important; }
.btn:hover:not(:disabled) { transform: translateY(-1px) !important; }
.btn:active:not(:disabled) { transform: translateY(0) scale(0.97) !important; }
.btn-primary:hover:not(:disabled) { box-shadow: 0 6px 20px rgba(0,35,149,0.25) !important; }
.form-control:focus, .form-select:focus { transition: border-color 0.2s, box-shadow 0.2s; }
.form-check-input { transition: background 0.15s, border-color 0.15s, transform 0.15s; }
.form-check-input:checked { transform: scale(1.1); }

/* ── Skida Legacy Utilities ────────────────────────────────────────────────── */
.max-w-800 { max-width: 800px; }

.skida-hero {
    background:
        linear-gradient(150deg, rgba(0,26,110,0.92) 0%, rgba(0,35,149,0.88) 50%, rgba(0,119,73,0.82) 100%),
        url('/uni-campus-placeholder.jpg') center/cover no-repeat !important;
    min-height: 220px;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    color: #fff;
    position: relative;
    overflow: hidden;
}
.skida-hero::before {
    content: '';
    position: absolute;
    width: 420px; height: 420px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,184,28,0.18) 0%, transparent 70%);
    top: -80px; right: -60px;
    pointer-events: none;
    animation: heroOrb 9s ease-in-out infinite;
}
.skida-hero::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--brand-yellow), rgba(255,184,28,0.25), transparent);
    animation: gradientShift 4s linear infinite;
    background-size: 200% 100%;
}

.skida-card    { border-top: 3px solid var(--brand-green) !important; }
.sk-active     { background-color: rgba(0,35,149,0.07) !important; color: var(--brand-blue) !important; font-weight: 600; border-right: 3px solid var(--brand-yellow); }
.skida-badge-blue   { background: rgba(0,35,149,0.08);   color: var(--brand-blue);  border-radius: 20px; padding: 3px 10px; font-size: 0.75rem; font-weight: 600; }
.skida-badge-green  { background: rgba(0,119,73,0.08);   color: var(--brand-green); border-radius: 20px; padding: 3px 10px; font-size: 0.75rem; font-weight: 600; }
.skida-badge-yellow { background: rgba(255,184,28,0.12); color: #a06e00;            border-radius: 20px; padding: 3px 10px; font-size: 0.75rem; font-weight: 600; }
.skida-divider-yellow { height: 3px; background: linear-gradient(90deg, var(--brand-yellow), rgba(255,184,28,0.2)); border: none; border-radius: 2px; margin: 0; }

/* ── Responsiveness ────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .skida-hero { padding: 24px !important; border-radius: 0; min-height: auto; }
    .mud-container { padding-left: 16px; padding-right: 16px; }
    .sk-page-grid { padding: 8px; }
}
