/* ==========================================================================
   E-Academy — the application's half of the sign-in stylesheet
   --------------------------------------------------------------------------
   Loaded by app/Views/layouts/auth.php, immediately after auth.css and
   immediately before the <style> block that auth_theme_css() fills in.

   auth.css is the template, kept as it shipped so a future template update can
   be dropped in without a merge. Everything this application needs on top of
   it lives here:

     1. Brand colours the template hard-coded, restated so they follow the
        academy's palette
     2. The honeypot
     3. The busy state loader.js puts on a submitting button
     4. Icons the academy needs that a meeting product did not
     5. Controls the template has no equivalent for
     6. The inline brand illustration

   No rule here invents a new look. Each one either re-expresses a template
   value in terms of a token, or styles a control the template never had.
   ========================================================================== */


/* --------------------------------------------------------------------------
   1. Brand colours the template hard-coded
   --------------------------------------------------------------------------
   auth.css writes the shipped violet — rgba(100, 6, 245, …) and its shadow
   colour rgba(48, 16, 105, …) — directly into six rules, so those six survived
   every token override and stayed violet on a teal academy.

   They are restated here against --auth-brand-rgb, which auth_theme_css()
   emits as a bare `r, g, b` triplet from the academy's own sign-in colour. The
   fallback in each var() is the template's violet, so a page that somehow
   renders without the generated block still looks like the template rather
   than losing the declaration outright.
   -------------------------------------------------------------------------- */

/* The form panel can scroll on short screens. Match that scrollbar (and any
   future auth overflow area) to the academy's sign-in palette. */
html {
  scroll-behavior: smooth;
  scrollbar-color: var(--auth-brand-600) transparent;
  scrollbar-width: thin;
}

.auth-body,
.auth-body * {
  scrollbar-color: var(--auth-brand-600) transparent;
  scrollbar-width: thin;
}

.auth-body::-webkit-scrollbar,
.auth-body *::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

.auth-body::-webkit-scrollbar-track,
.auth-body *::-webkit-scrollbar-track { background: transparent; }

.auth-body::-webkit-scrollbar-thumb,
.auth-body *::-webkit-scrollbar-thumb {
  min-height: 32px;
  background: var(--auth-brand-600);
  background-clip: padding-box;
  border: 1px solid transparent;
  border-radius: 999px;
}

.auth-body::-webkit-scrollbar-thumb:hover,
.auth-body *::-webkit-scrollbar-thumb:hover {
  background: var(--auth-brand-500);
  background-clip: padding-box;
}

.auth-body::-webkit-scrollbar-corner,
.auth-body *::-webkit-scrollbar-corner { background: transparent; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

.auth-brand::before {
  background: radial-gradient(circle, rgba(var(--auth-brand-rgb, 100, 6, 245), .16), transparent 68%);
}

.auth-brand__stage::before {
  background: radial-gradient(58% 52% at 56% 48%, rgba(var(--auth-brand-rgb, 100, 6, 245), .12), transparent 72%);
}

.auth-btn--primary:hover {
  box-shadow: 0 16px 30px -12px rgba(var(--auth-brand-rgb, 100, 6, 245), .6);
}

.auth-highlight__icon {
  box-shadow:
    0 6px 16px -8px rgba(var(--auth-brand-rgb, 48, 16, 105), .34),
    0 1px 2px rgba(var(--auth-brand-rgb, 48, 16, 105), .06);
}

.auth-feature__icon {
  box-shadow:
    0 6px 16px -8px rgba(var(--auth-brand-rgb, 48, 16, 105), .3),
    0 1px 2px rgba(var(--auth-brand-rgb, 48, 16, 105), .05);
}

.auth-brand__art {
  filter: drop-shadow(0 26px 40px rgba(var(--auth-brand-rgb, 48, 16, 105), .18));
}


/* --------------------------------------------------------------------------
   2. Honeypot
   --------------------------------------------------------------------------
   HoneypotFilter injects its decoy field just before </form> on the way out,
   so it lands inside .auth-form — a flex column with a gap, where a visible
   stray label would be very visible indeed.

   CodeIgniter also emits a nonce-bearing `#ea-hp { display:none }` because the
   CSP forbids the inline style attribute it would otherwise use. This rule is
   the belt to that braces: if the nonce block is ever dropped, the decoy must
   still not be a field a real person can see and fill in, because filling it
   is what gets the request rejected.
   -------------------------------------------------------------------------- */
.ea-honeypot {
  display: none !important;
}


/* --------------------------------------------------------------------------
   3. The busy state
   --------------------------------------------------------------------------
   loader.js locks every submit button one tick after a form is submitted — it
   sets `disabled` and `aria-busy="true"` so a double click cannot fire a
   second POST carrying a CSRF token the first one just rotated away.

   auth.css already draws a spinner, but only for the `is-loading` class its own
   demo script used. Pointing the same rules at the attribute the application
   actually sets means the button spins for real submissions, and no second
   script is needed to make it happen.
   -------------------------------------------------------------------------- */
.auth-btn[aria-busy="true"] {
  cursor: wait;
  opacity: .72;
  transform: none;
  box-shadow: none;
  color: transparent;
}

.auth-btn[aria-busy="true"]::after {
  content: "";
  position: absolute;
  width: 17px;
  height: 17px;
  border: 2px solid rgba(255, 255, 255, .45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: auth-spin .7s linear infinite;
}

/* A ghost/secondary button spins in its own ink, not white. */
.auth-btn--ghost[aria-busy="true"]::after {
  border-color: rgba(var(--auth-brand-rgb, 100, 6, 245), .3);
  border-top-color: var(--auth-brand-500);
}

.auth-social[aria-busy="true"] {
  cursor: wait;
  opacity: .72;
}


/* --------------------------------------------------------------------------
   4. Icons an academy needs
   --------------------------------------------------------------------------
   The template's set is a meeting product's: video, screen share, chat,
   calendar. These are drawn in the same hand — 24px box, 1.7 stroke, round
   caps — so they sit beside the originals without looking bolted on.
   -------------------------------------------------------------------------- */
:root {
  --auth-icon-graduation: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.6 9.2 12 4.8l9.4 4.4L12 13.6Z'/%3E%3Cpath d='M6.8 11.2v4.4c0 1.6 2.3 2.9 5.2 2.9s5.2-1.3 5.2-2.9v-4.4'/%3E%3Cpath d='M21.4 9.6v5.2'/%3E%3C/svg%3E");
  --auth-icon-award: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='9' r='5.2'/%3E%3Cpath d='m8.4 13.5-1.3 7 4.9-2.6 4.9 2.6-1.3-7'/%3E%3C/svg%3E");
  --auth-icon-clock: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='8.6'/%3E%3Cpath d='M12 7v5.2l3.3 2'/%3E%3C/svg%3E");
  --auth-icon-wallet: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5.8' width='18' height='12.6' rx='3.2'/%3E%3Cpath d='M3 10.2h18'/%3E%3Cpath d='M16.8 14.4h.01'/%3E%3C/svg%3E");
  --auth-icon-phone: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='6.6' y='2.6' width='10.8' height='18.8' rx='3'/%3E%3Cpath d='M10.7 5.4h2.6'/%3E%3Cpath d='M11 18.4h2'/%3E%3C/svg%3E");
  --auth-icon-alert: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3.6 1.9 20.4h20.2Z'/%3E%3Cpath d='M12 9.6v4.6'/%3E%3Cpath d='M12 17.4h.01'/%3E%3C/svg%3E");
  --auth-icon-book: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 5.2A2 2 0 0 1 6 3.2h5.2v17.6H6a2 2 0 0 1-2-2Z'/%3E%3Cpath d='M20 5.2a2 2 0 0 0-2-2h-5.2v17.6H18a2 2 0 0 0 2-2Z'/%3E%3C/svg%3E");
}

.auth-icon--graduation { --auth-glyph: var(--auth-icon-graduation); }
.auth-icon--award      { --auth-glyph: var(--auth-icon-award); }
.auth-icon--clock      { --auth-glyph: var(--auth-icon-clock); }
.auth-icon--wallet     { --auth-glyph: var(--auth-icon-wallet); }
.auth-icon--phone      { --auth-glyph: var(--auth-icon-phone); }
.auth-icon--book       { --auth-glyph: var(--auth-icon-book); }
.auth-icon--alert      { --auth-glyph: var(--auth-icon-alert); }


/* --------------------------------------------------------------------------
   5. Controls the template has no equivalent for
   -------------------------------------------------------------------------- */

/* The alternative sign-in methods are a real POST form and a real link, not
   the template's two demo buttons, so the link needs the button's own reset. */
a.auth-social {
  text-decoration: none;
}

/* Both sit inside a form, which would otherwise add the auth-form column gap
   between the form element and the button inside it. */
.auth-oauth-form {
  display: contents;
}

/* Below 900px of viewport height auth.css puts the alternatives side by side,
   which is right for two and leaves a hole for one. An install with Google
   configured but code sign-in switched off (or the reverse) has exactly one. */
.auth-socials--single {
  grid-template-columns: 1fr;
}

/* ==========================================================================
   THE COUNTRY CODE PICKER (OTP screen)

   A native <select> sized to its widest option is as wide as "United Arab
   Emirates" whatever is chosen, which on this screen left the actual phone
   number about a third of the row. Two layers fix that, and the first one
   works on its own:

     1. The select is capped and ellipsised, so with scripting off it is a
        normal, compact select that happens to truncate its longest names.
     2. auth.js replaces it with a combobox whose CLOSED state is only the
        ISO code and the dial code — "IN +91", ~76px — while the open list
        shows full country names and can be typed into. A native select
        cannot do this: its closed text is its option's text.

   The select stays in the DOM either way. It is the field that submits.
   ========================================================================== */
.auth-dial {
  position: relative;
  flex: none;
  height: 100%;
  display: flex;
  align-items: center;
  border-right: 1px solid var(--auth-border-strong);
}

.auth-input-group:focus-within .auth-dial { border-right-color: var(--auth-brand-200); }

.auth-select {
  flex: none;
  width: 100%;
  max-width: 148px;
  height: 100%;
  padding: 0 6px 0 0;
  border: 0;
  border-radius: 0;
  background-color: transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--auth-text-soft);
  text-overflow: ellipsis;
  outline: none;
  cursor: pointer;
}

.auth-dial + .auth-input,
.auth-select + .auth-input {
  padding-left: 12px;
}

/* ---- Enhanced: the native control becomes the hidden value carrier ------ */
.auth-dial.is-enhanced .auth-select {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  pointer-events: none;
}

.auth-dial__trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 100%;
  padding: 0 8px 0 2px;
  border: 0;
  border-radius: 0;
  background-color: transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--auth-text-soft);
  white-space: nowrap;
  cursor: pointer;
  transition: color .18s var(--auth-ease);
}

.auth-dial__trigger:hover { color: var(--auth-text); }
.auth-dial__trigger:focus-visible {
  outline: 2px solid var(--auth-brand-500);
  outline-offset: -2px;
}

.auth-dial__iso {
  padding: 2px 5px;
  border-radius: 5px;
  background-color: var(--auth-surface-sunk);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--auth-text-muted);
}

.auth-dial__code { font-variant-numeric: tabular-nums; }

.auth-dial__caret {
  font-size: 9px;
  line-height: 1;
  color: var(--auth-text-faint);
  transition: transform .18s var(--auth-ease);
}

.auth-dial.is-open .auth-dial__caret { transform: rotate(180deg); }

/* ---- The popup --------------------------------------------------------- */
.auth-dial__menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  left: 0;
  width: 268px;
  max-width: min(268px, calc(100vw - 48px));
  padding: 8px;
  border: 1px solid var(--auth-border-strong);
  border-radius: var(--auth-radius-md);
  background-color: var(--auth-surface);
  box-shadow: 0 18px 44px rgba(15, 18, 34, .18);
}

.auth-dial__menu[hidden] { display: none; }

.auth-dial__search {
  width: 100%;
  height: 34px;
  margin-bottom: 6px;
  padding: 0 10px;
  border: 1px solid var(--auth-border);
  border-radius: 8px;
  background-color: var(--auth-surface-sunk);
  font-family: inherit;
  font-size: 12.5px;
  color: var(--auth-text);
  outline: none;
}

.auth-dial__search:focus { border-color: var(--auth-brand-500); }
.auth-dial__search::placeholder { color: var(--auth-text-faint); }

/* auth.css covers .auth-input; this box is built in auth.js and carries no
 * such class, so it needs its own repaint over the browser's autofill slab.
 * It is an unnamed filter field with autocomplete="off", which Chrome does
 * honour for a box like this — but "does not usually happen" is not the same
 * as "cannot", and the failure is a white slab in the middle of a dark menu. */
.auth-dial__search:-webkit-autofill,
.auth-dial__search:-webkit-autofill:hover,
.auth-dial__search:-webkit-autofill:focus {
  -webkit-box-shadow: inset 0 0 0 1000px var(--auth-surface-sunk);
  box-shadow: inset 0 0 0 1000px var(--auth-surface-sunk);
  -webkit-text-fill-color: var(--auth-text);
  caret-color: var(--auth-text);
}
.auth-dial__search:autofill { filter: none; }

.auth-dial__list {
  max-height: 216px;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
  overscroll-behavior: contain;
}

.auth-dial__option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 8px;
  border: 0;
  border-radius: 7px;
  background-color: transparent;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--auth-text);
  text-align: left;
  cursor: pointer;
}

.auth-dial__option:hover,
.auth-dial__option.is-active { background-color: var(--auth-surface-sunk); }

.auth-dial__option[aria-selected="true"] {
  color: var(--auth-brand-500);
  font-weight: 600;
}

.auth-dial__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-dial__dial {
  flex: none;
  color: var(--auth-text-muted);
  font-variant-numeric: tabular-nums;
}

.auth-dial__empty {
  padding: 10px 8px;
  color: var(--auth-text-muted);
  font-size: 12.5px;
}

/* The one-time code: wide tracking so six digits are read as six digits and a
   transposed pair is obvious before it is submitted. */
.auth-input--code {
  padding-right: 14px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: .38em;
  text-align: center;
}

.auth-input--code::placeholder {
  letter-spacing: .38em;
  font-weight: 500;
}

/* A hint that belongs to the form as a whole rather than to one field. */
.auth-hint--center {
  text-align: center;
}

/* "(optional)" beside a label, in the label's own row. Saying which fields may
   be left blank is shorter than marking every other one required, and on a
   registration form it is the difference between someone finishing and
   someone hunting for a phone number they do not want to give. */
.auth-field__optional {
  font-weight: 500;
  color: var(--auth-text-faint);
}

/* An academy that uploaded its own logo has exactly one file for it, so it is
   shown on both grounds — see the TODO in app/Views/auth/_logo.php. */
.auth-logo__img--single {
  display: block;
}

/* The wordmark fallback, for an installation with no logo file at all. */
.auth-logo__mark {
  display: grid;
  place-items: center;
  width: clamp(38px, 5vh, 46px);
  aspect-ratio: 1;
  flex: none;
  border-radius: clamp(11px, 1.6vh, 14px);
  font-size: clamp(19px, 2.6vh, 24px);
  color: #fff;
  background-image: var(--auth-gradient-btn);
  box-shadow: var(--auth-shadow-brand);
}


/* --------------------------------------------------------------------------
   6. The brand illustration
   --------------------------------------------------------------------------
   The login layout renders the local PNG through `.auth-brand__art`.
   Its shared sizing is defined in auth.css; this rule only makes the replaced
   element explicit and prevents an inline baseline gap.
   -------------------------------------------------------------------------- */
img.auth-brand__art {
  display: block;
}


/* =============================================================
   THE LANGUAGE SWITCHER.

   The template drew a `.auth-locale` button; this is a real <form> with a
   <select> in it, because it changes state that persists across requests and a
   button that only looks like one would be the dead control the whole panel is
   careful not to have.

   It renders ONLY when Config\App::$supportedLocales lists more than one
   entry, so on a stock install none of this is on the page at all.

   `.auth-locale__go` is hidden the moment JavaScript is available (auth.js
   submits on change and adds `has-js`), and visible when it is not — so the
   control works either way and never shows a button that does nothing.
   ============================================================= */
.auth-locale{display:inline-flex;align-items:center;gap:8px;padding:6px 10px;border:1px solid var(--auth-border);border-radius:var(--auth-radius-pill);background:var(--auth-surface)}
.auth-locale__label{display:inline-flex;align-items:center;gap:6px;color:var(--auth-text-muted);font-size:13px;cursor:pointer}
.auth-locale__label .auth-icon{width:15px;height:15px}
.auth-locale__text{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
.auth-locale__select{border:0;background:transparent;color:var(--auth-text);font:inherit;font-size:13px;font-weight:600;cursor:pointer}
.auth-locale__select:focus-visible{outline:2px solid var(--auth-accent);outline-offset:3px;border-radius:5px}
.auth-locale__go{padding:4px 10px;border:0;border-radius:var(--auth-radius-pill);background:var(--auth-gradient-btn);color:#fff;font:inherit;font-size:12px;font-weight:700;cursor:pointer}
.auth-locale.has-js .auth-locale__go{display:none}

/* A figure in the trust row: the academy's own number rather than another
   company's logo. Same chip as .auth-trust, with the number set larger. */
.auth-trust--figure{gap:6px}
.auth-trust--figure b{font-size:15px;color:var(--auth-text)}

/* THE LOADER'S PALETTE.

   loader.css hard-codes the three ring colours and the label to the gold
   preset, because it was written for the dashboard, where app.css supplies
   --theme-*. On the sign-in screens that variable family does not exist, so
   the rings stayed gold no matter which palette the academy chose for
   "Login and registration".

   These four are the auth sheet's own brand tokens, and auth_theme_css()
   already fills them per scheme from that palette — so pointing the loader at
   them is all it takes. The dashboard is untouched: it loads app.css, not
   this file. */
.ea-loader{--ring-a:var(--auth-brand-500);--ring-b:var(--auth-brand-400);--ring-c:var(--auth-accent)}
.ea-loader__text{color:var(--auth-brand-500)}
