/**
 * css/auth.css - shared design system for the standalone auth pages
 * (lms/login.php, lms/admin/login.php, lms/register.php, lms/forgot-password.php):
 * the split auth card, brand panel, icon inputs, gradient action button,
 * alerts, loading states, entrance animations and the responsive behaviour.
 * One change here updates every auth page.
 *
 * The --ki-* tokens below are the Kolo Innovate auth palette (navy / teal /
 * cyan / amber family). Keep all auth-specific colors/radii/sizes referenced
 * through them so the brand can be retuned in one place. Both pages load
 * kolo.css first (via includes/head-assets.php) for the base tokens and
 * vendor styles; this file only carries the auth shell.
 */

/* ===== Kolo Innovate auth design tokens ===== */
:root {
    --ki-navy: #0B2945;
    --ki-navy-secondary: #123B5C;
    --ki-teal: #087F8C;
    --ki-teal-bright: #13A8B5;
    --ki-cyan: #35C6D4;
    --ki-amber: #FFB02E;
    --ki-white: #FFFFFF;
    --ki-background: #F3F7FB;
    --ki-input: #EEF4FD;
    --ki-text: #102B49;
    --ki-muted: #667085;
    --ki-border: #D9E2EC;
    --ki-error: #D92D20;
    --ki-success: #12B76A;
    --ki-warning: #F79009;
    --ki-radius-card: 24px;
    --ki-radius-input: 12px;
    --ki-radius-btn: 12px;
    --ki-input-height: 52px;
    --ki-btn-height: 54px;
    --ki-shadow-card: 0 24px 70px rgba(11, 41, 69, .14);
}

body.auth-page { font-family: var(--font-body); color: var(--ki-text); background: linear-gradient(160deg, var(--ki-background) 0%, #E7EFF9 100%); line-height: 1.7; overflow-x: hidden; min-height: 100vh; }
body.auth-page ::selection { background: var(--ki-teal); color: #fff; }
body.auth-page ::-webkit-scrollbar { width: 8px; } body.auth-page ::-webkit-scrollbar-track { background: #f1f1f1; } body.auth-page ::-webkit-scrollbar-thumb { background: var(--ki-navy); border-radius: 10px; }
body.auth-page ::-webkit-scrollbar-thumb:hover { background: var(--ki-navy-secondary); }

.auth-section-pad { padding: 72px 0; }

/* ===== Split auth card ===== */
.auth-wrap { max-width: 1380px; margin: 0 auto; animation: authFadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes authFadeUp { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }
.auth-card { background: var(--ki-white); border-radius: var(--ki-radius-card); box-shadow: var(--ki-shadow-card); display: flex; overflow: hidden; }

/* Left brand panel */
/* Desk photo (laptop + pen + notebook) sits under the brand gradient: the
   145deg tint keeps the original navy->teal hues solid where the heading
   lives (top-left) and lets the photo show through toward the bottom-right;
   the bottom scrim keeps white footer text legible over light photo areas. */
.auth-brand {
    flex: 0 0 40%; position: relative; overflow: hidden; color: #fff;
    background:
        linear-gradient(180deg, rgba(7, 28, 49, 0) 40%, rgba(7, 28, 49, 0.55) 100%),
        linear-gradient(145deg, rgba(11, 41, 69, 0.95) 0%, rgba(18, 59, 92, 0.78) 50%, rgba(8, 127, 140, 0.5) 100%),
        url('../images/auth/auth-brand-desk.jpg') center / cover no-repeat;
    padding: 52px 44px; display: flex; min-height: 660px;
}
.auth-brand::before, .auth-brand::after { content: ''; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, 0.05); }
.auth-brand::before { width: 340px; height: 340px; top: -120px; right: -120px; }
.auth-brand::after { width: 260px; height: 260px; bottom: -90px; left: -110px; background: rgba(255, 176, 46, 0.10); }
.auth-brand .auth-brand-inner { position: relative; z-index: 1; display: flex; flex-direction: column; height: 100%; }
.auth-brand .brand-logo { width: 150px; height: auto; margin-bottom: 6px; filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.25)); }
.auth-brand .brand-badge { display: inline-flex; align-items: center; gap: 8px; background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 50px; padding: 6px 14px; font-size: 0.72rem; letter-spacing: 1.5px; text-transform: uppercase; width: max-content; max-width: 100%; }
.auth-brand h3 { font-family: var(--font-poppins); font-weight: 700; margin: 22px 0 10px; font-size: 2.25rem; line-height: 1.2; }
.auth-brand .brand-sub { color: rgba(255, 255, 255, 0.86); font-size: 0.95rem; margin: 0; }
.auth-brand .brand-points { list-style: none; margin: 28px 0 0; padding: 0; display: grid; gap: 14px; }
.auth-brand .brand-points li { display: flex; gap: 12px; align-items: flex-start; font-size: 0.9rem; color: rgba(255, 255, 255, 0.94); }
.auth-brand .brand-points i { color: var(--ki-amber); font-size: 1.05rem; line-height: 1.5; }
.auth-brand .brand-foot { margin-top: auto; padding-top: 30px; }
.auth-brand .brand-foot p { font-size: 0.82rem; color: rgba(255, 255, 255, 0.78); margin: 0 0 12px; }
.btn-outline-light-custom { border: 1.5px solid rgba(255, 255, 255, 0.5); color: #fff; border-radius: 50px; padding: 9px 22px; font-weight: 600; font-size: 0.88rem; transition: var(--transition); text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.btn-outline-light-custom:hover { background: #fff; color: var(--ki-navy); }
.btn-outline-light-custom:focus-visible { outline: 2px solid var(--ki-cyan); outline-offset: 3px; }

/* Floating orbs (decorative, clipped by the panel) */
.auth-brand .auth-orb { position: absolute; border-radius: 50%; filter: blur(60px); opacity: 0.35; z-index: 0; pointer-events: none; }
.auth-brand .auth-orb.o1 { width: 210px; height: 210px; top: 10%; right: -70px; background: var(--ki-teal-bright); animation: orbFloat 9s ease-in-out infinite; }
.auth-brand .auth-orb.o2 { width: 150px; height: 150px; bottom: 16%; left: -50px; background: var(--ki-amber); animation: orbFloat 11s ease-in-out infinite reverse; }
@keyframes orbFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-18px); } }
.auth-brand-inner > * { animation: authFadeUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) both; }
.auth-brand-inner > *:nth-child(1) { animation-delay: 0.05s; }
.auth-brand-inner > *:nth-child(2) { animation-delay: 0.12s; }
.auth-brand-inner > *:nth-child(3) { animation-delay: 0.19s; }
.auth-brand-inner > *:nth-child(4) { animation-delay: 0.26s; }
.auth-brand-inner > *:nth-child(5) { animation-delay: 0.33s; }

/* Right form panel */
.auth-form { flex: 1; padding: 48px 52px; min-width: 0; }
.auth-form .auth-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 6px; }
.auth-form .auth-top h4 { font-family: var(--font-poppins); font-weight: 700; color: var(--ki-navy); font-size: 1.6rem; margin: 0; }
.auth-form .auth-top .auth-mobile-login { font-size: 0.85rem; white-space: nowrap; /* inline-block keeps the space between the text runs (inline-flex would swallow it) */ display: inline-block; padding: 10px 0; margin: -10px 0; color: var(--ki-teal); font-weight: 500; text-decoration: none; }
.auth-form .auth-top .auth-mobile-login strong { color: var(--ki-navy); font-weight: 700; }
.auth-form .auth-top .auth-mobile-login:hover, .auth-form .auth-top .auth-mobile-login:hover strong { color: var(--ki-teal); text-decoration: underline; }
.auth-form .auth-eyebrow { font-size: 0.7rem; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--ki-teal); margin-bottom: 4px; }

.auth-section { margin-bottom: 26px; }
.auth-section-title { display: flex; align-items: center; gap: 10px; font-family: var(--font-poppins); font-size: 0.74rem; font-weight: 600; letter-spacing: 1.6px; text-transform: uppercase; color: var(--ki-teal); margin-bottom: 16px; }
.auth-section-title::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--ki-border), transparent); }
.auth-section-title i { font-size: 0.95rem; }

.auth-form .form-label { font-weight: 600; color: var(--ki-text); margin-bottom: 7px; font-size: 0.85rem; }
.auth-form .form-label .req { color: var(--ki-error); }
.auth-form .form-label .opt { color: var(--ki-muted); font-weight: 400; font-size: 0.78rem; }

.auth-form .input-group-text {
    background: #E6EEFA; border: 1px solid var(--ki-border); border-right: 0;
    color: var(--ki-teal); font-size: 1rem; padding-left: 14px; padding-right: 12px;
    border-radius: var(--ki-radius-input) 0 0 var(--ki-radius-input);
}
.auth-form .input-icon .form-control, .auth-form .input-icon .form-select { border-left: 0; }
.auth-form .form-control-custom, .auth-form .form-select {
    border-radius: var(--ki-radius-input); border: 1px solid var(--ki-border);
    min-height: var(--ki-input-height);
    padding: 12px 14px; font-size: 1rem; /* 16px: prevents iOS Safari focus-zoom */
    background-color: var(--ki-input); transition: var(--transition);
}
.auth-form .form-control-custom:focus, .auth-form .form-select:focus {
    border-color: var(--ki-cyan); box-shadow: 0 0 0 3px rgba(53, 198, 212, 0.12);
    background: #fff; outline: none;
}
.auth-form .form-control-custom::placeholder { color: #98A4B6; }
.auth-form .form-control-custom.is-invalid, .auth-form .form-select.is-invalid { border-color: var(--ki-error); box-shadow: 0 0 0 3px rgba(217, 45, 32, 0.10); }
.auth-form input[aria-invalid="true"], .auth-form select[aria-invalid="true"] { border-color: var(--ki-error); }
.auth-form .form-control:focus-visible, .auth-form .form-select:focus-visible { outline: none; }

/* Inline validation messages - the registration form gets these from
   kolo.css (.reg-form scope); login forms get them from js/auth.js which
   injects .invalid-msg elements right after the field group. */
.auth-form .invalid-msg { color: var(--ki-error); font-size: 0.78rem; margin-top: 5px; display: none; }
.auth-form .invalid-msg.show { display: block; }

/* Password visibility wrapper (shared with js/auth.js toggles) */
.auth-pw { position: relative; }
.auth-pw .form-control { padding-right: 46px; }
.auth-pw .toggle-pass { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--ki-muted); padding: 10px; cursor: pointer; font-size: 1.05rem; z-index: 5; min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; transition: var(--transition); }
.auth-pw .toggle-pass:hover { color: var(--ki-teal); }
.auth-pw .toggle-pass:focus-visible { outline: 2px solid var(--ki-cyan); outline-offset: 1px; }

/* Profile photo upload (register) */
.photo-drop { border: 1.5px dashed var(--ki-border); border-radius: var(--radius-md); padding: 18px; display: flex; align-items: center; gap: 16px; background: #FAFCFF; transition: var(--transition); }
.photo-drop.drag { border-color: var(--ki-cyan); background: #EDFAFC; }
.photo-drop .photo-preview { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; border: 1px solid var(--ki-border); display: none; background: #fff; flex: none; }
.photo-drop .photo-preview.show { display: block; }
.photo-drop .photo-meta { flex: 1; min-width: 0; }
.photo-drop .photo-meta strong { font-size: 0.85rem; color: var(--ki-text); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo-drop .photo-meta small { color: var(--ki-muted); font-size: 0.76rem; }
.photo-drop .photo-actions { display: flex; gap: 8px; flex: none; }
.btn-file { border: 1px solid var(--ki-border); background: #fff; border-radius: 8px; padding: 9px 16px; font-size: 0.82rem; font-weight: 600; color: var(--ki-navy); transition: var(--transition); cursor: pointer; }
.btn-file:hover { border-color: var(--ki-teal); color: var(--ki-teal); }
.btn-file:focus-visible { outline: 2px solid var(--ki-cyan); outline-offset: 2px; }

.form-check-custom { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 18px; }
.form-check-custom .form-check-input { margin-top: 4px; border-color: var(--ki-border); }
.form-check-custom .form-check-input:checked { background-color: var(--ki-teal); border-color: var(--ki-teal); }
.form-check-custom .form-check-input.is-invalid { border-color: var(--ki-error); }
.form-check-custom label { font-size: 0.84rem; color: var(--ki-muted); }
.form-check-custom a { color: var(--ki-teal); font-weight: 600; text-decoration: none; }
.form-check-custom a:hover { color: var(--ki-navy); text-decoration: underline; }

/* "Remember me" checkbox row - shared by the student and staff login forms
   so the two portals can never drift again (one inline-styled, one not).
   The checkbox visual itself (teal fill, drawn checkmark, pop animation)
   lives in css/kolo.css (.auth-remember input[type=checkbox]) which loads
   on both portals; only the row layout is styled here. */
.auth-remember { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.auth-remember label { font-size: 0.88rem; color: var(--text-medium, #45454F); font-weight: 500; cursor: pointer; margin: 0; user-select: none; }
.auth-remember label:hover { color: var(--ki-teal); }

/* Primary gradient action button (+ hover shine sweep, loading state) */
.btn-auth { width: 100%; min-height: var(--ki-btn-height); background: linear-gradient(90deg, var(--ki-navy), var(--ki-teal)); color: #fff; border: none; border-radius: var(--ki-radius-btn); padding: 14px 20px; font-weight: 700; font-size: 1rem; transition: var(--transition); display: inline-flex; align-items: center; justify-content: center; gap: 10px; position: relative; overflow: hidden; }
.btn-auth:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(8, 127, 140, 0.35); color: #fff; }
.btn-auth:active { transform: translateY(0); }
.btn-auth::after { content: ''; position: absolute; top: 0; left: -80%; width: 50%; height: 100%; background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.28), transparent); transform: skewX(-20deg); transition: left 0.6s ease; }
.btn-auth:hover::after { left: 130%; }
.btn-auth:focus-visible { outline: 2px solid var(--ki-cyan); outline-offset: 3px; }
.btn-auth:disabled, .btn-auth[aria-busy="true"] { cursor: progress; opacity: .92; transform: none; box-shadow: none; }
.btn-auth:disabled::after { display: none; }
/* Loading spinner shown inside the button while the request is in flight
   (js/auth.js swaps the label for this + the data-loading-text copy). */
.auth-spinner { width: 16px; height: 16px; border: 2px solid rgba(255, 255, 255, 0.45); border-top-color: #fff; border-radius: 50%; display: inline-block; flex: none; animation: authSpin 0.7s linear infinite; }
@keyframes authSpin { to { transform: rotate(360deg); } }

/* Secondary full-width outlined action (login → create account) */
.auth-alt-btn { width: 100%; border: 1.5px solid var(--ki-navy); color: var(--ki-navy); border-radius: var(--ki-radius-btn); padding: 12px 20px; font-weight: 600; font-size: 0.92rem; display: inline-flex; align-items: center; justify-content: center; gap: 10px; transition: var(--transition); text-decoration: none; }
.auth-alt-btn:hover { background: var(--ki-navy); color: #fff; }

.auth-bottom { text-align: center; margin-top: 18px; font-size: 0.88rem; color: var(--ki-muted); }
.auth-bottom a { color: var(--ki-teal); font-weight: 600; text-decoration: none; }
/* Generic small utility links inside the auth card (e.g. "Forgot your
   password?"). display:inline + vertical padding grows the touch target
   WITHOUT affecting line layout - inline-block + negative margins made
   multi-line paragraphs interleave (visible on the terms line at 320px). */
.auth-form a { display: inline; padding: 8px 4px; margin: 0; }
.auth-bottom a:hover { color: var(--ki-navy); text-decoration: underline; }
.auth-secure-note { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 0.78rem; color: var(--ki-muted); text-align: center; margin-top: 12px; }
.auth-secure-note i { color: var(--ki-teal); flex: none; }

/* Inline legal links (Privacy Policy / Terms of Use) sit inside sentences -
   keep them inline so the label wraps naturally; vertical padding still
   grows the tap target without changing line spacing. */
.auth-form .form-check-label a,
.auth-form .reg-terms .form-check-label a { display: inline; padding: 8px 3px; margin: 0; color: var(--ki-teal); font-weight: 600; text-decoration: none; }
.auth-form .reg-terms .form-check-label a:hover { color: var(--ki-navy); text-decoration: underline; }

/* The form-check input itself must be a finger-sized target, not a 17px dot:
   the label is the click proxy (Bootstrap pattern), so make it comfortable. */
.auth-remember,
.auth-form .reg-terms { min-height: 40px; align-items: center; }
.auth-remember input[type="checkbox"],
.auth-form .reg-terms .form-check-input { width: 19px; height: 19px; cursor: pointer; }
.auth-form .reg-terms .form-check-label { cursor: pointer; }

/* Reusable alerts (success / error / warning / info) - always fit the
   viewport; long messages wrap naturally. */
.auth-alert { display: flex; align-items: flex-start; gap: 10px; border-radius: 12px; padding: 13px 15px; font-size: 0.88rem; margin-bottom: 22px; overflow-wrap: anywhere; }
.auth-alert i { flex: none; margin-top: 2px; }
.auth-alert.success { background: rgba(18, 183, 106, 0.10); border: 1px solid rgba(18, 183, 106, 0.35); color: #0E7A54; }
.auth-alert.error { background: rgba(217, 45, 32, 0.08); border: 1px solid rgba(217, 45, 32, 0.30); color: #B42318; }
.auth-alert.info { background: rgba(8, 127, 140, 0.08); border: 1px solid rgba(8, 127, 140, 0.30); color: #07626D; }
.auth-alert.warning { background: rgba(247, 144, 9, 0.12); border: 1px solid rgba(247, 144, 9, 0.40); color: #93370D; }

.auth-back { text-align: center; margin-top: 18px; }
.auth-back a { color: var(--ki-muted); font-size: 0.84rem; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; /* 40px tap target via transparent padding */ padding: 9px 8px; margin: -9px -8px; }
.auth-back a:hover { color: var(--ki-teal); }

/* Keyboard focus affordance for every interactive element in the auth shell */
.auth-form a:focus-visible, .auth-back a:focus-visible, .auth-bottom a:focus-visible,
.auth-mobile-login:focus-visible, .btn-file:focus-visible { outline: 2px solid var(--ki-cyan); outline-offset: 2px; border-radius: 6px; }

/* OTP entry (forgot-password) - one big centered code field */
.auth-form .otp-input { text-align: center; font-size: 1.5rem; font-weight: 700; letter-spacing: 10px; min-height: 58px; padding-left: 10px; }

/* Resend-code action + small footer notes (forgot-password) */
.auth-form .resend-btn { background: none; border: none; color: var(--ki-teal); font-weight: 600; text-decoration: underline; padding: 10px 8px; margin: -10px -8px; font-size: 0.85rem; cursor: pointer; border-radius: 8px; min-height: 44px; }
.auth-form .resend-btn:disabled { color: #94A3B8; text-decoration: none; cursor: not-allowed; }
.auth-form .resend-btn:focus-visible { outline: 2px solid var(--ki-cyan); outline-offset: 2px; }
.auth-footer-note { font-size: 0.8rem; color: var(--ki-muted); text-align: center; }
.auth-footer-note a { color: var(--ki-teal); font-weight: 600; }

/* ===== Responsive: stacked layout below the split breakpoint ===== */
@media (max-width: 991.98px) {
    .auth-section-pad { padding: 40px 0; }
    .auth-card { flex-direction: column; border-radius: 18px; }
    /* Compact top branding section instead of the desktop split: keep the
       logo, badge, headline and short supporting text; drop the long
       benefit list, footer CTA and decorative orbs (spec: mobile must not
       carry the huge desktop panel). */
    .auth-brand { flex: none; min-height: 0; padding: 30px 24px; }
    .auth-brand .brand-points, .auth-brand .brand-foot { display: none; }
    .auth-brand .auth-orb { display: none; }
    .auth-brand h3 { font-size: 1.75rem; margin-top: 16px; margin-bottom: 4px; }
    .auth-brand .brand-sub { font-size: 0.9rem; }
    .auth-form { padding: 30px 24px; }
    .auth-top { flex-wrap: wrap; }
}
@media (max-width: 575.98px) {
    .auth-section-pad { padding: 24px 0; }
    .auth-brand { padding: 24px 20px; }
    .auth-form { padding: 26px 20px; }
    .auth-form .auth-top { flex-direction: column; gap: 4px; }
    .auth-form .auth-top h4 { font-size: 1.4rem; }
    .auth-form .auth-mobile-login { padding: 8px 0; margin: 0; }
    .photo-drop { flex-wrap: wrap; }
    .photo-drop .photo-actions { width: 100%; }
    .photo-drop .photo-actions .btn-file { flex: 1; min-height: 44px; text-align: center; }
}
@media (max-width: 400px) {
    /* Very small screens (320px): trim horizontal padding, keep controls
       at touch-friendly sizes and never let anything scroll sideways. */
    .auth-brand { padding: 20px 16px; }
    .auth-form { padding: 22px 16px; }
    .auth-brand h3 { font-size: 1.6rem; }
    .auth-brand .brand-badge { font-size: 0.66rem; letter-spacing: 1px; padding: 5px 12px; }
    .auth-form .otp-input { letter-spacing: 6px; font-size: 1.3rem; }
}
/* Tablet headline sits between desktop (36px) and mobile (28px) */
@media (min-width: 576px) and (max-width: 991.98px) {
    .auth-brand h3 { font-size: 2rem; }
}

@media (prefers-reduced-motion: reduce) {
    .auth-wrap, .auth-brand-inner > * { animation: none; }
    .auth-brand .auth-orb { animation: none; }
    .btn-auth::after { display: none; }
    .btn-auth:hover { transform: none; }
    .auth-spinner { animation-duration: 1.4s; }
}
