/* =========================================================
   CertifyPro — splash screen + login / create account
   Loads after style.css, so it inherits the brand tokens
   (--primary, --card-bg, --border, …) and the dark theme.
   ========================================================= */
:root {
  --auth-purple-1: #241a5c;
  --auth-purple-2: #392C7D;
  --auth-lav: #b9aef0;
  --auth-ink: #1a1245;
  --auth-link: #392C7D;
  --auth-danger: #dc2626;
  --auth-danger-bg: #fef2f2;
  --auth-ok: #0f766e;
  --auth-ok-bg: #ecfdf5;
  /* Shared by the splash and the brand panel so the hand-off is seamless. */
  --auth-hero:
    repeating-radial-gradient(circle at 92% 8%, rgba(255,255,255,.055) 0 1px, transparent 1px 10px),
    linear-gradient(160deg, var(--auth-purple-1) 0%, var(--auth-purple-2) 100%);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --auth-link: #b8acff; --auth-danger: #f87171; --auth-danger-bg: #2a1a1f;
    --auth-ok: #5eead4; --auth-ok-bg: #10231f;
  }
}
:root[data-theme="dark"] {
  --auth-link: #b8acff; --auth-danger: #f87171; --auth-danger-bg: #2a1a1f;
  --auth-ok: #5eead4; --auth-ok-bg: #10231f;
}

.auth-body { padding: 0; background: var(--card-bg); overflow: hidden; }

/* ── SPLASH (visible for 2 s, then fades out) ───────────── */
.splash {
  position: fixed; inset: 0; z-index: 1000;
  display: grid; place-items: center;
  background: var(--auth-hero); color: #fff;
  animation: splash-out .5s ease 2s forwards;
}
.splash.is-done { display: none; }
.splash-inner { display: flex; flex-direction: column; align-items: center; padding: 24px; text-align: center; }

.seal { width: 112px; height: 112px; overflow: visible; margin-bottom: 22px; }
.s-edge  { fill: none; stroke: rgba(255,255,255,.32); stroke-width: 5; stroke-dasharray: 2.2 3.55; animation: fade-in .5s ease both; }
.s-ring  { fill: none; stroke: #fff; stroke-width: 1.5; stroke-dasharray: 1 2; transform: rotate(-90deg); transform-origin: 60px 60px; animation: draw .8s cubic-bezier(.4,0,.2,1) .1s both; }
.s-disc  { fill: var(--primary); transform-origin: 60px 60px; animation: stamp .32s cubic-bezier(.2,.9,.3,1.2) .7s both; }
.s-check { fill: none; stroke: #fff; stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1 2; animation: draw .35s ease .95s both; }

.splash-word { font-family: 'Nunito', sans-serif; font-weight: 800; font-size: 2.3rem; line-height: 1; animation: fade-in .5s ease 1s both; }
.splash-word span { color: var(--primary); }
.splash-tag  { margin-top: 10px; font-size: .95rem; color: rgba(255,255,255,.74); animation: fade-in .5s ease 1.2s both; }
.splash-bar  { width: min(180px, 50vw); height: 3px; margin-top: 30px; border-radius: 3px; background: rgba(255,255,255,.18); overflow: hidden; }
.splash-bar i { display: block; height: 100%; background: var(--primary); transform-origin: left; animation: fill 2s linear both; }

@keyframes draw    { from { stroke-dashoffset: 1; } }
@keyframes stamp   { from { opacity: 0; transform: scale(1.5); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fill    { from { transform: scaleX(0); } }
@keyframes splash-out { to { opacity: 0; visibility: hidden; } }

/* ── LAYOUT ─────────────────────────────────────────────── */
.auth {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  height: 100vh; height: 100dvh;
}

/* Brand panel */
.auth-brand {
  position: relative; overflow: hidden; color: #fff;
  padding: 32px clamp(28px, 4.5vw, 64px);
  display: flex; flex-direction: column; justify-content: space-between; gap: 20px;
  background: var(--auth-hero);
}
.brand-main { margin-block: auto; }
.brand-main h2 { font-family: 'Nunito', sans-serif; font-weight: 800; font-size: clamp(1.5rem, 2.3vw, 2.1rem); line-height: 1.15; max-width: 18ch; }
.brand-main p  { margin-top: 10px; max-width: 46ch; font-size: .93rem; line-height: 1.55; color: rgba(255,255,255,.78); }

/* Logo lockup */
.auth-logo { display: flex; align-items: center; gap: 10px; }
.auth-logo-icon { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, var(--primary), #ff9a5c); display: flex; align-items: center; justify-content: center; }
.auth-logo-icon i { color: #fff; font-size: 16px; }
.auth-logo-text { font-family: 'Nunito', sans-serif; font-weight: 800; font-size: 1.25rem; }
.auth-logo-text span { color: var(--primary); }
.auth-logo--card { display: none; margin-bottom: 16px; color: var(--text-dark); }

/* Certificate specimen */
.specimen { position: relative; width: min(100%, 360px); margin-top: 26px; transform: rotate(-2.5deg); }
.sp-sheet { display: flex; background: #fff; border-radius: 6px; padding: 10px; aspect-ratio: 1.414; color: var(--auth-ink); box-shadow: 0 30px 60px -20px rgba(8,4,32,.65); }
.sp-frame { flex: 1; padding: 12px 20px 14px; display: flex; flex-direction: column; align-items: center; justify-content: space-between; text-align: center; border: 1.5px solid var(--auth-purple-2); box-shadow: inset 0 0 0 4px #fff, inset 0 0 0 5px var(--auth-lav); }
.sp-title  { font-family: 'Cormorant Garamond', serif; font-weight: 600; font-size: 1.3rem; line-height: 1; }
.sp-small  { font-size: .62rem; color: #6b6690; }
.sp-name   { font-family: 'Cormorant Garamond', serif; font-style: italic; font-weight: 600; font-size: 1.9rem; line-height: 1; color: var(--auth-purple-2); }
.sp-course { font-family: 'Nunito', sans-serif; font-weight: 800; font-size: .82rem; }
.sp-row    { width: 100%; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.sp-qr     { width: 36px; height: 36px; fill: var(--auth-ink); }
.sp-seal   { width: 40px; height: 40px; }
.sp-sign   { flex: 0 1 96px; border-top: 1px solid var(--auth-lav); padding-top: 3px; font-size: .55rem; color: #6b6690; }

.sp-chip { position: absolute; right: -16px; bottom: -18px; display: flex; align-items: center; gap: 10px; padding: 10px 16px 10px 10px; border-radius: 12px; background: #fff; color: var(--auth-ink); transform: rotate(2.5deg); box-shadow: 0 14px 30px -10px rgba(8,4,32,.55); }
.sp-chip-icon { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-size: .8rem; }
.sp-chip strong { display: block; font-size: .8rem; font-weight: 700; }
.sp-chip small  { display: block; font-size: .68rem; color: #6b6690; }

/* Form panel */
.auth-panel {
  display: flex; flex-direction: column; align-items: center; overflow-y: auto;
  padding: calc(20px + env(safe-area-inset-top, 0px)) 24px calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--card-bg);
}
.auth-card { margin-block: auto; width: 100%; max-width: 380px; }   /* auto margins centre it, and stay safe if it ever overflows */
.auth-foot { flex-shrink: 0; padding-top: 10px; font-size: .72rem; color: var(--text-mid); text-align: center; }

/* Hand-off from the splash: the form panel and specimen settle in as it fades. */
.auth--enter .auth-card { animation: card-in .6s cubic-bezier(.2,.7,.2,1) 2.05s both; }
.auth--enter .specimen  { animation: spec-in .8s cubic-bezier(.2,.7,.2,1) 2.1s both; }
@keyframes card-in { from { opacity: 0; transform: translateY(14px); } }
@keyframes spec-in { from { opacity: 0; transform: translateY(26px) rotate(-6deg); } }

.auth-title { font-family: 'Nunito', sans-serif; font-weight: 800; font-size: 1.4rem; line-height: 1.2; color: var(--text-dark); }
.auth-sub   { margin: 3px 0 14px; font-size: .85rem; line-height: 1.4; color: var(--text-mid); }

/* Alerts */
.auth-alert { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; padding: 9px 12px; border-radius: 10px; font-size: .8rem; line-height: 1.45; font-weight: 600; }
.auth-alert i { margin-top: 2px; }
.auth-alert.is-error { background: var(--auth-danger-bg); color: var(--auth-danger); }
.auth-alert.is-ok    { background: var(--auth-ok-bg); color: var(--auth-ok); }

/* Fields */
.auth-field { margin-bottom: 10px; }
.auth-field > label { display: block; margin-bottom: 4px; font-size: .78rem; font-weight: 700; color: var(--text-mid); }
.auth-input { position: relative; }
.auth-input > i:first-child { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-size: .85rem; color: var(--text-light); pointer-events: none; }
.auth-input input {
  width: 100%; height: 42px; padding: 0 44px 0 40px;
  font: inherit; font-size: .9rem; color: var(--text-dark);
  background: var(--card-bg); border: 1.5px solid var(--border); border-radius: 10px;
  transition: border-color .2s, box-shadow .2s;
}
.auth-input input::placeholder { color: var(--text-light); }
.auth-input input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(255,107,53,.18); }
.auth-input.has-error input { border-color: var(--auth-danger); }
.auth-input.has-error input:focus { box-shadow: 0 0 0 3px rgba(220,38,38,.16); }

#license-key { padding-right: 14px; letter-spacing: .06em; font-variant-numeric: tabular-nums; }

.pw-toggle { position: absolute; right: 3px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border: 0; border-radius: 8px; background: none; color: var(--text-light); cursor: pointer; }
.pw-toggle:hover { color: var(--text-dark); }

.auth-hint { margin-top: 4px; font-size: .72rem; color: var(--text-mid); }
.auth-err  { margin-top: 4px; font-size: .75rem; font-weight: 600; color: var(--auth-danger); }
.auth-err[hidden] { display: none; }

/* Custom "Choose File" control — replaces the raw <input type="file"> with an
   attractive dropzone: icon badge, filename readout, and a solid CTA button. */
.auth-file { position: relative; }
.auth-file-input {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0;
  opacity: 0; cursor: pointer;
}
.auth-file-label {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 64px;
  padding: 12px 14px; border-radius: 12px; cursor: pointer;
  background: var(--card-bg, #fff); border: 1.5px dashed var(--border, #d8d3ee);
  transition: border-color .2s, background .2s, box-shadow .2s, transform .15s;
}
.auth-file:hover .auth-file-label,
.auth-file-input:focus-visible ~ .auth-file-label {
  border-color: var(--primary); background: rgba(255,107,53,.06);
  box-shadow: 0 6px 16px -6px rgba(255,107,53,.35);
}
.auth-file:active .auth-file-label { transform: translateY(1px); }
.auth-file-input:focus-visible ~ .auth-file-label { outline: 2px solid var(--primary); outline-offset: 2px; }
.auth-file.has-error .auth-file-label { border-color: var(--auth-danger); border-style: solid; }
.auth-file-icon {
  flex-shrink: 0; width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; font-size: 1rem;
  background: linear-gradient(135deg, rgba(255,107,53,.16), rgba(255,154,92,.16)); color: var(--primary);
  transition: transform .2s;
}
.auth-file:hover .auth-file-icon { transform: translateY(-2px) scale(1.05); }
.auth-file-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.auth-file-name {
  font-size: .85rem; font-weight: 700; color: var(--text-mid);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.auth-file-name.has-file { color: var(--auth-ink); }
.auth-file-sub { font-size: .68rem; color: var(--text-light); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.auth-file-cta {
  flex-shrink: 0; font-size: .78rem; font-weight: 800; color: var(--auth-ink);
  padding: 9px 16px; border-radius: 8px; background: var(--primary);
  box-shadow: 0 4px 10px -3px rgba(255,107,53,.55);
  transition: background .2s, transform .15s;
}
.auth-file:hover .auth-file-cta { background: #ff7d4d; transform: translateY(-1px); }

/* Primary button */
.auth-btn {
  width: 100%; height: 44px; margin-top: 6px; border: 0; border-radius: 10px; cursor: pointer;
  font: inherit; font-size: .95rem; font-weight: 800; color: #fff;
  background: var(--primary); transition: background .2s, transform .1s;
}
.auth-btn:hover { background: #ff7d4d; }
.auth-btn:active { transform: translateY(1px); }
.auth-btn:disabled { opacity: .75; cursor: progress; }

.auth-btn:focus-visible, .pw-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Divider between the activation form and the "get a license" callout */
.auth-divider {
  display: flex; align-items: center; gap: 10px; margin: 20px 0 14px;
  font-size: .72rem; font-weight: 600; color: var(--text-light);
}
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border, #e4e0f5); }

/* Highlighted callout — draws the eye to the external "Get Your License file" link */
.auth-license-cta {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px;
  border-radius: 12px; text-decoration: none; cursor: pointer;
  background: linear-gradient(135deg, var(--auth-purple-1), var(--auth-purple-2));
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 10px 26px -12px rgba(36,26,92,.65);
  transition: transform .18s, box-shadow .18s;
}
.auth-license-cta:hover { transform: translateY(-2px); box-shadow: 0 14px 30px -12px rgba(36,26,92,.75); }
.auth-license-cta:active { transform: translateY(0); }
.auth-license-cta:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.auth-license-cta-icon {
  flex-shrink: 0; width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; font-size: .95rem;
  background: linear-gradient(135deg, var(--primary), #ff9a5c); color: var(--auth-ink);
}
.auth-license-cta-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.auth-license-cta-text strong { font-size: .87rem; font-weight: 800; color: #fff; }
.auth-license-cta-text small { font-size: .7rem; color: var(--auth-lav); }
.auth-license-cta-arrow { flex-shrink: 0; color: var(--auth-lav); font-size: .85rem; transition: transform .18s; }
.auth-license-cta:hover .auth-license-cta-arrow { transform: translateX(4px); color: #fff; }

/* ── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-logo--card { display: flex; }
}
@media (max-height: 720px) {
  .auth-brand { padding-block: 24px; }
  .brand-main p { display: none; }
  .specimen { width: min(100%, 320px); margin-top: 20px; }
  .auth-panel { padding-top: calc(12px + env(safe-area-inset-top, 0px)); }
  .auth-logo--card { margin-bottom: 10px; }
  .auth-sub { margin-bottom: 10px; }
  .auth-field { margin-bottom: 8px; }
  .auth-input input { height: 38px; }
  .auth-btn { height: 42px; }
  .auth-file-label { min-height: 50px; padding: 8px 10px; gap: 10px; }
  .auth-file-sub { display: none; }
  .auth-file-icon { width: 32px; height: 32px; }
  .auth-file-cta { padding: 7px 12px; font-size: .72rem; }
  .auth-divider { margin: 12px 0 10px; }
  .auth-license-cta { padding: 10px 12px; }
}
@media (max-height: 600px) {
  .auth-sub { display: none; }
  .auth-title { margin-bottom: 10px; }
  .specimen { width: min(100%, 270px); }
}
@media (max-width: 420px) {
  .auth-panel { padding-inline: 18px; }
  .auth-title { font-size: 1.3rem; }
}

/* ── REDUCED MOTION: show final states, keep the 2 s hold ── */
@media (prefers-reduced-motion: reduce) {
  .seal *, .splash-word, .splash-tag, .splash-bar i,
  .auth--enter .auth-card, .auth--enter .specimen { animation: none; }
  .splash { animation-duration: .01s; }
  .auth-input input, .auth-btn { transition: none; }
}
