/* global-styles.css */

html,
body {
    min-height: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

body {
    min-height: 100vh;
}

html {
    width: 100%;
    -webkit-text-size-adjust: 100%;
}

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

img,
svg,
canvas,
video,
iframe {
    max-width: 100%;
    height: auto;
}

button,
.teacher-btn,
.student-btn {
    max-width: 100%;
    white-space: normal;
}

input,
select,
textarea {
    max-width: 100%;
    font-size: 16px !important;
}

textarea,
input,
select,
button {
    touch-action: manipulation;
}

:is(a, button, input, select, textarea, [role="button"], [tabindex]):focus-visible {
    outline: 2px solid rgba(30, 58, 138, 0.92);
    outline-offset: 2px;
}

@media (max-width: 767px) {
    [class*="overflow-y-auto"],
    [class*="overflow-auto"] {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
    }
}

.mobile-safe-scroll {
    padding-bottom: max(6rem, env(safe-area-inset-bottom));
}

@media (max-width: 767px) {
    [class*="modal"],
    [id*="modal"],
    .fc,
    .fc-view-harness,
    .fc-scroller,
    table {
        max-width: 100%;
    }
}

/* =========================================================================
   Accessibility System
   ========================================================================= */

:root {
    --a11y-accent: #1E3A8A;
    --a11y-accent-strong: #17367d;
    --a11y-accent-soft: rgba(30, 58, 138, 0.08);
    --a11y-accent-ring: rgba(30, 58, 138, 0.18);
    --a11y-text: #0f172a;
    --a11y-text-soft: #475569;
    --a11y-font-scale: 1;
    --a11y-readable-font-stack: "Arial", "Helvetica Neue", Helvetica, sans-serif;
}

html {
    font-size: calc(16px * var(--a11y-font-scale));
}

body.a11y-readable-font,
body.a11y-readable-font *:not(.fa-solid):not(.fa-regular):not(.fa-brands):not(.fa-light):not(.fa-duotone) {
    font-family: var(--a11y-readable-font-stack) !important;
    letter-spacing: normal !important;
}

body.a11y-high-contrast {
    background: #04111f !important;
    color: #f8fafc !important;
}

body.a11y-high-contrast * {
    text-shadow: none !important;
}

body.a11y-high-contrast :is(main, section, article, aside, header, footer, nav, form, table, tr, td, th, div, ul, ol, li, p, span, button, a, input, select, textarea, label) {
    background-image: none !important;
}

body.a11y-high-contrast :is(.bg-white, .bg-brand-light, .bg-brand-dark, .bg-brand-panel, .glass-card, .student-lessons-section, .teacher-calendar-surface, .student-dashboard-header, header, footer, main, section, aside, nav, [class*="bg-"]) {
    background-color: #04111f !important;
    color: #f8fafc !important;
    border-color: rgba(248, 250, 252, 0.34) !important;
}

body.a11y-high-contrast a {
    color: #93c5fd !important;
}

body.a11y-highlight-links a {
    text-decoration: underline !important;
    text-decoration-thickness: 0.18em !important;
    text-underline-offset: 0.22em !important;
    box-shadow: inset 0 -0.3em 0 rgba(251, 191, 36, 0.35);
    border-radius: 0.25rem;
}

body.a11y-highlight-headings :is(h1, h2, h3, h4, h5, h6) {
    position: relative;
    padding-inline-start: 1rem;
}

body.a11y-highlight-headings :is(h1, h2, h3, h4, h5, h6)::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    top: 0.2em;
    width: 0.36rem;
    height: calc(100% - 0.4em);
    border-radius: 999px;
    background: linear-gradient(180deg, #1E3A8A, #60A5FA);
}

html.a11y-reduce-motion *,
html.a11y-reduce-motion *::before,
html.a11y-reduce-motion *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
    scroll-behavior: auto !important;
}

body.a11y-strong-focus :focus {
    outline: none;
}

body.a11y-strong-focus :focus-visible,
body.a11y-panel-open :focus-visible {
    outline: 3px solid var(--a11y-accent) !important;
    outline-offset: 3px !important;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.96), 0 0 0 8px var(--a11y-accent-ring) !important;
    border-radius: 0.7rem;
}

body.a11y-strong-focus :is(a, button, input, select, textarea, [role="button"], [tabindex]):focus-visible,
body.a11y-panel-open :is(a, button, input, select, textarea, [role="button"], [tabindex]):focus-visible {
    position: relative;
    z-index: 3;
}

.a11y-live-region {
    position: fixed;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.a11y-widget {
    position: fixed;
    left: 1rem;
    right: auto;
    bottom: 1rem;
    z-index: 2147483000;
    pointer-events: none;
}

.a11y-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.26);
    z-index: 2147483000;
    pointer-events: auto;
}

.a11y-toggle {
    width: 3.5rem;
    height: 3.5rem;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 999px;
    background: #2563eb;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 22px rgba(30, 58, 138, 0.24);
    cursor: pointer;
    pointer-events: auto;
    line-height: 1;
}

.a11y-toggle:hover {
    background: #1d4ed8;
}

.a11y-toggle-icon {
    width: 2.15rem;
    height: 2.15rem;
    display: block;
    flex: 0 0 auto;
    overflow: visible;
}

.a11y-panel {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(25rem, calc(100vw - 0.75rem));
    background: #fff;
    border-inline-end: 1px solid #e2e8f0;
    box-shadow: 12px 0 32px rgba(15, 23, 42, 0.12);
    color: var(--a11y-text);
    z-index: 2147483001;
    overflow: hidden;
    direction: rtl;
    pointer-events: auto;
}

.a11y-panel[hidden] {
    display: none !important;
}

.a11y-panel-shell {
    height: 100%;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    background: #fff;
}

.a11y-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.9rem 1rem;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
}

.a11y-panel-title-wrap {
    min-width: 0;
}

.a11y-panel-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.a11y-panel-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 800;
}

.a11y-panel-close {
    width: 2rem;
    height: 2rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.6rem;
    background: #fff;
    color: #475569;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.a11y-panel-scroll {
    min-height: 0;
    overflow-y: auto;
    padding: 0.75rem 1rem 1rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.65) transparent;
}

.a11y-panel-scroll::-webkit-scrollbar {
    width: 8px;
}

.a11y-panel-scroll::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.55);
    border-radius: 999px;
}

.a11y-section + .a11y-section {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e2e8f0;
}

.a11y-section-title {
    margin: 0 0 0.45rem;
    font-size: 0.8rem;
    font-weight: 800;
    color: #334155;
}

.a11y-tile-grid {
    display: grid;
    gap: 0.45rem;
}

.a11y-tile-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.a11y-tile-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.a11y-tile,
.a11y-link {
    border-radius: 0.7rem;
    border: 1px solid #e2e8f0;
    background: #fff;
}

.a11y-tile {
    width: 100%;
    min-height: 5rem;
    padding: 0.6rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.4rem;
    text-align: right;
    color: #1e293b;
    transition: border-color 0.18s ease, background-color 0.18s ease;
}

.a11y-tile:hover,
.a11y-link:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.a11y-tile[aria-pressed="true"] {
    border-color: #93c5fd;
    background: #eff6ff;
}

.a11y-tile-action .a11y-tile-icon,
.a11y-tile-preset .a11y-tile-icon {
    background: #f1f5f9;
    color: #334155;
}

.a11y-tile-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 0.4rem;
}

.a11y-tile-icon {
    width: 1.9rem;
    height: 1.9rem;
    border-radius: 0.45rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    color: #334155;
}

.a11y-tile-state {
    display: inline-flex;
    align-items: center;
    min-height: 1.35rem;
    padding: 0.05rem 0.4rem;
    border-radius: 999px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #64748b;
    font-size: 0.62rem;
    font-weight: 700;
    flex-shrink: 0;
}

.a11y-tile[aria-pressed="true"] .a11y-tile-state {
    background: #dbeafe;
    border-color: #93c5fd;
    color: #1d4ed8;
}

.a11y-tile-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 800;
    line-height: 1.35;
    color: #1e293b;
}

.a11y-panel-status {
    margin-top: 0.15rem;
    font-size: 0.74rem;
    color: #64748b;
}

.a11y-panel-actions {
    position: relative;
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
    padding: 0.75rem 1rem max(0.75rem, env(safe-area-inset-bottom));
    background: #fff;
    border-top: 1px solid #e2e8f0;
}

.a11y-link,
.a11y-reset {
    min-height: 2.5rem;
    padding: 0.6rem;
    display: inline-flex;
    flex: 1 1 0%;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #1e293b;
    font-weight: 700;
    font-size: 0.76rem;
    text-align: center;
}

.a11y-reset {
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #334155;
}

.a11y-svg-icon {
    width: 1.1rem;
    height: 1.1rem;
    flex-shrink: 0;
}

.a11y-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 767px) {
    .a11y-widget {
        left: 0.75rem;
        bottom: 0.75rem;
    }

    .a11y-toggle {
        width: 3.5rem;
        height: 3.5rem;
    }

    .a11y-panel {
        width: min(23rem, calc(100vw - 0.5rem));
    }

    .a11y-tile-grid-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .a11y-panel-actions {
        gap: 0.5rem;
        padding-inline: 0.75rem;
    }

    .a11y-link,
    .a11y-reset {
        font-size: 0.72rem;
    }

    .a11y-panel-header {
        padding-inline: 0.8rem;
    }

    .a11y-panel-scroll {
        padding-inline: 0.75rem;
    }
}


/* =========================================================================
   Dynamic Background Animations (Glowing Orbs / Grid)
   ========================================================================= */

/* Elegant drifting orbs animation */
@keyframes drift {
    0% {
        transform: translateY(0) translateX(0) scale(1);
        opacity: 0.3;
    }

    50% {
        transform: translateY(-50px) translateX(30px) scale(1.1);
        opacity: 0.6;
    }

    100% {
        transform: translateY(0) translateX(0) scale(1);
        opacity: 0.3;
    }
}

@keyframes drift-slow {
    0% {
        transform: translateY(0) translateX(0) scale(1);
        opacity: 0.2;
    }

    50% {
        transform: translateY(60px) translateX(-40px) scale(1.2);
        opacity: 0.5;
    }

    100% {
        transform: translateY(0) translateX(0) scale(1);
        opacity: 0.2;
    }
}

/* Add this to a wrapper div behind dashboard content */
.animated-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
    background: radial-gradient(circle at 50% 50%, rgba(15, 23, 42, 1) 0%, rgba(10, 15, 30, 1) 100%);
}

.animated-bg .orb-1 {
    position: absolute;
    top: -10%;
    right: 10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(0, 229, 255, 0.08) 0%, rgba(0, 229, 255, 0) 70%);
    border-radius: 50%;
    animation: drift 15s infinite ease-in-out;
}

.animated-bg .orb-2 {
    position: absolute;
    bottom: -15%;
    left: 5%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.08) 0%, rgba(59, 130, 246, 0) 70%);
    border-radius: 50%;
    animation: drift-slow 20s infinite ease-in-out;
}

.animated-bg .grid-lines {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 50px 50px;
    mask-image: radial-gradient(circle at center, black 20%, transparent 80%);
    -webkit-mask-image: radial-gradient(circle at center, black 20%, transparent 80%);
}

/* Light mode overrides for background */
.light .animated-bg {
    background: #f8fafc;
}

.light .animated-bg .orb-1 {
    background: radial-gradient(circle, rgba(0, 229, 255, 0.2) 0%, rgba(0, 229, 255, 0) 70%);
}

.light .animated-bg .orb-2 {
    background: radial-gradient(circle, rgba(59, 130, 246, 0.2) 0%, rgba(59, 130, 246, 0) 70%);
}

.light .animated-bg .grid-lines {
    background-image:
        linear-gradient(to right, rgba(0, 0, 0, 0.03) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(0, 0, 0, 0.03) 1px, transparent 1px);
}

/* =========================================================================
   Logo Hover Animations
   ========================================================================= */

.logo-group {
    transition: all 0.3s ease-in-out;
    cursor: pointer;
}

.logo-group .logo-arrow {
    transition: all 0.3s ease-in-out;
}

.logo-group:hover .logo-arrow {
    transform: scale(1.1);
    filter: drop-shadow(0 0 8px rgba(0, 217, 192, 0.6));
}

.logo-group .logo-text-ontrack {
    transition: all 0.3s ease-in-out;
    background-size: 200% auto;
}

.logo-group:hover .logo-text-ontrack {
    background-image: linear-gradient(to right, #00D9C0 0%, #007A7A 50%, #00D9C0 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientShift 2s linear infinite;
}

@keyframes gradientShift {
    to {
        background-position: 200% center;
    }
}
