/* ============================================================
   Shiraze Login — Variant A: Design System Restyle
   Fully aligned with Shiraze P24 Widget & Admin Design System
   ============================================================ */

/* Self-hosted, matching the established pattern in UI/p24_widget/dockerized/
   and UI/landing/v2/ -- the build originally linked Google Fonts over the
   network, which is a real dependency risk on the weak clinic wifi this exact
   product is meant to be used on. (2026-08-18, fixed during manual review) */
@font-face {
  font-family: Vazirmatn;
  src: url("fonts/Vazirmatn[wght].woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  /* Brand Palette (Shiraze Teal System) */
  --primary: #0D6E6A;
  --primary-strong: #0A5A57;
  --primary-hi: #20B7B2;
  --primary-hover-start: #0B605C;
  --primary-hover-end: #074744;
  --on-primary: #ffffff;

  /* Focus Indicators (WCAG 2.4.11 / 2.4.7 Compliant >= 3:1 Contrast) */
  --focus-ring: #0A5A57;
  --focus-shadow: rgba(13, 110, 106, 0.25);

  /* Semantic Feedback */
  --success: #059669;
  --success-bg: rgba(5, 150, 105, 0.12);
  --success-border: rgba(5, 150, 105, 0.35);
  --success-text: #059669;
  --warning: #d97706;
  --warning-bg: rgba(217, 119, 6, 0.12);
  --danger: #dc2626;
  --danger-bg: rgba(220, 38, 38, 0.08);
  --danger-border: rgba(220, 38, 38, 0.35);
  --danger-text: #dc2626;
  --error-shadow: rgba(220, 38, 38, 0.2);

  /* Neutrals & Surfaces */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #64748b;
  --placeholder-color: #94a3b8;
  --muted: #e2e8f0;
  --border: rgba(148, 163, 184, 0.28);
  --border-focus: #0D6E6A;

  /* Background Gradient Components */
  --bg-color-1: #e7f5f3;
  --bg-color-2: #f8fafc;
  --bg-color-3: #eef2f7;
  --bg-glow-1: rgba(32, 183, 178, 0.2);
  --bg-glow-2: rgba(13, 110, 106, 0.14);
  --form-glow-1: rgba(13, 110, 106, 0.04);
  --form-glow-2: rgba(32, 183, 178, 0.03);

  --bg-gradient: radial-gradient(ellipse at 70% -8%, var(--bg-glow-1) 0%, transparent 44%),
                 radial-gradient(ellipse at 12% 6%, var(--bg-glow-2) 0%, transparent 30%),
                 linear-gradient(168deg, var(--bg-color-1) 0%, var(--bg-color-2) 38%, var(--bg-color-3) 100%);
  --card-bg: rgba(255, 255, 255, 0.9);
  --card-bg-solid: #ffffff;
  --input-bg: rgba(255, 255, 255, 0.85);

  /* Shadows */
  --shadow-deep: 0 24px 60px rgba(15, 23, 42, 0.16);
  --shadow-soft: 0 10px 24px rgba(15, 23, 42, 0.07);
  --shadow-btn: 0 16px 34px rgba(13, 110, 106, 0.24);
  --shadow-btn-hover: 0 20px 44px rgba(13, 110, 106, 0.34);
  --shadow-card-glow: 0 0 0 1px rgba(13, 110, 106, 0.06),
                      0 24px 60px rgba(15, 23, 42, 0.14),
                      0 8px 20px rgba(13, 110, 106, 0.06);
  --success-glow: rgba(5, 150, 105, 0.2);
  --logo-shadow: rgba(13, 110, 106, 0.25);

  /* Brand Panel */
  --brand-panel-start: #0D6E6A;
  --brand-panel-mid: #0A5A57;
  --brand-panel-end: #074340;
  --brand-panel-text: rgba(255, 255, 255, 0.98);
  --brand-panel-subtext: rgba(255, 255, 255, 0.82);
  --brand-pill-bg: rgba(255, 255, 255, 0.12);
  --brand-pill-border: rgba(255, 255, 255, 0.18);
  --brand-orb-opacity: 0.18;
  --brand-trust-bg: rgba(255, 255, 255, 0.1);
  --brand-trust-border: rgba(255, 255, 255, 0.16);

  /* Toast & Controls */
  --toast-bg: rgba(255, 255, 255, 0.96);
  --toast-text: #0f172a;
  --toast-border: rgba(5, 150, 105, 0.35);
  --toast-icon-bg: rgba(5, 150, 105, 0.14);
  --toast-icon-color: #059669;
  --toast-bar-color: #059669;

  /* Resend & OTP */
  --otp-filled-bg: rgba(13, 110, 106, 0.08);
  --input-icon-color: #64748b;
  --back-btn-hover-bg: rgba(13, 110, 106, 0.08);
  --resend-disabled-text: #475569;
  --resend-timer-color: #0D6E6A;
  --resend-spinner-color: #0D6E6A;
  --spinner-track: rgba(255, 255, 255, 0.3);
  --spinner-head: #ffffff;
}

[data-theme="dark"] {
  /* Brand Palette (Dark Mode) */
  --primary: #2DD4CB;
  --primary-strong: #17A39E;
  --primary-hi: #5EEAD4;
  --primary-hover-start: #32E6DC;
  --primary-hover-end: #17A39E;
  --on-primary: #042f2e;

  /* Focus Indicators (WCAG 2.4.11 / 2.4.7 Compliant >= 3:1 Contrast) */
  --focus-ring: #2DD4CB;
  --focus-shadow: rgba(45, 212, 203, 0.3);

  /* Semantic Feedback */
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.18);
  --success-border: rgba(16, 185, 129, 0.35);
  --success-text: #34d399;
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.18);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.16);
  --danger-border: rgba(239, 68, 68, 0.35);
  --danger-text: #fca5a5;
  --error-shadow: rgba(239, 68, 68, 0.28);

  /* Neutrals & Surfaces */
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-tertiary: #94a3b8;
  --placeholder-color: #64748b;
  --muted: #1e293b;
  --border: rgba(148, 163, 184, 0.22);
  --border-focus: #2DD4CB;

  /* Background Gradient Components */
  --bg-color-1: #0b2a28;
  --bg-color-2: #0f172a;
  --bg-color-3: #020617;
  --bg-glow-1: rgba(45, 212, 203, 0.12);
  --bg-glow-2: rgba(13, 110, 106, 0.1);
  --form-glow-1: rgba(45, 212, 203, 0.04);
  --form-glow-2: rgba(32, 183, 178, 0.03);

  --bg-gradient: radial-gradient(ellipse at 70% -8%, var(--bg-glow-1) 0%, transparent 44%),
                 radial-gradient(ellipse at 12% 6%, var(--bg-glow-2) 0%, transparent 30%),
                 radial-gradient(circle at top right, var(--bg-color-1) 0%, var(--bg-color-2) 40%, var(--bg-color-3) 100%);
  --card-bg: rgba(15, 23, 42, 0.86);
  --card-bg-solid: #1e293b;
  --input-bg: rgba(255, 255, 255, 0.08);

  /* Shadows */
  --shadow-deep: 0 24px 70px rgba(0, 0, 0, 0.5);
  --shadow-soft: 0 10px 24px rgba(0, 0, 0, 0.35);
  --shadow-btn: 0 16px 34px rgba(0, 0, 0, 0.4);
  --shadow-btn-hover: 0 20px 44px rgba(0, 0, 0, 0.55);
  --shadow-card-glow: 0 0 0 1px rgba(45, 212, 203, 0.12),
                      0 24px 70px rgba(0, 0, 0, 0.45),
                      0 8px 20px rgba(45, 212, 203, 0.06);
  --success-glow: rgba(16, 185, 129, 0.22);
  --logo-shadow: rgba(0, 0, 0, 0.5);

  /* Brand Panel */
  --brand-panel-start: #0c2e2c;
  --brand-panel-mid: #082120;
  --brand-panel-end: #05141e;
  --brand-panel-text: rgba(255, 255, 255, 0.96);
  --brand-panel-subtext: rgba(255, 255, 255, 0.78);
  --brand-pill-bg: rgba(255, 255, 255, 0.08);
  --brand-pill-border: rgba(255, 255, 255, 0.12);
  --brand-orb-opacity: 0.12;
  --brand-trust-bg: rgba(255, 255, 255, 0.06);
  --brand-trust-border: rgba(255, 255, 255, 0.1);

  /* Toast & Controls */
  --toast-bg: rgba(30, 41, 59, 0.98);
  --toast-text: #f8fafc;
  --toast-border: rgba(16, 185, 129, 0.35);
  --toast-icon-bg: rgba(16, 185, 129, 0.2);
  --toast-icon-color: #34d399;
  --toast-bar-color: #10b981;

  /* Resend & OTP */
  --otp-filled-bg: rgba(45, 212, 203, 0.1);
  --input-icon-color: #94a3b8;
  --back-btn-hover-bg: rgba(45, 212, 203, 0.1);
  --resend-disabled-text: #cbd5e1;
  --resend-timer-color: #2DD4CB;
  --resend-spinner-color: #2DD4CB;
  --spinner-track: rgba(4, 47, 46, 0.3);
  --spinner-head: #042f2e;
}

/* ============================================================
   GLOBAL RESET & TYPOGRAPHY
   ============================================================ */

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

html {
  min-height: 100%;
  font-size: 16px;
}

body {
  min-height: 100dvh;
  font-family: Vazirmatn, Tahoma, Arial, sans-serif;
  background: var(--bg-gradient);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button, input {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

/* WCAG 2.4.11 / 2.4.7 focus indicator */
button:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--focus-shadow);
}

/* ============================================================
   FLOATING HEADER CONTROLS (THEME TOGGLE & TOAST)
   ============================================================ */

.theme-toggle {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 100;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card-bg);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  color: var(--text-primary);
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.theme-toggle:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-deep);
}

.theme-toggle:active {
  transform: scale(0.95);
}

.theme-icon {
  width: 20px;
  height: 20px;
  position: absolute;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.theme-icon--dark {
  opacity: 0;
  transform: rotate(-30deg) scale(0.85);
}

[data-theme="dark"] .theme-icon--light {
  opacity: 0;
  transform: rotate(30deg) scale(0.85);
}

[data-theme="dark"] .theme-icon--dark {
  opacity: 1;
  transform: rotate(0) scale(1);
}

/* Toast Container (aligned with theme toggle inset: top: 16px, right: 16px) */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 200;
  width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}

.toast-item {
  position: relative;
  display: flex;
  align-items: stretch;
  border-radius: 16px;
  background: var(--toast-bg);
  border: 1px solid var(--toast-border);
  box-shadow: var(--shadow-deep);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  overflow: hidden;
  opacity: 0;
  transform: translateY(-14px) scale(0.97);
  transition: opacity 0.28s ease, transform 0.28s ease;
  pointer-events: none;
}

.toast-item.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.toast-bar {
  width: 4px;
  flex: 0 0 4px;
  background: var(--toast-bar-color);
  border-radius: 999px 0 0 999px;
}

.toast-body {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  flex: 1;
  min-width: 0;
}

.toast-icon-wrap {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--toast-icon-bg);
  color: var(--toast-icon-color);
}

.toast-svg {
  width: 16px;
  height: 16px;
}

.toast-text {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--toast-text);
  line-height: 1.6;
}

/* ============================================================
   SPLIT PANEL LAYOUT
   ============================================================ */

.login-shell {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100dvh;
  width: 100%;
}

/* ============================================================
   BRAND PANEL (DESKTOP)
   ============================================================ */

.brand-panel {
  position: relative;
  background: linear-gradient(165deg, var(--brand-panel-start), var(--brand-panel-mid) 50%, var(--brand-panel-end));
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-panel__inner {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 48px 32px;
  max-width: 420px;
}

.brand-panel__content {
  position: relative;
  z-index: 3;
}

/* Floating decorative blurs */
.brand-orb {
  position: absolute;
  border-radius: 50%;
  opacity: var(--brand-orb-opacity);
  filter: blur(70px);
  pointer-events: none;
}

.brand-orb--1 {
  width: 320px;
  height: 320px;
  background: var(--primary-hi);
  top: -80px;
  right: -90px;
  animation: orbFloat1 9s ease-in-out infinite;
}

.brand-orb--2 {
  width: 220px;
  height: 220px;
  background: var(--primary);
  bottom: 8%;
  left: -50px;
  animation: orbFloat2 11s ease-in-out infinite;
}

.brand-orb--3 {
  width: 160px;
  height: 160px;
  background: var(--success);
  top: 45%;
  right: 15%;
  animation: orbFloat3 13s ease-in-out infinite;
}

@keyframes orbFloat1 {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-24px, 32px); }
}

@keyframes orbFloat2 {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(24px, -24px); }
}

@keyframes orbFloat3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-16px, 16px) scale(1.12); }
}

/* Brand logo */
.brand-logo-wrap {
  margin-bottom: 24px;
}

.brand-logo-svg {
  width: 80px;
  height: 80px;
  filter: drop-shadow(0 10px 28px var(--logo-shadow));
  transition: transform 0.3s ease;
}

.brand-panel__title {
  font-size: 2.4rem;
  font-weight: 900;
  color: var(--brand-panel-text);
  margin-bottom: 8px;
  letter-spacing: -0.03em;
}

.brand-panel__subtitle {
  font-size: 1rem;
  color: var(--brand-panel-subtext);
  margin-bottom: 48px;
  line-height: 1.8;
  text-wrap: balance;
}

/* Feature pills */
.brand-features {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}

.brand-feature {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
  border-radius: 999px;
  background: var(--brand-pill-bg);
  border: 1px solid var(--brand-pill-border);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--brand-panel-text);
  font-size: 0.9rem;
  font-weight: 700;
  min-width: 240px;
  pointer-events: none;
  transition: background 0.2s ease;
}

.brand-feature__icon-svg {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  opacity: 0.9;
}

/* Trust badge */
.brand-trust {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 40px;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--brand-trust-bg);
  border: 1px solid var(--brand-trust-border);
  color: var(--brand-panel-text);
  font-size: 0.82rem;
  font-weight: 600;
  opacity: 0.8;
}

.brand-trust__icon {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  fill: currentColor;
}

/* ============================================================
   FORM PANEL (MAIN)
   ============================================================ */

.form-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 40px 32px;
  position: relative;
}

.form-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 30% 20%, var(--form-glow-1) 0%, transparent 50%),
              radial-gradient(ellipse at 80% 70%, var(--form-glow-2) 0%, transparent 50%);
  pointer-events: none;
}

.form-card {
  position: relative;
  width: min(420px, 100%);
  background: var(--card-bg);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: 32px;
  box-shadow: var(--shadow-card-glow);
  padding: 40px 32px;
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

/* Mobile brand header */
.mobile-brand {
  display: none;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  justify-content: center;
}

.mobile-brand__logo {
  width: 40px;
  height: 40px;
  filter: drop-shadow(0 4px 12px var(--logo-shadow));
}

.mobile-brand__name {
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--primary);
}

/* ============================================================
   STEPS ANIMATIONS & FLOW
   ============================================================ */

.step {
  animation: stepFadeIn 0.36s cubic-bezier(0.22, 1, 0.36, 1);
}

.step.hidden {
  display: none !important;
}

@keyframes stepFadeIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Step Navigation */
.step__nav {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 16px;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--text-secondary);
  padding: 8px 16px;
  min-height: 44px;
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 700;
  transition: border-color 0.18s ease, color 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.back-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--back-btn-hover-bg);
  transform: translateX(3px);
}

.back-btn:active {
  transform: scale(0.97);
}

.back-btn svg {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  stroke-width: 2;
}

/* Step Header */
.step__header {
  margin-bottom: 24px;
  text-align: center;
}

.step__title {
  font-size: clamp(1.4rem, 4.5vw, 1.8rem);
  font-weight: 900;
  color: var(--text-primary);
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.step__desc {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.85;
  text-wrap: balance;
}

/* Form Group */
.form-group {
  margin-bottom: 24px;
}

.form-group label {
  display: block;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

/* Input Wrap & Field */
.input-wrap {
  position: relative;
}

.input-field {
  width: 100%;
  height: 54px;
  border: 1.5px solid var(--border);
  border-radius: 16px;
  background: var(--input-bg);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: var(--text-primary);
  font-size: 1.1rem;
  font-weight: 700;
  padding: 0 16px 0 48px;
  transition: border-color 0.18s ease, box-shadow 0.25s ease, background 0.18s ease, transform 0.18s ease;
  direction: ltr;
  text-align: left;
  letter-spacing: 0.04em;
}

.input-field::placeholder {
  color: var(--placeholder-color);
  opacity: 1;
  font-weight: 500;
  direction: rtl;
  text-align: right;
  letter-spacing: 0;
}

.input-field:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 4px var(--focus-shadow);
  background: var(--card-bg-solid);
  transform: translateY(-1px);
}

.input-field.has-error {
  border-color: var(--danger);
  box-shadow: 0 0 0 4px var(--error-shadow);
}

.input-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--input-icon-color);
  pointer-events: none;
  display: flex;
  align-items: center;
  transition: color 0.18s ease;
}

.input-field:focus ~ .input-icon {
  color: var(--primary);
}

/* Field Error */
.field-error {
  font-size: 0.84rem;
  color: var(--danger-text);
  font-weight: 600;
  margin-top: 8px;
  min-height: 0;
  line-height: 1.6;
  text-wrap: balance;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.field-error:empty {
  opacity: 0;
  min-height: 0;
  transform: translateY(-4px);
}

/* ============================================================
   PRIMARY ACTION BUTTON
   ============================================================ */

.btn-primary {
  width: 100%;
  height: 54px;
  min-height: 54px;
  border: none;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: var(--on-primary);
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: var(--shadow-btn);
  transition: transform 0.18s ease, box-shadow 0.22s ease, opacity 0.18s ease;
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--primary-hover-start), var(--primary-hover-end));
  opacity: 0;
  transition: opacity 0.2s ease;
  border-radius: inherit;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-btn-hover);
}

.btn-primary:hover:not(:disabled)::before {
  opacity: 1;
}

.btn-primary:active:not(:disabled) {
  transform: scale(0.985);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-text,
.btn-spinner,
.btn-icon {
  position: relative;
  z-index: 1;
}

.btn-icon {
  width: 20px;
  height: 20px;
  fill: currentColor;
  flex: 0 0 20px;
}

.btn-spinner {
  display: none;
  width: 20px;
  height: 20px;
  border: 2.5px solid var(--spinner-track);
  border-top-color: var(--spinner-head);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn-primary.loading .btn-text {
  opacity: 0.7;
}

.btn-primary.loading .btn-spinner {
  display: inline-block;
}

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

/* ============================================================
   OTP CELLS & RESEND
   ============================================================ */

.otp-phone {
  color: var(--primary);
  font-weight: 800;
  font-size: 0.95rem;
  direction: ltr;
  unicode-bidi: isolate;
}

.otp-inputs {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 4px;
}

.otp-cell {
  width: 52px;
  min-width: 44px;
  height: 58px;
  min-height: 44px;
  border: 1.5px solid var(--border);
  border-radius: 16px;
  background: var(--input-bg);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: var(--text-primary);
  font-size: 1.4rem;
  font-weight: 800;
  text-align: center;
  padding: 0;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease, background 0.18s ease;
  caret-color: var(--primary);
}

.otp-cell:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 4px var(--focus-shadow);
  transform: translateY(-2px);
}

.otp-cell.has-error {
  border-color: var(--danger);
  box-shadow: 0 0 0 4px var(--error-shadow);
}

.otp-cell.filled {
  border-color: var(--primary);
  background: var(--otp-filled-bg);
}

/* Resend Row & Button */
.resend-row {
  text-align: center;
  margin-top: 24px;
}

.resend-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: none;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  padding: 8px 16px;
  min-height: 44px;
  border-radius: 16px;
  position: relative;
  transition: color 0.18s ease, background 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}

.resend-btn:not(:disabled):hover {
  color: var(--primary);
  background: var(--back-btn-hover-bg);
  border-color: var(--border);
}

.resend-btn:not(:disabled):active {
  transform: scale(0.97);
}

/* Disabled resend button: maintains high contrast in glare/sunlight without dropping whole-element opacity */
.resend-btn:disabled {
  cursor: not-allowed;
  color: var(--resend-disabled-text);
  background: none;
  border-color: transparent;
  opacity: 1;
}

.resend-timer {
  color: var(--resend-timer-color);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  direction: ltr;
  display: inline-block;
}

.resend-btn.loading {
  opacity: 0.8;
  cursor: wait;
}

.resend-btn.loading::after {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--resend-spinner-color);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-inline-start: 4px;
}

/* ============================================================
   STEP 3: SUCCESS STATE
   ============================================================ */

.success-content {
  text-align: center;
  padding: 8px 0 0;
}

.success-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}

.success-check {
  width: 80px;
  height: 80px;
  filter: drop-shadow(0 6px 18px var(--success-glow));
}

.success-check__circle {
  stroke-dasharray: 189;
  stroke-dashoffset: 189;
  animation: circleDraw 0.4s ease 0.05s forwards;
}

@keyframes circleDraw {
  to { stroke-dashoffset: 0; }
}

.success-check__path {
  stroke-dasharray: 50;
  stroke-dashoffset: 50;
  animation: checkDraw 0.25s ease 0.25s forwards;
}

@keyframes checkDraw {
  to { stroke-dashoffset: 0; }
}

.success-desc {
  margin-bottom: 16px;
  text-wrap: balance;
}

/* Calm, clear status badge */
.success-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  max-width: 100%;
  border-radius: 999px;
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  color: var(--success-text);
  font-size: 0.84rem;
  font-weight: 700;
  margin-bottom: 24px;
  line-height: 1.5;
  text-wrap: balance;
  text-align: center;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px var(--success-bg);
}

.success-actions {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.btn-success-cta {
  font-size: 1.05rem;
}

/* ============================================================
   SHAKE ANIMATION (ERRORS)
   ============================================================ */

.shake {
  animation: shake 0.42s ease;
}

@keyframes shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}

/* ============================================================
   RESPONSIVE LAYOUT & MOBILE THUMB ZONE
   ============================================================ */

@media (max-width: 900px) {
  .login-shell {
    grid-template-columns: 1fr;
  }

  .brand-panel {
    display: none;
  }

  .mobile-brand {
    display: flex;
  }

  /* Centered form card for natural thumb-reach on modern tall phones */
  .form-panel {
    min-height: 100dvh;
    padding: 24px 16px;
    align-items: center;
    justify-content: center;
  }

  .form-card {
    padding: 32px 24px;
    border-radius: 28px;
  }
}

@media (max-width: 400px) {
  .form-panel {
    padding: 16px 12px;
  }

  .form-card {
    padding: 24px 16px;
    border-radius: 24px;
  }

  .step__title {
    font-size: 1.3rem;
  }

  .step__desc {
    font-size: 0.86rem;
  }

  .otp-cell {
    width: 46px;
    min-width: 40px;
    height: 52px;
    min-height: 40px;
    font-size: 1.25rem;
    border-radius: 16px;
  }

  .otp-inputs {
    gap: 8px;
  }

  .btn-primary {
    height: 52px;
    min-height: 52px;
    border-radius: 16px;
    font-size: 0.96rem;
  }

  .input-field {
    height: 52px;
    border-radius: 16px;
    font-size: 1.05rem;
  }

  .success-status-badge {
    border-radius: 16px;
    font-size: 0.8rem;
    padding: 8px 12px;
  }
}

@media (max-width: 360px) {
  .form-panel {
    padding: 12px 6px;
  }

  .form-card {
    padding: 20px 12px;
    border-radius: 20px;
  }

  .otp-cell {
    width: 40px;
    min-width: 40px;
    height: 48px;
    min-height: 40px;
    font-size: 1.15rem;
    border-radius: 12px;
  }

  .otp-inputs {
    gap: 4px;
  }

  .step__title {
    font-size: 1.22rem;
  }
}
