/* ==========================================================================
   Alsorayai Academy — Unified Design System (60-30-10 Petrol-Blue & Orange)
   ========================================================================== */

:root {
    /* 60% Base Canvas & Surfaces */
    --bg-canvas: #051E26;
    --bg-primary: #072D38;
    --surface-card: #0B3A49;
    --surface-elevated: #10495B;
    --surface-glass: rgba(7, 45, 56, 0.78);
    --surface-glass-strong: rgba(5, 30, 38, 0.92);

    /* Borders & Elevation */
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-medium: rgba(255, 255, 255, 0.14);
    --border-accent: rgba(237, 107, 47, 0.45);
    --shadow-sm: 0 4px 12px rgba(2, 16, 22, 0.22);
    --shadow-md: 0 12px 32px rgba(2, 16, 22, 0.34);
    --shadow-lg: 0 24px 56px rgba(2, 14, 20, 0.48);
    --shadow-orange: 0 10px 28px rgba(237, 107, 47, 0.28);

    /* 10% Brand Accent */
    --brand-orange: #ED6B2F;
    --brand-orange-hover: #FF7F45;
    --brand-orange-active: #D9591F;
    --brand-orange-soft: rgba(237, 107, 47, 0.14);

    /* 30% Typography & Semantic Status */
    --text-primary: #F8FAFC;
    --text-secondary: #CBD5E1;
    --text-muted: #8CA6B2;
    --status-success: #22C55E;
    --status-warning: #F59E0B;
    --status-danger: #EF4444;
    --status-info: #38BDF8;

    /* Layout & Rhythm (8pt Grid) */
    --nav-height: 76px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);

    /* Legacy variable aliases for smooth compatibility */
    --primary-color: var(--bg-primary);
    --primary-dark: var(--bg-primary);
    --primary-medium: #02475E;
    --primary-light: #036280;
    --secondary-color: var(--brand-orange);
    --accent-color: var(--brand-orange);
    --text-color: var(--text-primary);

    /* Bootstrap 5.3 Dark Surface Overrides (Prevents dark #212529 text on dark backgrounds) */
    --bs-body-color: #F8FAFC;
    --bs-body-bg: #051E26;
    --bs-secondary-color: #A9C2CE;
    --bs-tertiary-color: #93B0BE;
    --bs-emphasis-color: #FFFFFF;
    --bs-border-color: rgba(255, 255, 255, 0.12);
    --bs-list-group-color: #F8FAFC;
    --bs-list-group-bg: rgba(11, 58, 73, 0.72);
    --bs-table-color: #F8FAFC;
}

body.ds-body .text-muted,
body.ds-body .text-body-secondary {
    color: #A9C2CE !important;
}

body.ds-body .table {
    --bs-table-color: #F8FAFC;
    --bs-table-striped-color: #F8FAFC;
    --bs-table-hover-color: #FFFFFF;
    color: #F8FAFC;
}

/* Base Reset & Typography */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body.ds-body {
    font-family: 'Tajawal', 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-canvas);
    background-image:
        radial-gradient(ellipse 80% 50% at 50% -10%, rgba(16, 73, 91, 0.48), transparent),
        radial-gradient(circle at 12% 30%, rgba(237, 107, 47, 0.06), transparent 40%),
        linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-canvas) 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    margin: 0;
    padding-top: var(--nav-height);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.7;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Tajawal', sans-serif;
    line-height: 1.25;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.tabular-nums {
    font-family: 'Plus Jakarta Sans', 'Tajawal', sans-serif;
    font-variant-numeric: tabular-nums;
}

.ds-main-content {
    flex: 1 0 auto;
    width: 100%;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 9px;
    height: 9px;
}
::-webkit-scrollbar-track {
    background: var(--bg-canvas);
}
::-webkit-scrollbar-thumb {
    background: rgba(237, 107, 47, 0.65);
    border-radius: 999px;
    border: 2px solid var(--bg-canvas);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--brand-orange);
}

/* Focus Accessibility */
:focus-visible {
    outline: 2px solid var(--brand-orange);
    outline-offset: 2px;
}

/* ==========================================================================
   Buttons & Interactive Controls
   ========================================================================== */
.btn-brand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--brand-orange) 0%, #F4813E 100%);
    color: #FFFFFF !important;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md);
    padding: 10px 22px;
    font-weight: 700;
    font-size: 0.95rem;
    min-height: 44px;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(237, 107, 47, 0.25);
    transition: transform 0.22s var(--ease-spring), box-shadow 0.22s var(--ease-spring), background 0.22s ease;
}

.btn-brand:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg, var(--brand-orange-hover) 0%, #FF9359 100%);
    box-shadow: var(--shadow-orange);
    color: #FFFFFF !important;
}

.btn-brand:active {
    transform: translateY(0);
}

.btn-brand-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary) !important;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    padding: 10px 22px;
    font-weight: 600;
    font-size: 0.95rem;
    min-height: 44px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.22s var(--ease-spring);
}

.btn-brand-outline:hover {
    background: var(--brand-orange-soft);
    border-color: var(--brand-orange);
    color: var(--brand-orange-hover) !important;
    transform: translateY(-2px);
}

/* ==========================================================================
   Surfaces, Cards & Inputs
   ========================================================================== */
.ds-card {
    background: linear-gradient(160deg, rgba(16, 73, 91, 0.42) 0%, rgba(11, 58, 73, 0.86) 100%);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: transform 0.28s var(--ease-spring), border-color 0.28s ease, box-shadow 0.28s ease;
}

.ds-card:hover {
    border-color: var(--border-accent);
    box-shadow: var(--shadow-md);
}

.ds-glass {
    background: var(--surface-glass);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
}

.ds-input,
.ds-select {
    background-color: rgba(5, 30, 38, 0.72) !important;
    border: 1px solid var(--border-medium) !important;
    color: var(--text-primary) !important;
    border-radius: var(--radius-md) !important;
    padding: 10px 14px;
    min-height: 44px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ds-input::placeholder {
    color: var(--text-muted);
}

.ds-input:focus,
.ds-select:focus {
    background-color: rgba(7, 45, 56, 0.92) !important;
    border-color: var(--brand-orange) !important;
    box-shadow: 0 0 0 3px rgba(237, 107, 47, 0.22) !important;
    color: var(--text-primary) !important;
}

.ds-badge-accent {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--brand-orange-soft);
    border: 1px solid var(--border-accent);
    color: #FFB088;
    font-size: 0.82rem;
    font-weight: 700;
}

/* ==========================================================================
   Unified Header Navigation (RTL Sticky Glass)
   ========================================================================== */
.ds-navbar {
    height: var(--nav-height);
    background: rgba(5, 30, 38, 0.84);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-subtle);
    transition: background-color 0.25s ease, box-shadow 0.25s ease;
    z-index: 1040;
    padding: 0;
}

.ds-navbar > .container-xl {
    flex-wrap: nowrap !important;
    min-width: 0;
}

@media (max-width: 575.98px) {
    .ds-brand {
        gap: 7px;
        min-width: 0;
    }

    .ds-brand-logo {
        width: 34px;
        height: 34px;
    }

    .ds-brand-title {
        font-size: 0.88rem;
        white-space: nowrap;
    }

    .ds-icon-btn {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }

    .ds-user-trigger {
        padding: 3px 8px 3px 4px;
        gap: 5px;
    }

    .ds-user-avatar {
        width: 30px;
        height: 30px;
    }

    .ds-navbar-cta {
        padding: 7px 12px !important;
        font-size: 0.82rem !important;
        min-height: 36px !important;
        white-space: nowrap;
    }
}

@media (max-width: 379.98px) {
    .ds-brand-text {
        display: none !important;
    }
}

.ds-navbar.is-scrolled {
    background: rgba(5, 30, 38, 0.96);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    border-bottom-color: var(--border-medium);
}

.ds-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-primary);
    flex-shrink: 0;
}

.ds-brand-logo {
    width: 42px;
    height: 42px;
    object-fit: contain;
    border-radius: 10px;
    transition: transform 0.3s var(--ease-spring);
}

.ds-brand:hover .ds-brand-logo {
    transform: scale(1.06) rotate(-4deg);
}

.ds-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.ds-brand-title {
    font-weight: 800;
    font-size: 1.02rem;
    color: var(--text-primary);
}

.ds-brand-sub {
    font-size: 0.7rem;
    color: var(--brand-orange);
    font-weight: 600;
}

.ds-nav-list {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.ds-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-md);
    color: var(--text-secondary) !important;
    font-weight: 600;
    font-size: 0.92rem;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.ds-nav-link:hover {
    color: var(--text-primary) !important;
    background: rgba(255, 255, 255, 0.06);
}

.ds-nav-link.active {
    color: #FFFFFF !important;
    background: var(--brand-orange-soft);
    border: 1px solid rgba(237, 107, 47, 0.32);
}

.ds-live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--status-danger);
    display: inline-block;
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    animation: dsLivePulse 1.8s infinite;
}

@keyframes dsLivePulse {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { box-shadow: 0 0 0 7px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.ds-dropdown-menu {
    background: var(--surface-glass-strong) !important;
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-medium) !important;
    border-radius: var(--radius-lg) !important;
    padding: 8px !important;
    min-width: 230px;
    box-shadow: var(--shadow-lg) !important;
}

.ds-dropdown-item {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 12px !important;
    border-radius: var(--radius-sm) !important;
    color: var(--text-secondary) !important;
    font-weight: 500;
    font-size: 0.9rem;
    transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.ds-dropdown-item:hover,
.ds-dropdown-item.active {
    background: rgba(237, 107, 47, 0.16) !important;
    color: #FFFFFF !important;
}

.ds-icon-btn {
    position: relative;
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.2s ease;
}

.ds-icon-btn:hover {
    background: var(--brand-orange-soft);
    border-color: var(--border-accent);
    color: #FFFFFF;
}

.ds-icon-btn.active {
    background: linear-gradient(135deg, rgba(237, 107, 47, 0.28) 0%, rgba(237, 107, 47, 0.14) 100%);
    border-color: var(--brand-orange);
    color: #FFFFFF;
    box-shadow: 0 0 0 3px rgba(237, 107, 47, 0.18), 0 8px 20px rgba(237, 107, 47, 0.24);
}

.ds-icon-btn.active::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 18px;
    height: 3px;
    border-radius: 999px;
    background: var(--brand-orange);
}

.ds-icon-badge {
    position: absolute;
    top: -5px;
    left: -5px;
    min-width: 19px;
    height: 19px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--brand-orange);
    color: #FFFFFF;
    font-size: 0.68rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-canvas);
}

.ds-user-trigger {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 5px 12px 5px 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.2s ease;
}

.ds-user-trigger:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--border-accent);
    color: #FFFFFF;
}

.ds-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--brand-orange);
}

.ds-offcanvas {
    background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-canvas) 100%) !important;
    color: var(--text-primary) !important;
    border-left: 1px solid var(--border-medium) !important;
    max-width: 320px !important;
}

/* ==========================================================================
   Unified Footer (Clean RTL 4-Column)
   ========================================================================== */
.ds-footer {
    background: linear-gradient(180deg, rgba(7, 45, 56, 0.85) 0%, #03151B 100%);
    border-top: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    padding: 64px 0 0;
    margin-top: 64px;
    position: relative;
}

.ds-footer-heading {
    color: #FFFFFF;
    font-size: 1.05rem;
    font-weight: 800;
    margin-bottom: 20px;
    position: relative;
    padding-bottom: 10px;
}

.ds-footer-heading::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 36px;
    height: 3px;
    border-radius: 999px;
    background: var(--brand-orange);
}

.ds-footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ds-footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.94rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: color 0.2s ease, transform 0.2s ease;
}

.ds-footer-links a:hover {
    color: var(--brand-orange-hover);
    transform: translateX(-4px);
}

.ds-social-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.22s var(--ease-spring);
}

.ds-social-btn:hover {
    background: var(--brand-orange);
    border-color: var(--brand-orange);
    color: #FFFFFF;
    transform: translateY(-3px);
}

.ds-footer-bottom {
    margin-top: 48px;
    padding: 20px 0;
    border-top: 1px solid var(--border-subtle);
    background: rgba(0, 0, 0, 0.18);
    font-size: 0.88rem;
    color: var(--text-muted);
}

/* ==========================================================================
   Toast / Alert System
   ========================================================================== */
.ds-alerts-wrap {
    position: fixed;
    top: calc(var(--nav-height) + 16px);
    left: 20px;
    z-index: 1060;
    max-width: 420px;
    width: calc(100% - 40px);
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.ds-alert-toast {
    pointer-events: auto;
    background: var(--surface-glass-strong);
    backdrop-filter: blur(14px);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: dsToastIn 0.3s var(--ease-spring);
}

.ds-alert-toast.is-success { border-right: 4px solid var(--status-success); }
.ds-alert-toast.is-warning { border-right: 4px solid var(--status-warning); }
.ds-alert-toast.is-danger { border-right: 4px solid var(--status-danger); }

@keyframes dsToastIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}


/* ==========================================================================
   Course Card & Page Header Components (Shared Across Courses & Routes)
   ========================================================================== */
.ds-page-hero {
    background: linear-gradient(145deg, rgba(16, 73, 91, 0.72) 0%, rgba(5, 30, 38, 0.92) 100%);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 32px;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.ds-course-card {
    background: linear-gradient(165deg, rgba(16, 73, 91, 0.56) 0%, rgba(7, 45, 56, 0.94) 100%);
    border: 1px solid var(--border-medium);
    border-radius: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    box-shadow: var(--shadow-sm);
    transition: transform 0.28s var(--ease-spring), border-color 0.28s ease, box-shadow 0.28s ease;
}

.ds-course-card:hover {
    transform: translateY(-6px);
    border-color: var(--brand-orange);
    box-shadow: 0 20px 44px rgba(2, 16, 22, 0.45), 0 0 0 1px rgba(237, 107, 47, 0.25);
}

.ds-course-thumb-wrap {
    position: relative;
    height: 196px;
    overflow: hidden;
    background: var(--bg-canvas);
}

.ds-course-thumb-wrap::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(5, 30, 38, 0.08) 40%, rgba(5, 30, 38, 0.72) 100%);
    pointer-events: none;
}

.ds-course-thumb-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.45s var(--ease-spring);
}

.ds-course-card:hover .ds-course-thumb-wrap img {
    transform: scale(1.06);
}

.ds-course-ribbon {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 2;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 800;
    color: #FFFFFF;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.32);
}

.ds-course-ribbon--new {
    background: linear-gradient(135deg, var(--brand-orange), #F4813E);
}

.ds-course-ribbon--updated {
    background: linear-gradient(135deg, #16A34A, #22C55E);
}

.ds-course-cat-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(237, 107, 47, 0.14);
    border: 1px solid rgba(237, 107, 47, 0.35);
    color: #FFB088;
    font-size: 0.76rem;
    font-weight: 700;
    width: fit-content;
}

.ds-course-specs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(5, 30, 38, 0.55);
    border: 1px solid var(--border-subtle);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.ds-course-spec-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.ds-course-spec-item i {
    color: #FFB088;
    font-size: 0.84rem;
}

/* Classroom Portal Styles */
.ds-kpi-chip {
    background: rgba(5, 30, 38, 0.68);
    border: 1px solid var(--border-medium);
    border-radius: 14px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.ds-kpi-chip-icon {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    background: var(--brand-orange-soft);
    border: 1px solid var(--border-accent);
    color: #FFB088;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ds-segmented-tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    padding: 8px;
    background: rgba(5, 30, 38, 0.72);
    border: 1px solid var(--border-subtle);
    border-radius: 18px;
    width: fit-content;
    max-width: 100%;
    margin: 0 auto 28px;
}

.ds-segmented-tabs .nav-link {
    border: none;
    border-radius: 12px;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 700;
    padding: 10px 18px;
    font-size: 0.92rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.22s ease;
}

.ds-segmented-tabs .nav-link:hover {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.06);
}

.ds-segmented-tabs .nav-link.active {
    background: linear-gradient(135deg, var(--brand-orange), #F4813E);
    color: #FFFFFF;
    box-shadow: var(--shadow-orange);
}

.ds-filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.ds-filter-pill:hover,
.ds-filter-pill.active {
    background: var(--brand-orange);
    border-color: var(--brand-orange);
    color: #FFFFFF;
}


/* ==========================================================================
   Split-Screen Modern Auth Architecture (Full-Bleed Diagonal / + Open Canvas)
   ========================================================================== */
.ds-auth-shell {
    min-height: calc(100vh - var(--nav-height));
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-end; /* In RTL, flex-end pushes form to the LEFT side */
    background: var(--bg-canvas);
    overflow: hidden;
}

.ds-auth-visual {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    width: 62%;
    z-index: 1;
    pointer-events: none;
}

.ds-auth-visual-frame {
    position: relative;
    width: 100%;
    height: 100%;
    clip-path: polygon(18% 0, 100% 0, 100% 100%, 0% 100%);
    -webkit-clip-path: polygon(18% 0, 100% 0, 100% 100%, 0% 100%);
    overflow: hidden;
    background: var(--bg-primary);
}

.ds-auth-visual-slash {
    position: absolute;
    inset: 0;
    z-index: 3;
    background: linear-gradient(180deg, rgba(237, 107, 47, 0.95) 0%, rgba(255, 147, 89, 0.55) 55%, rgba(237, 107, 47, 0.9) 100%);
    clip-path: polygon(17.7% 0, 18.3% 0, 0.6% 100%, 0% 100%);
    -webkit-clip-path: polygon(17.7% 0, 18.3% 0, 0.6% 100%, 0% 100%);
    pointer-events: none;
}

.ds-auth-visual-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 62% 22%;
    display: block;
}

.ds-auth-visual-overlay {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(5, 30, 38, 0.45) 0%, rgba(5, 30, 38, 0.08) 28%, transparent 55%),
        linear-gradient(180deg, rgba(5, 30, 38, 0.08) 55%, rgba(5, 30, 38, 0.85) 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-start;
    padding: 28px 40px 28px 18%;
}

.ds-auth-caption-box {
    background: rgba(5, 30, 38, 0.72);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 16px;
    padding: 14px 20px;
    max-width: 420px;
}

.ds-auth-form-pane {
    position: relative;
    z-index: 4;
    width: 44%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px 40px;
}

.ds-auth-form-inner {
    width: 100%;
    max-width: 440px;
}

.ds-auth-form-inner.is-wide {
    max-width: 510px;
}

/* Open-Canvas Sleek Input Field with High-Contrast Icon */
.ds-field-label {
    display: block;
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 7px;
}

.ds-field-wrap {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-bottom: 2px solid rgba(255, 255, 255, 0.22);
    border-radius: 14px;
    transition: border-color 0.22s ease, background-color 0.22s ease, box-shadow 0.22s ease;
}

.ds-field-wrap:focus-within {
    background: rgba(11, 58, 73, 0.55);
    border-color: var(--brand-orange);
    box-shadow: 0 0 0 4px rgba(237, 107, 47, 0.16);
}

.ds-field-icon {
    position: absolute;
    right: 16px;
    color: #FFB088;
    font-size: 1rem;
    pointer-events: none;
    z-index: 2;
}

.ds-field-input {
    width: 100%;
    background: transparent !important;
    border: none !important;
    color: #FFFFFF !important;
    padding: 13px 46px 13px 16px;
    font-size: 0.96rem;
    min-height: 48px;
    outline: none;
    box-shadow: none !important;
}

.ds-field-input.has-action {
    padding-left: 46px;
}

.ds-field-input::placeholder {
    color: #96B0BC;
    opacity: 1;
}

.ds-field-input option {
    background-color: var(--bg-primary);
    color: #FFFFFF;
}

.ds-field-action {
    position: absolute;
    left: 10px;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    color: #F8FAFC;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.ds-field-action:hover {
    background: var(--brand-orange);
    color: #FFFFFF;
}

.ds-remember-switch {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.ds-remember-switch .form-check-input {
    width: 1.15em;
    height: 1.15em;
    cursor: pointer;
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.35);
}

.ds-remember-switch .form-check-input:checked {
    background-color: var(--brand-orange);
    border-color: var(--brand-orange);
}

.ds-no-footer-gap .ds-footer {
    margin-top: 0;
}

@media (max-width: 1199.98px) {
    .ds-auth-visual {
        width: 55%;
    }
    .ds-auth-form-pane {
        width: 48%;
        padding: 24px 28px;
    }
}

@media (max-width: 991.98px) {
    .ds-auth-shell {
        flex-direction: column;
        justify-content: flex-start;
        min-height: auto;
    }

    .ds-auth-visual {
        position: relative;
        width: 100%;
        height: 220px;
    }

    .ds-auth-visual-frame {
        clip-path: polygon(0 0, 100% 0, 100% 88%, 0 100%);
        -webkit-clip-path: polygon(0 0, 100% 0, 100% 88%, 0 100%);
    }

    .ds-auth-visual-slash {
        display: none;
    }

    .ds-auth-visual-overlay {
        padding: 16px;
    }

    .ds-auth-form-pane {
        width: 100%;
        padding: 24px 18px 36px;
    }
}

/* ==========================================================================
   Student Learning Preloader Animations (GPU-Composited Only)
   ========================================================================== */
.ds-loader-scene {
    width: 240px;
    max-width: 72vw;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ds-loader-svg {
    width: 100%;
    height: auto;
    overflow: visible;
    filter: drop-shadow(0 16px 32px rgba(0, 0, 0, 0.35));
}

.ds-loader-halo {
    transform-origin: 130px 96px;
    animation: dsLoaderPulse 2.4s ease-in-out infinite;
}

.ds-loader-orbit {
    transform-origin: 130px 96px;
    animation: dsLoaderSpin 14s linear infinite;
}

.ds-loader-student {
    animation: dsLoaderBreathe 2.2s ease-in-out infinite;
}

.ds-loader-spark-1 {
    animation: dsLoaderFloatA 2.6s ease-in-out infinite;
}

.ds-loader-bulb {
    transform-origin: 194px 54px;
    animation: dsLoaderFloatB 2.1s ease-in-out infinite;
}

.ds-loader-spark-2 {
    animation: dsLoaderPulse 1.8s ease-in-out infinite alternate;
}

.ds-code-line-1,
.ds-code-line-2,
.ds-code-line-3 {
    transform-origin: 108px 125px;
    animation: dsCodeTyping 1.5s ease-in-out infinite;
}

.ds-code-line-2 {
    animation-delay: 0.25s;
}

.ds-code-line-3 {
    animation-delay: 0.5s;
}

.ds-book-page {
    transform-origin: 84px 136px;
    animation: dsPageFlip 1.9s ease-in-out infinite;
}

.ds-loader-bar-track {
    width: 200px;
    height: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.ds-loader-bar-fill {
    width: 45%;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--brand-orange), #F59E0B, #38BDF8);
    animation: dsLoaderSlide 0.9s ease-in-out infinite;
}

@keyframes dsLoaderPulse {
    0%, 100% { opacity: 0.72; transform: scale(0.97); }
    50% { opacity: 1; transform: scale(1.04); }
}

@keyframes dsLoaderSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes dsLoaderBreathe {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

@keyframes dsLoaderFloatA {
    0%, 100% { transform: translateY(0) rotate(-3deg); }
    50% { transform: translateY(-7px) rotate(3deg); }
}

@keyframes dsLoaderFloatB {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-6px) scale(1.08); }
}

@keyframes dsCodeTyping {
    0%, 100% { opacity: 0.55; transform: scaleX(0.86); }
    50% { opacity: 1; transform: scaleX(1); }
}

@keyframes dsPageFlip {
    0%, 100% { transform: rotate(0deg); opacity: 0.75; }
    50% { transform: rotate(-14deg); opacity: 1; }
}

@keyframes dsLoaderSlide {
    0% { transform: translateX(140%); }
    100% { transform: translateX(-160%); }
}

@media (prefers-reduced-motion: reduce) {
    .ds-loader-halo,
    .ds-loader-orbit,
    .ds-loader-student,
    .ds-loader-spark-1,
    .ds-loader-bulb,
    .ds-loader-spark-2,
    .ds-code-line-1,
    .ds-code-line-2,
    .ds-code-line-3,
    .ds-book-page,
    .ds-loader-bar-fill {
        animation: none !important;
    }
}
