/* Qura — Auth pages (login + signup) upgraded UI.
   Split-panel layout: brand gradient left, form right.
   Collapses to single column on mobile. */

/* ---------- Layout ---------- */
.auth-page {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
  background: var(--bg);
}

/* ---------- Brand panel (left): video hero ---------- */
.auth-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--space-8);
  background: linear-gradient(135deg, #0e7c86 0%, #0a5f67 50%, #064248 100%);
  overflow: hidden;
  color: #fff;
  min-height: 100vh;
}

/* Fills the panel behind everything else; the gradient above stays as the fallback
   background if the video is slow to load or fails outright. */
.auth-brand-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

/* Colour wash + subtle pattern over the video so the white heading/body text stays
   readable regardless of what's playing underneath. */
.auth-brand::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(135deg, rgba(14,124,134,0.82) 0%, rgba(10,95,103,0.82) 50%, rgba(6,66,72,0.86) 100%),
    url("data:image/svg+xml,%3Csvg width='600' height='600' viewBox='0 0 600 600' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='rgba(255,255,255,0.06)' stroke-width='2'%3E%3Ccircle cx='100' cy='100' r='60'/%3E%3Ccircle cx='500' cy='200' r='80'/%3E%3Ccircle cx='300' cy='400' r='100'/%3E%3Ccircle cx='150' cy='480' r='50'/%3E%3Ccircle cx='480' cy='480' r='70'/%3E%3Cpath d='M50 300 L200 300 M300 50 L300 200'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover;
  pointer-events: none;
}

.auth-brand-content {
  position: relative;
  z-index: 2;
  max-width: 420px;
}

/* ---------- Floating icons ----------
   Purely decorative "+" marks drifting across the hero, layered between the video wash
   (z-index 1) and the copy (z-index 2) so they read as background texture, not clutter. */
.auth-icons {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
}

.auth-icon {
  position: absolute;
  color: #7ec8ff;
  opacity: 0;
  animation: auth-icon-drift linear infinite;
}

.auth-icon svg { display: block; width: 100%; height: 100%; }

@keyframes auth-icon-drift {
  0%   { opacity: 0; transform: translate(0, 0) rotate(0deg); }
  10%  { opacity: 0.5; }
  90%  { opacity: 0.5; }
  100% { opacity: 0; transform: translate(140px, -90px) rotate(45deg); }
}

/* ---------- Video controls (mute + play/pause) ---------- */
.auth-video-controls {
  position: absolute;
  right: var(--space-5);
  bottom: var(--space-5);
  z-index: 3;
  display: flex;
  gap: var(--space-2);
}

.auth-video-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 50%;
  background: rgba(6,40,44,0.45);
  backdrop-filter: blur(4px);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s ease;
}

.auth-video-btn:hover { background: rgba(6,40,44,0.7); }
.auth-video-btn svg { width: 18px; height: 18px; }

.auth-brand-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.auth-brand-logo .dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 5px rgba(255,255,255,0.2);
}

.auth-brand-logo img {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: rgba(255,255,255,0.92);
  padding: 3px;
  flex-shrink: 0;
}

.auth-brand-logo small {
  font-weight: 500;
  font-size: 14px;
  opacity: 0.8;
}

.auth-brand h2 {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 var(--space-4);
}

.auth-brand p {
  font-size: 16px;
  line-height: 1.6;
  opacity: 0.85;
  margin: 0 0 var(--space-6);
}

.auth-brand-features {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.auth-brand-feature {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: 15px;
  opacity: 0.9;
}

.auth-brand-feature svg {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  opacity: 0.7;
}

/* ---------- Form panel (right) ---------- */
.auth-form-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--space-8);
  background: var(--surface);
}

.auth-form-wrap {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  animation: auth-fade-in 0.5s ease-out;
}

@keyframes auth-fade-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-mobile-brand {
  display: none;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
  font-size: 22px;
  font-weight: 800;
  color: var(--qura-primary);
}

.auth-mobile-brand .dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--qura-primary);
  box-shadow: 0 0 0 4px var(--qura-primary-050);
}

.auth-mobile-brand img {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  flex-shrink: 0;
}

.auth-form-wrap h1 {
  font-size: 26px;
  font-weight: 700;
  margin: 0 0 var(--space-2);
  color: var(--text);
}

.auth-form-wrap .sub {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0 0 var(--space-6);
}

/* ---------- Tabs (Email | Mobile) ---------- */
.auth-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: var(--space-5);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 4px;
}

.auth-tab {
  flex: 1;
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.auth-tab:hover {
  color: var(--text);
}

.auth-tab.is-active {
  background: var(--surface);
  color: var(--qura-primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* ---------- Input fields with icons ---------- */
.auth-field {
  position: relative;
  margin-bottom: var(--space-4);
}

.auth-field label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: var(--space-1);
  font-weight: 500;
}

.auth-field input,
.auth-field select {
  width: 100%;
  font: inherit;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 12px 12px 42px;
  background: var(--surface);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-field input:focus,
.auth-field select:focus {
  outline: none;
  border-color: var(--qura-primary);
  box-shadow: 0 0 0 3px var(--qura-primary-050);
}

.auth-field.error input {
  border-color: var(--danger);
}

.auth-field.error label {
  color: var(--danger);
}

.auth-field-icon {
  position: absolute;
  left: 14px;
  top: 38px;
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

.auth-field select {
  padding-left: 12px;
}

/* Password show/hide toggle */
.auth-pwd-toggle {
  position: absolute;
  right: 10px;
  top: 36px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-pwd-toggle:hover {
  color: var(--text);
  background: var(--surface-2);
}

/* ---------- Password strength bar ---------- */
.pwd-strength {
  display: flex;
  gap: 4px;
  margin: 6px 0 0;
}

.pwd-strength-bar {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  transition: background 0.3s ease;
}

.pwd-strength-bar.active.weak { background: var(--danger); }
.pwd-strength-bar.active.fair { background: var(--called); }
.pwd-strength-bar.active.good { background: var(--qura-primary); }
.pwd-strength-bar.active.strong { background: var(--done); }

.pwd-strength-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  min-height: 16px;
}

/* ---------- Row layouts ---------- */
.auth-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

/* ---------- Collapsible optional section ---------- */
.auth-collapse-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
  padding: var(--space-3) 0;
  border-top: 1px solid var(--border);
  margin-top: var(--space-4);
  user-select: none;
  transition: color 0.2s;
}

.auth-collapse-toggle:hover {
  color: var(--text);
}

.auth-collapse-toggle svg {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
}

.auth-collapse-toggle.open svg {
  transform: rotate(90deg);
}

.auth-collapse-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.auth-collapse-body.open {
  max-height: 500px;
}

/* ---------- Checkbox ---------- */
.auth-check {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-4) 0;
  font-size: 14px;
  color: var(--text-muted);
}

.auth-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--qura-primary);
  cursor: pointer;
}

/* ---------- Submit button ---------- */
.auth-submit {
  width: 100%;
  padding: 13px;
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--qura-primary);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.05s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 48px;
}

.auth-submit:hover {
  background: var(--qura-primary-600);
}

.auth-submit:active {
  transform: scale(0.98);
}

.auth-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-submit .spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: auth-spin 0.6s linear infinite;
}

@keyframes auth-spin {
  to { transform: rotate(360deg); }
}

/* ---------- Error message ---------- */
.auth-error {
  font-size: 14px;
  color: var(--danger);
  background: rgba(192, 69, 59, 0.08);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin: var(--space-3) 0;
  display: none;
}

.auth-error.show {
  display: block;
  animation: auth-shake 0.3s ease;
}

@keyframes auth-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* ---------- Footer links ---------- */
.auth-footer-link {
  text-align: center;
  margin-top: var(--space-6);
  font-size: 14px;
  color: var(--text-muted);
}

.auth-footer-link a {
  color: var(--qura-primary);
  font-weight: 600;
  text-decoration: none;
}

.auth-footer-link a:hover {
  text-decoration: underline;
}

.auth-forgot {
  display: block;
  text-align: right;
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  margin-top: -8px;
  margin-bottom: var(--space-4);
}

.auth-forgot:hover {
  color: var(--qura-primary);
}

/* Secondary action under a primary submit — the "use a recovery code instead" swap on the
   MFA overlay. A button, not an <a>, because it changes the form rather than navigating. */
.auth-link-btn {
  display: block;
  width: 100%;
  margin-top: var(--space-3);
  padding: 8px;
  background: none;
  border: 0;
  font: inherit;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
}

.auth-link-btn:hover {
  color: var(--qura-primary);
  text-decoration: underline;
}

.auth-page-footer {
  text-align: center;
  padding: var(--space-4);
  font-size: 13px;
  color: var(--text-muted);
  background: var(--surface);
}

/* ---------- Below the fold: features, language toggle, footer ---------- */
.auth-below {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: var(--space-8) var(--space-5);
}

.auth-below-inner {
  max-width: 880px;
  margin: 0 auto;
}

.auth-below-features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-5);
  margin-bottom: var(--space-8);
}

.auth-below-feature {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.auth-below-feature svg {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  color: var(--qura-primary);
}

.auth-below-feature span {
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
}

/* Language toggle — same pill treatment as the dashboards' switcher (console.css'
   .sa-lang-*), kept local here so this public page doesn't need to load console.css. */
.auth-lang-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.auth-lang-row > span {
  font-size: 13px;
  color: var(--text-muted);
}

.auth-lang-group {
  display: inline-flex;
  gap: 2px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
}

.auth-lang-btn {
  background: transparent;
  color: var(--text-muted);
  border: none;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.auth-lang-btn:hover { color: var(--text); }
.auth-lang-btn.is-active { background: var(--surface); color: var(--qura-primary); box-shadow: var(--shadow); }

/* Footer: contextual copy links (qura-home / hospital-invitation) plus the standard legal
   links — kept as small inline text per product decision, not buttons/cards. */
.auth-below-footer {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.8;
}

.auth-below-footer a {
  color: var(--qura-primary);
  text-decoration: none;
  font-weight: 600;
}

.auth-below-footer a:hover { text-decoration: underline; }

.auth-below-footer .sep {
  margin: 0 var(--space-2);
  opacity: 0.5;
}

/* ---------- Responsive: mobile shows the form first, hero + below-fold content on scroll ---------- */
@media (max-width: 768px) {
  .auth-page {
    grid-template-columns: 1fr;
  }

  .auth-form-panel {
    order: 1;
    padding: var(--space-6) var(--space-4);
    min-height: 100vh;
  }

  .auth-brand {
    order: 2;
    min-height: 70vh;
  }

  .auth-mobile-brand {
    display: flex;
  }

  .auth-row-2 {
    grid-template-columns: 1fr;
  }

  .auth-below-features {
    grid-template-columns: 1fr;
  }
}

/* ---------- Dark mode adjustments ---------- */
@media (prefers-color-scheme: dark) {
  .auth-form-panel {
    background: var(--bg);
  }

  .auth-tab.is-active {
    background: var(--surface-2);
  }

  .auth-brand {
    background: linear-gradient(135deg, #0a5f67 0%, #064248 50%, #032a2e 100%);
  }
}