/* ============================================================================
 * auth.css — partner login-flow styling.
 *
 * Hand-port of the r-clinic-web-ui React/Tailwind auth design onto the Thymeleaf
 * cclogin-decorator. Self-contained: no Bootstrap / Material dependency. Drives
 * cclogin, verifyWebOtp, requirePasswordChange, requirePasswordChangeOption,
 * forgotPassword and resetPassword (all bound to cclogin-decorator).
 *
 * Tokens mirror r-clinic-web-ui/app/styles/app.css @theme (light mode only —
 * the login flow has no dark-mode toggle).
 * ========================================================================== */

:root {
  --color-rf-mint:        #C2E5D0;
  --color-rf-mint-soft:   #DBEFE2;
  --color-rf-cream-soft:  #F9F5EC;
  --color-rf-yellow:      #F2D750;
  --color-rf-yellow-deep: #E5C935;
  --color-rf-yellow-soft: #FAEFB3;
  --color-rf-mint-tile:   #DBEFE2;
  --color-rf-navy-deep:   #082236;

  --color-primary:        #1B7F54;
  --color-primary-deep:   #145E3F;
  --color-rclinic-green:  #3FB97D;

  --color-ink:        #0E3047;
  --color-ink-soft:   #2A3845;
  --color-ink-muted:  #62707F;
  --color-line:       #E2E5E8;
  --color-line-soft:  #EFF1F3;
  --color-line-strong:#C8CDD4;
  --color-warn:       #D9534B;

  --font-sans:    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-heading: "Plus Jakarta Sans", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-serif:   "Noto Serif", ui-serif, Georgia, serif;

  --shadow-card: 0 1px 3px rgba(14,48,71,0.04), 0 12px 36px -8px rgba(14,48,71,0.12);
  --shadow-sm:   0 1px 2px rgba(14,48,71,0.04);
}

/* ----------------------------------------------------------------- reset */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: #FFFFFF;
  color: var(--color-ink);
  font-family: var(--font-sans);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }

/* ----------------------------------------------------------- page shell */
.auth-shell {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 220px 1fr;
  gap: 12px;
  height: 100dvh;
  padding: 12px;
  overflow: hidden;
}
@media (min-width: 1024px) {
  .auth-shell {
    grid-template-columns: 45% 55%;
    grid-template-rows: 1fr;
    gap: 16px;
    padding: 16px;
  }
}

/* --------------------------------------------------------- photo banner */
.auth-banner {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  background: var(--color-rf-navy-deep);
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  box-shadow: 0 20px 60px rgba(0,0,0,0.35), inset 0 0 0 1px rgba(255,255,255,0.10);
}
.auth-banner__img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.auth-banner__scrim { position: absolute; pointer-events: none; }
.auth-banner__scrim--top {
  inset: 0 0 auto 0; height: 160px;
  background: linear-gradient(to bottom, rgba(8,34,54,0.70), rgba(8,34,54,0.25), transparent);
}
.auth-banner__scrim--bottom {
  inset: auto 0 0 0; height: 75%;
  background: linear-gradient(to top, rgba(8,34,54,0.95), rgba(8,34,54,0.75), transparent);
}
.auth-banner__scrim--left {
  inset: 0 auto 0 0; width: 66%;
  background: linear-gradient(to right, rgba(8,34,54,0.70), rgba(8,34,54,0.30), transparent);
}
.auth-banner__content {
  position: relative;
  display: flex; flex-direction: column;
  height: 100%;
  padding: 20px;
  color: #fff;
}
@media (min-width: 1024px) { .auth-banner__content { padding: 32px; } }

.auth-banner__top {
  display: flex; align-items: flex-start; justify-content: flex-end;
  font-size: 12px;
}
.auth-banner__initiative {
  font-family: var(--font-serif); font-style: italic;
  font-size: 13px; font-weight: 500; color: rgba(255,255,255,0.90);
}
.auth-banner__main { margin-top: auto; margin-bottom: 24px; }
@media (min-width: 768px) { .auth-banner__main { margin-bottom: 40px; } }
@media (min-width: 1024px) { .auth-banner__main { margin-bottom: 56px; } }

.auth-banner__eyebrow {
  display: inline-block; margin-bottom: 8px;
  font-size: 12px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.22em; color: #fff;
}
.auth-banner__headline {
  margin: 0; font-family: var(--font-heading);
  font-size: 18px; font-weight: 600; line-height: 1.15; color: #fff;
}
.auth-banner__headline em {
  display: inline-block; font-style: normal; font-weight: 600;
  background: var(--color-rclinic-green); color: #fff;
  padding: 2px 8px; border-radius: 8px;
}
.auth-banner__quote {
  display: none; margin-top: 12px;
  font-size: 15px; font-style: italic; font-weight: 500; color: #fff;
}
.auth-banner__stats {
  display: none; margin-top: 18px;
  grid-template-columns: repeat(2, 1fr); gap: 12px; max-width: 460px;
}
@media (min-width: 1024px) {
  .auth-banner__headline { font-size: 24px; margin-bottom: 16px; }
  .auth-banner__quote { display: block; font-size: 15px; }
  .auth-banner__stats { display: grid; }
}
.auth-stat {
  border-radius: 12px; padding: 14px 16px;
  box-shadow: var(--shadow-sm); transition: box-shadow .2s, filter .2s;
}
.auth-stat:hover { box-shadow: 0 4px 16px rgba(14,48,71,0.08); filter: brightness(1.05); }
.auth-stat:nth-child(odd)  { background: var(--color-rf-yellow-soft); }
.auth-stat:nth-child(even) { background: var(--color-rf-mint-soft); }
.auth-stat__num {
  font-family: var(--font-serif); font-size: 32px; font-weight: 600;
  line-height: 1; color: var(--color-ink);
}
.auth-stat__num span { font-size: 19px; color: rgba(14,48,71,0.70); }
.auth-stat__label { margin-top: 8px; font-size: 12px; line-height: 1.35; color: var(--color-ink-soft); }

/* ----------------------------------------------------------- right pane */
.auth-pane {
  position: relative;
  display: flex; flex-direction: column;
  height: 100%; min-height: 0;
  overflow-y: auto;
  border-radius: 24px;
  background: var(--color-rf-mint);
  box-shadow: var(--shadow-card);
}
.auth-pane__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 24px 24px 0;
}
@media (min-width: 1024px) { .auth-pane__header { padding: 32px 40px 0; } }
.auth-brand { display: flex; align-items: center; color: var(--color-ink); text-decoration: none; }
.auth-brand__logo { height: 56px; width: auto; }
@media (min-width: 1024px) { .auth-brand__logo { height: 64px; } }

.auth-pane__body {
  display: flex; flex: 1; align-items: center; justify-content: center;
  padding: 24px;
}
@media (min-width: 1024px) { .auth-pane__body { padding: 24px 40px; } }
.auth-card {
  width: 100%; max-width: 440px;
  border-radius: 24px; background: #fff;
  padding: 32px; box-shadow: var(--shadow-card);
}
@media (min-width: 1024px) { .auth-card { padding: 40px; } }

.auth-pane__footer {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 4px 12px;
  border-top: 1px solid var(--color-line-soft);
  background: rgba(255,255,255,0.60);
  padding: 8px 24px; font-size: 11px; color: var(--color-ink-muted);
}
@media (min-width: 1024px) { .auth-pane__footer { padding: 8px 40px; } }
.auth-pane__footer .powered { display: inline-flex; align-items: center; gap: 6px; }
.auth-pane__footer .powered img { height: 24px; width: auto; }
.auth-pane__footer a { color: var(--color-ink-muted); text-decoration: none; }
.auth-pane__footer a:hover { color: var(--color-ink-soft); }
.auth-pane__footer .links { display: flex; gap: 12px; }

/* ------------------------------------------------------- card typography */
.auth-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.18em; color: var(--color-primary);
}
.auth-eyebrow .dot {
  height: 6px; width: 6px; border-radius: 999px;
  background: var(--color-rf-yellow);
  box-shadow: 0 0 10px rgba(242,215,80,0.7);
  animation: pulseDot 2s ease-in-out infinite;
}
.auth-title {
  margin: 0; font-family: var(--font-heading);
  font-size: 18px; font-weight: 600; line-height: 1.2; color: var(--color-ink);
}
.auth-eyebrow + .auth-title { margin-top: 12px; }
.auth-title em { font-style: italic; font-weight: 600; color: var(--color-primary); }
.auth-subtitle { margin: 8px 0 0; font-size: 14px; color: var(--color-ink-soft); }
.auth-subtitle strong { color: var(--color-ink); }

/* --------------------------------------------------------------- alerts */
.auth-alert {
  display: flex; align-items: flex-start; gap: 8px;
  margin-top: 16px; padding: 10px 14px;
  border-radius: 12px; font-size: 13px; line-height: 1.35;
}
.auth-alert--warn    { border: 1px solid rgba(217,83,75,0.25);  background: rgba(217,83,75,0.08);  color: var(--color-warn); }
.auth-alert--success { border: 1px solid rgba(27,127,84,0.25);  background: rgba(27,127,84,0.08);  color: var(--color-primary-deep); }
.auth-alert__icon { flex-shrink: 0; margin-top: 1px; }
.auth-alert__close {
  margin-left: auto; cursor: pointer; border: 0; background: transparent;
  font-size: 18px; line-height: 1; color: inherit; opacity: .6; padding: 0 2px;
}
.auth-alert__close:hover { opacity: 1; }

/* ---------------------------------------------------------------- forms */
.auth-form { margin-top: 24px; display: flex; flex-direction: column; gap: 16px; }
.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-label { font-size: 12px; font-weight: 500; color: var(--color-ink-soft); }
.auth-label .req { margin-left: 2px; color: var(--color-warn); }
.auth-input-wrap { position: relative; }
.auth-input-wrap .icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--color-ink-muted); pointer-events: none; display: inline-flex;
}
.auth-input {
  width: 100%; border: 1px solid var(--color-line); border-radius: 12px;
  background: #fff; color: var(--color-ink);
  padding: 12px 16px; font-size: 14px; font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.auth-input::placeholder { color: var(--color-ink-muted); }
.auth-input:focus {
  outline: none; border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(27,127,84,0.20);
}
.auth-input-wrap.has-icon .auth-input { padding-left: 40px; }
.auth-input-wrap.has-toggle .auth-input { padding-right: 64px; }
.auth-toggle {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; cursor: pointer;
  border-radius: 6px; padding: 4px 8px;
  font-size: 12px; font-weight: 500; color: var(--color-ink-soft);
}
.auth-toggle:hover { color: var(--color-ink); }

.auth-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.auth-link {
  font-size: 12px; font-weight: 500; color: var(--color-primary); text-decoration: none;
}
.auth-link:hover { color: var(--color-primary-deep); }
.auth-foot-note { margin-top: 24px; text-align: center; font-size: 12px; color: var(--color-ink-muted); }
.auth-foot-note .auth-link { font-size: 12px; }

/* checkbox */
.auth-check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; font-weight: 500; color: var(--color-ink-soft); user-select: none; }
.auth-check input { position: absolute; opacity: 0; width: 0; height: 0; }
.auth-check__box {
  display: inline-flex; align-items: center; justify-content: center;
  height: 18px; width: 18px; flex-shrink: 0;
  border: 1px solid var(--color-line); border-radius: 6px; background: #fff;
  box-shadow: var(--shadow-sm); color: #fff; transition: all .15s;
}
.auth-check__box svg { opacity: 0; transition: opacity .15s; }
.auth-check input:checked + .auth-check__box { border-color: var(--color-primary); background: var(--color-primary); }
.auth-check input:checked + .auth-check__box svg { opacity: 1; }

/* radios (OTP resend channel) */
.auth-channels { display: inline-flex; gap: 16px; align-items: center; font-size: 13px; color: var(--color-ink-soft); }
.auth-channels label { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }

/* ------------------------------------------------------------- buttons */
.auth-btn {
  display: inline-flex; width: 100%; align-items: center; justify-content: center;
  gap: 10px; height: 48px; padding: 0 24px;
  border: 0; border-radius: 12px; cursor: pointer;
  font-family: inherit; font-size: 15px; font-weight: 600;
  background: var(--color-primary); color: #fff;
  box-shadow: var(--shadow-card); text-decoration: none;
  transition: background-color .15s, opacity .15s;
}
.auth-btn:hover { background: var(--color-primary-deep); }
.auth-btn:disabled { cursor: not-allowed; opacity: .6; }
.auth-btn--secondary {
  background: #fff; color: var(--color-ink);
  border: 1px solid var(--color-line); box-shadow: var(--shadow-sm);
}
.auth-btn--secondary:hover { background: var(--color-rf-cream-soft); }
.auth-btn--link {
  width: auto; height: auto; padding: 0; background: transparent; box-shadow: none;
  color: var(--color-primary); font-weight: 500; font-size: 13px;
}
.auth-btn--link:hover { background: transparent; color: var(--color-primary-deep); }

/* ----------------------------------------------------------- OTP boxes */
.auth-otp { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
/* Class-selector display:flex would otherwise beat the UA [hidden] rule, so the
 * boxes would show before JS reveals them — re-assert the hidden state here. */
.auth-otp[hidden] { display: none; }
.auth-otp input {
  height: 48px; width: 48px; flex: 1;
  border: 1px solid var(--color-line); border-radius: 12px; background: #fff;
  text-align: center; font-size: 18px; font-weight: 600; color: var(--color-ink-muted);
  font-family: inherit; transition: border-color .15s, box-shadow .15s, color .15s;
}
.auth-otp input:focus { outline: none; box-shadow: 0 0 0 3px rgba(27,127,84,0.20); }
.auth-otp input.filled { border-color: var(--color-primary); color: var(--color-ink); }

.auth-countdown { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--color-ink-muted); }

.auth-hint { font-size: 12px; color: var(--color-ink-muted); }

/* Cloudflare Turnstile — center it within the card */
.cf-turnstile { display: flex; justify-content: center; margin: 4px 0; }

@keyframes pulseDot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* respect reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .auth-eyebrow .dot { animation: none; }
}
