/*
 * Shared dark-glass theme for the global (org-less) auth + platform pages of
 * the email-login flow (ADR-37): /login, /forgot, /reset, /choose, and the
 * super-admin platform console. Ported from views/auth/login.php's inline
 * styles so every entry point matches the branded org login. These pages have
 * no org context, so the accent is always the DentistryConnect blue (no
 * per-org [data-theme] overrides here).
 */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --accent:       #1E63C2;
  --accent-light: #4185E0;
  --accent-dark:  #174E9E;
  --accent-rgb:   30,99,194;
  --brand-teal:   #35BFA3;
  --rose: #C2685A;

  --bg-deep:   #0A1628;
  --bg-mid:    #0E1D34;
  --card-bg:   rgba(255,255,255,0.035);
  --card-brd:  rgba(255,255,255,0.08);
  --text-hi:   #F2F4F8;
  --text-mid:  rgba(242,244,248,0.72);
  --text-low:  rgba(242,244,248,0.45);
  --field-bg:  rgba(255,255,255,0.04);
  --field-brd: rgba(255,255,255,0.10);
}

html, body { min-height: 100%; }

body {
  min-height: 100vh;
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  color: var(--text-hi);
  background:
    radial-gradient(1100px 700px at 78% 38%, rgba(var(--accent-rgb), 0.22) 0%, transparent 60%),
    radial-gradient(900px 600px at 18% 90%, rgba(var(--accent-rgb), 0.08) 0%, transparent 65%),
    linear-gradient(135deg, var(--bg-deep) 0%, var(--bg-mid) 100%);
  background-attachment: fixed;
  position: relative;
}

/* Subtle sparkle layer (fixed so it covers scrolling pages too) */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(1px 1px at 18% 22%, rgba(255,255,255,0.18), transparent 50%),
    radial-gradient(1px 1px at 72% 15%, rgba(255,255,255,0.14), transparent 50%),
    radial-gradient(1px 1px at 38% 78%, rgba(255,255,255,0.12), transparent 50%),
    radial-gradient(1px 1px at 86% 60%, rgba(255,255,255,0.10), transparent 50%),
    radial-gradient(1px 1px at 10% 60%, rgba(255,255,255,0.08), transparent 50%);
  opacity: 0.7;
}

/* Centering wrapper for single-card pages (login / forgot / reset / picker) */
.auth-center {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

/* ── CARD ── */
.glass-card {
  width: 100%;
  max-width: 460px;
  padding: 38px 34px 30px;
  background: var(--card-bg);
  border: 1px solid var(--card-brd);
  border-radius: 22px;
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow:
    0 30px 60px -20px rgba(0,0,0,0.55),
    0 0 0 1px rgba(255,255,255,0.02) inset;
  animation: cardIn 0.5s ease both;
}
.glass-card--wide { max-width: 520px; }

@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── BRAND ── */
.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 26px;
  animation: fadeUp 0.5s 0.05s ease both;
}
.brand-icon {
  width: 72px; height: 72px;
  display: inline-flex;
  align-items: center; justify-content: center;
  margin-bottom: 14px;
  border-radius: 20px;
  background: #F7F8FA;
  box-shadow: 0 12px 28px -10px rgba(0,0,0,0.5);
  overflow: hidden;
}
.brand-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }
.brand-icon.full-logo {
  width: 260px; height: 68px;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.brand-icon.full-logo img { object-fit: contain; }
.brand-title {
  font-family: 'Nunito Sans', system-ui, sans-serif;
  font-size: 24px;
  font-weight: 600;
  color: var(--text-hi);
  letter-spacing: -0.2px;
  line-height: 1.2;
  text-align: center;
}
.brand-subtitle {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-mid);
  letter-spacing: 0.2px;
  text-align: center;
}

/* ── MESSAGES ── */
.msg {
  font-size: 13px;
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
  text-align: center;
  animation: fadeUp 0.2s ease both;
}
.msg--error {
  background: rgba(194,104,90,0.14);
  border: 1px solid rgba(194,104,90,0.32);
  color: #f0978a;
}
.msg--ok {
  background: rgba(53,191,163,0.14);
  border: 1px solid rgba(53,191,163,0.32);
  color: #7adfc9;
}

/* ── FIELDS ── */
.form-fields { animation: fadeUp 0.5s 0.12s ease both; }
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 12px; font-weight: 500;
  letter-spacing: 0.3px;
  color: var(--text-mid);
  margin-bottom: 6px;
}
.field input,
.field select {
  width: 100%;
  padding: 13px 14px;
  background: var(--field-bg);
  border: 1px solid var(--field-brd);
  border-radius: 11px;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 14px;
  color: var(--text-hi);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.field select { appearance: none; -webkit-appearance: none; cursor: pointer; }
.field select option { color: #0A1628; }
.field input::placeholder { color: var(--text-low); }
.field input:hover,
.field select:hover { border-color: rgba(255,255,255,0.18); }
.field input:focus,
.field select:focus {
  border-color: var(--accent-light);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.18);
  background: rgba(255,255,255,0.06);
}
.field input.error { border-color: var(--rose); box-shadow: 0 0 0 3px rgba(194,104,90,0.15); }
.field .hint { margin-top: 6px; font-size: 11px; color: var(--text-low); }
.field .err  { margin-top: 6px; font-size: 12px; color: #f0978a; }

/* ── FORGOT LINK ── */
.forgot-row { text-align: right; margin-top: -6px; }
.forgot-row a {
  font-size: 12px;
  color: var(--text-mid);
  text-decoration: none;
  transition: color 0.2s;
}
.forgot-row a:hover { color: var(--text-hi); }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 13px 18px;
  border: none; border-radius: 11px;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 14px; font-weight: 600;
  color: white;
  background: linear-gradient(135deg, var(--accent-light) 0%, var(--accent) 100%);
  cursor: pointer;
  letter-spacing: 0.2px;
  text-decoration: none;
  box-shadow: 0 8px 20px -8px rgba(var(--accent-rgb), 0.6);
  transition: filter 0.2s, transform 0.1s, box-shadow 0.2s;
}
.btn:hover:not(:disabled) {
  filter: brightness(1.08);
  box-shadow: 0 12px 24px -8px rgba(var(--accent-rgb), 0.7);
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.65; cursor: not-allowed; }
.btn--block { width: 100%; margin-top: 10px; animation: fadeUp 0.5s 0.18s ease both; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  border: 1px solid var(--field-brd);
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  color: var(--text-hi);
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s;
}
.btn-ghost:hover { background: rgba(255,255,255,0.10); border-color: rgba(255,255,255,0.22); }

/* ── LINKS / FOOTER ── */
.back-link { text-align: center; margin-top: 18px; font-size: 13px; color: var(--text-low); }
.back-link a {
  color: var(--text-mid);
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  padding-bottom: 1px;
  transition: color 0.2s, border-color 0.2s;
}
.back-link a:hover { color: var(--text-hi); border-bottom-color: rgba(255,255,255,0.3); }
.footer-note { text-align: center; font-size: 11px; color: var(--text-low); margin-top: 22px; letter-spacing: 0.3px; }

/* ── ORG PICKER (choose) ── */
.choice-list { display: flex; flex-direction: column; gap: 10px; animation: fadeUp 0.5s 0.12s ease both; }
.choice {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 16px;
  background: var(--field-bg);
  border: 1px solid var(--field-brd);
  border-radius: 13px;
  cursor: pointer;
  text-align: left;
  color: var(--text-hi);
  font-family: 'DM Sans', system-ui, sans-serif;
  transition: border-color 0.2s, background 0.2s, transform 0.1s;
}
.choice:hover { border-color: var(--accent-light); background: rgba(255,255,255,0.06); }
.choice:active { transform: translateY(1px); }
.choice-name { display: block; font-size: 15px; font-weight: 600; }
.choice-role { display: block; margin-top: 2px; font-size: 12px; color: var(--text-mid); text-transform: capitalize; }
.choice-arrow { flex-shrink: 0; font-size: 18px; color: var(--text-low); }

/* ── PLATFORM CONSOLE ── */
.topbar { position: relative; z-index: 2; border-bottom: 1px solid var(--card-brd); background: rgba(255,255,255,0.02); backdrop-filter: blur(10px); }
.topbar-inner {
  max-width: 780px; margin: 0 auto;
  padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.brand-mini { display: flex; align-items: center; gap: 10px; }
.brand-mini img { height: 26px; width: auto; border-radius: 7px; background: #F7F8FA; padding: 3px; }
.brand-mini span { font-family: 'Nunito Sans', system-ui, sans-serif; font-size: 14px; font-weight: 600; color: var(--text-hi); }
/* Used on both <button> and <a> (the picker's Cancel), so it resets the
   anchor's inherited underline/colour too — otherwise the two sit side by
   side looking like different controls. */
.linkbtn { background: none; border: none; padding: 0; cursor: pointer; font-family: 'DM Sans', system-ui, sans-serif; font-size: 13px; line-height: inherit; text-decoration: none; color: var(--text-mid); transition: color 0.2s; }
.linkbtn:hover { color: var(--text-hi); text-decoration: none; }

.page { position: relative; z-index: 2; max-width: 780px; margin: 0 auto; padding: 32px 24px 48px; animation: fadeUp 0.5s ease both; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.page-title { font-family: 'Nunito Sans', system-ui, sans-serif; font-size: 22px; font-weight: 600; color: var(--text-hi); }
.page-back { display: inline-block; font-size: 13px; color: var(--text-mid); text-decoration: none; margin-bottom: 14px; transition: color 0.2s; }
.page-back:hover { color: var(--text-hi); }

.org-list { display: flex; flex-direction: column; gap: 12px; }
.org-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 18px 20px;
  background: var(--card-bg);
  border: 1px solid var(--card-brd);
  border-radius: 16px;
  backdrop-filter: blur(12px);
}
.org-name { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; color: var(--text-hi); }
.org-meta { margin-top: 3px; font-size: 12px; color: var(--text-low); }
.badge { padding: 2px 7px; border-radius: 6px; font-size: 10px; font-weight: 600; background: rgba(245,158,11,0.18); color: #f4c37a; }
.empty {
  padding: 40px 24px; text-align: center; font-size: 14px; color: var(--text-mid);
  background: var(--card-bg); border: 1px solid var(--card-brd); border-radius: 16px;
}

/* ── ANIMATIONS ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60%  { transform: translateX(-6px); }
  40%, 80%  { transform: translateX(6px); }
}
.shake { animation: shake 0.4s ease; }

@media (max-width: 480px) {
  .glass-card { padding: 30px 22px 24px; border-radius: 20px; }
  .brand { margin-bottom: 22px; }
  .brand-icon { width: 62px; height: 62px; }
  .brand-icon.full-logo { width: 210px; height: 58px; }
  .brand-title { font-size: 21px; }
  .page { padding: 24px 16px 40px; }
  .topbar-inner { padding: 12px 16px; }
}
