/* ============================================
   SchoolConnect Portal - Global Styles
   Uses Design System Typography Tokens
   ============================================ */

/* Global box-sizing reset. The portal was built without one, so any element
   sized `width: 100%` (or a fixed width) PLUS padding overflowed its container
   by the padding amount — the dominant cause of mobile horizontal overflow on
   page wrappers (academics-dashboard, welcome-page, *-page, filter rows, etc.).
   border-box makes width/height include padding+border, which is what virtually
   all of this codebase's layout math already assumes. Scoped rules can still
   opt back into content-box where genuinely needed. */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    font-family: var(--sc-font-sans, 'Inter', 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif);
    font-size: var(--sc-text-base, 1rem);
    line-height: var(--sc-leading-normal, 1.5);
    color: var(--sc-text-primary);
    background: var(--sc-background, var(--sc-surface));
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Inter character variants — these are what make Inter look modern
       vs the default fallback:
         cv11 = single-story lowercase a (Helvetica-like, calmer)
         ss01 = open digit forms (clearer 4/6/9 at small sizes)
         cv02 = single-story lowercase g (better than the loopy default)
       Numerals stay proportional in prose; tables opt-in to tabular
       below. */
    font-feature-settings: "cv11", "ss01", "cv02";
    scroll-behavior: smooth;
}

/* Data tables, grade books, attendance grids, fee tables — wherever
   columns of numbers need to line up vertically, opt into Inter's
   tabular numerals. Without this, "1234" and "5678" have different
   widths because the digits are proportional. */
table,
.rz-data-grid,
.rz-datatable,
.tabular-nums,
[data-tabular-nums] {
    font-variant-numeric: tabular-nums;
}

/* Custom Scrollbar — thin and elegant */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(var(--sc-primary-rgb, 59, 130, 246), 0.15);
    border-radius: 10px;
    transition: background 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--sc-primary-rgb, 59, 130, 246), 0.3);
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--sc-primary-rgb, 59, 130, 246), 0.15) transparent;
}

/* Text selection */
::selection {
    background: rgba(var(--sc-primary-rgb, 59, 130, 246), 0.15);
    color: var(--sc-primary-800);
}

/* Global smooth transitions on interactive elements */
a, button, input, select, textarea {
    transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

/* Material Symbols Outlined */
.material-symbols-outlined {
    font-family: 'Material Symbols Outlined';
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
}

h1:focus {
    outline: none;
}

a, .btn-link {
    color: var(--sc-primary-500);
}

.btn-primary {
    color: var(--sc-text-inverse);
    background-color: var(--sc-primary-500);
    border-color: var(--sc-primary-500);
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {}

.content {
    padding-top: 1.1rem;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid var(--sc-primary-500);
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    background: var(--sc-warning-50);
    bottom: 0;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHR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gODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, var(--sc-danger-600);
    padding: 1rem 1rem 1rem 3.7rem;
    color: var(--sc-text-inverse);
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

.loading-progress {
    display: none;
}

.loading-progress-text {
    display: none;
}

/* ========================================
   SchoolConnect Beautiful Loader
   ======================================== */

.sc-loader {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--sc-background);
    z-index: 9999;
    overflow: hidden;
}

.sc-loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    z-index: 10;
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Logo Icon */
.sc-loader-logo {
    width: 88px;
    height: 88px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--theme-primary-500, var(--sc-info-600)) 0%, var(--theme-primary-700, var(--sc-info-600)) 100%);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(var(--sc-primary-rgb, 8, 145, 178), 0.35), 0 2px 6px rgba(0, 0, 0, 0.08);
    animation: sc-logo-pulse 2.5s ease-in-out infinite, sc-logo-hue 6s linear infinite;
    position: relative;
    overflow: hidden;
}

/* The dark icon variant is authored for a dark surface (lighter blues +
   white centre dot) so we no longer recolour its inner shapes. The slow
   spin remains so the loader still feels alive. */
.sc-loader-logo img {
    width: 62%;
    height: 62%;
    animation: sc-logo-spin 4.5s cubic-bezier(0.65, 0.05, 0.36, 1) infinite;
    transform-origin: 50% 50%;
}

@keyframes sc-logo-spin {
    0% {
        transform: rotate(0deg);
    }

    50% {
        transform: rotate(180deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes sc-logo-pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 10px 30px rgba(var(--sc-primary-rgb, 8, 145, 178), 0.35), 0 2px 6px rgba(0, 0, 0, 0.08);
    }

    50% {
        transform: scale(1.04);
        box-shadow: 0 16px 38px rgba(var(--sc-primary-rgb, 8, 145, 178), 0.45), 0 4px 10px rgba(0, 0, 0, 0.10);
    }
}

@keyframes sc-logo-hue {
    0%, 100% {
        filter: hue-rotate(0deg);
    }

    50% {
        filter: hue-rotate(20deg);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.03);
    }
}

/* Brand Name */
.sc-loader-brand {
    font-family: 'Inter', 'Segoe UI', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.brand-school {
    color: var(--sc-primary-500);
}

.brand-connect {
    color: var(--sc-primary-400);
}

/* Loading Bar */
.sc-loader-bar {
    width: 180px;
    height: 3px;
    background: rgba(var(--sc-primary-rgb, 8, 145, 178), 0.08);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.sc-loader-progress {
    position: absolute;
    inset: 0;
    /* UI-005: always-animated shimmer so the bar is never empty even
       before Blazor sets --blazor-load-percentage. */
    background: linear-gradient(90deg,
            rgba(var(--sc-primary-rgb, 8, 145, 178), 0.15) 0%,
            var(--theme-primary-500, var(--sc-info-600)) 50%,
            rgba(var(--sc-primary-rgb, 8, 145, 178), 0.15) 100%);
    background-size: 200% 100%;
    border-radius: 4px;
    width: calc(var(--blazor-load-percentage, 35%));
    transition: width 0.3s ease-out;
    animation: sc-loader-shimmer 1.6s linear infinite;
}

@keyframes sc-loader-shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* Loading Text */
.sc-loader-text {
    font-family: 'Inter', 'Segoe UI', sans-serif;
    font-size: 0.9rem;
    color: var(--sc-text-secondary);
    font-weight: 400;
    min-height: 2rem;
    letter-spacing: 0.01em;
}

.loading-message {
    display: inline-block;
    transition: opacity 0.3s ease-in-out;
}

.loading-message::after {
    content: '';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% {
        content: '';
    }

    40% {
        content: '.';
    }

    60% {
        content: '..';
    }

    80%, 100% {
        content: '...';
    }
}

/* Background Decoration */
.sc-loader-bg {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.bg-circle {
    position: absolute;
    border-radius: 50%;
    background: rgba(var(--sc-primary-rgb, 8, 145, 178), 0.04);
    filter: blur(60px);
}

.bg-circle-1 {
    width: 600px;
    height: 600px;
    top: -200px;
    right: -200px;
    animation: float 20s ease-in-out infinite;
}

.bg-circle-2 {
    width: 400px;
    height: 400px;
    bottom: -100px;
    left: -100px;
    animation: float 25s ease-in-out infinite reverse;
}

.bg-circle-3 {
    width: 300px;
    height: 300px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: float 15s ease-in-out infinite;
    opacity: 0.5;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(20px, -20px) scale(1.02);
    }

    66% {
        transform: translate(-10px, 10px) scale(0.98);
    }
}

/* Dark mode support - uses [data-theme] attribute */
[data-theme$="-dark"] .sc-loader {
    background: var(--sc-background);
}

[data-theme$="-dark"] .sc-loader-logo {
    background: var(--theme-primary-500);
}

[data-theme$="-dark"] .brand-school {
    color: var(--sc-primary-400);
}

[data-theme$="-dark"] .brand-connect {
    color: var(--sc-primary-300);
}

[data-theme$="-dark"] .sc-loader-bar {
    background: rgba(255, 255, 255, 0.1);
}

[data-theme$="-dark"] .sc-loader-text {
    color: var(--sc-text-secondary);
}

[data-theme$="-dark"] .bg-circle {
    background: rgba(37, 99, 235, 0.08);
}

code {
    color: var(--sc-danger-500);
}

/* ============================================
   Radzen Component Font Overrides
   Ensures all Radzen UI components use our design system font
   Excludes icon elements (.rzi) to preserve icon fonts
   ============================================ */
.rz-tabview-nav {
    font-family: var(--sc-font-sans, 'Inter', 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif) !important;
}

.rz-tabview-nav *:not(.rzi):not([class*="material"]) {
    font-family: var(--sc-font-sans, 'Inter', 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif) !important;
}