/* ============================================================
   Adilet.kz — Auth & registration (signup / login / verify)
   Standalone, modern, mobile-first. Loaded on auth pages only.
   ============================================================ */

:root {
  --auth-primary: #8b0000;
  --auth-primary-hover: #6b0000;
  --auth-primary-soft: rgba(139, 0, 0, 0.07);
  --auth-primary-ring: rgba(139, 0, 0, 0.16);
  --auth-border: #e5e7eb;
  --auth-text: #111827;
  --auth-text-light: #6b7280;
  --auth-text-faint: #9ca3af;
  --auth-bg: #f4f5f7;
  --auth-radius: 12px;
  --auth-radius-lg: 18px;
  --auth-shadow: 0 4px 6px -2px rgba(16, 24, 40, 0.05), 0 12px 20px -6px rgba(16, 24, 40, 0.12);
  --auth-success: #059669;
  --auth-success-soft: #d1fae5;
  --auth-danger: #dc2626;
  --auth-danger-soft: #fee2e2;
}

body.auth-mode {
  background: var(--auth-bg);
  padding-left: 0;
  padding-right: 0;
}

.auth-page {
  min-height: calc(100vh - 60px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2.5rem 1rem 4rem;
}

.auth-shell {
  width: 100%;
  max-width: 460px;
}

.auth-shell-wide {
  max-width: 760px;
}

.auth-brand {
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, #a31515 0%, var(--auth-primary) 60%, #5c0000 100%);
  color: #fff;
  font-size: 1.5rem;
  box-shadow: 0 4px 12px rgba(139, 0, 0, 0.3);
  margin-bottom: 0.75rem;
}

.auth-brand-title {
  font-size: 1.375rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--auth-text);
  margin: 0;
}

.auth-brand-title em { font-style: normal; color: var(--auth-primary); }

.auth-card {
  background: #fff;
  border: 1px solid var(--auth-border);
  border-radius: var(--auth-radius-lg);
  box-shadow: var(--auth-shadow);
  overflow: hidden;
}

.auth-card-head {
  padding: 1.5rem 1.75rem 0.5rem;
}

.auth-card-title {
  font-size: 1.375rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--auth-text);
  margin: 0;
}

.auth-card-sub {
  margin: 0.375rem 0 0;
  color: var(--auth-text-light);
  font-size: 0.9375rem;
}

.auth-card-body { padding: 1.25rem 1.75rem 1.75rem; }

/* Neutralise legacy style.css .auth-form { width: 30% } inside the shell. */
.auth-mode .auth-form,
.auth-mode .auth-form-lawyer,
.auth-mode .auth-form.signup-client-form {
  width: 100%;
  max-width: none;
  margin: 0;
}

/* --- Role choice cards (registration entry) --- */
.auth-role-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.875rem;
  margin-top: 1rem;
}

.auth-role {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.25rem 1rem;
  border: 1.5px solid var(--auth-border);
  border-radius: var(--auth-radius);
  text-decoration: none;
  color: var(--auth-text);
  text-align: center;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.auth-role:hover {
  border-color: var(--auth-primary);
  box-shadow: 0 0 0 3px var(--auth-primary-ring);
  transform: translateY(-1px);
  color: var(--auth-text);
}

.auth-role i { font-size: 1.75rem; color: var(--auth-primary); }
.auth-role strong { font-size: 1rem; }
.auth-role span { font-size: 0.8125rem; color: var(--auth-text-light); }

/* --- Stepper --- */
.auth-stepper {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 0.25rem;
  margin-bottom: 1.5rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.auth-stepper::-webkit-scrollbar { display: none; }

.auth-step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.auth-step-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 700;
  background: #fff;
  border: 2px solid var(--auth-border);
  color: var(--auth-text-faint);
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.auth-step-label {
  font-size: 0.78125rem;
  font-weight: 600;
  color: var(--auth-text-faint);
  white-space: nowrap;
}

.auth-step.is-active .auth-step-dot {
  background: var(--auth-primary);
  border-color: var(--auth-primary);
  color: #fff;
}

.auth-step.is-active .auth-step-label { color: var(--auth-primary); }

.auth-step.is-done .auth-step-dot {
  background: var(--auth-success-soft);
  border-color: var(--auth-success);
  color: var(--auth-success);
}

.auth-step.is-done .auth-step-label { color: var(--auth-text); }

.auth-step-line {
  width: 28px;
  height: 2px;
  background: var(--auth-border);
  margin: 0 0.375rem;
  flex-shrink: 0;
}

.auth-step.is-done + .auth-step-line { background: var(--auth-success); }

/* --- Fields --- */
.auth-field { margin-bottom: 1.125rem; }

.auth-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--auth-text);
  margin-bottom: 0.375rem;
}

.auth-label .req { color: var(--auth-danger); margin-left: 2px; }

.auth-input,
.auth-mode .form-control,
.auth-mode .form-select,
.auth-mode textarea.form-control {
  width: 100%;
  border: 1.5px solid var(--auth-border);
  border-radius: 10px;
  padding: 0.65rem 0.85rem;
  font-size: 0.9375rem;
  color: var(--auth-text);
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-input::placeholder { color: var(--auth-text-faint); }

.auth-input:focus,
.auth-mode .form-control:focus,
.auth-mode .form-select:focus {
  outline: none;
  border-color: var(--auth-primary);
  box-shadow: 0 0 0 3px var(--auth-primary-ring);
}

.auth-input.is-invalid,
.auth-mode .form-control.is-invalid {
  border-color: var(--auth-danger);
}

.auth-input-group { position: relative; }
.auth-input-group .auth-input { padding-right: 2.75rem; }

.auth-input-toggle {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--auth-text-faint);
  cursor: pointer;
  padding: 0.25rem 0.4rem;
  font-size: 1rem;
}

.auth-input-toggle:hover { color: var(--auth-primary); }

.auth-hint {
  font-size: 0.78125rem;
  color: var(--auth-text-light);
  margin-top: 0.3rem;
}

.auth-error,
.form-error {
  color: var(--auth-danger);
  font-size: 0.8125rem;
  margin-top: 0.3rem;
}

.auth-error:empty { display: none; }

.form-error ul { list-style: none; margin: 0.3rem 0 0; padding: 0; }
.form-error li { color: var(--auth-danger); font-size: 0.8125rem; }

.auth-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.875rem;
}

/* Password strength meter */
.auth-strength {
  height: 5px;
  border-radius: 999px;
  background: #eceef1;
  overflow: hidden;
  margin-top: 0.5rem;
}

.auth-strength-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  transition: width 0.2s ease, background 0.2s ease;
}

.auth-strength-fill.s1 { width: 25%; background: var(--auth-danger); }
.auth-strength-fill.s2 { width: 50%; background: #f59e0b; }
.auth-strength-fill.s3 { width: 75%; background: #eab308; }
.auth-strength-fill.s4 { width: 100%; background: var(--auth-success); }

/* Checkboxes / radios */
.auth-check {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.9375rem;
  color: var(--auth-text);
  cursor: pointer;
}

.auth-check input { margin-top: 0.2rem; width: 18px; height: 18px; accent-color: var(--auth-primary); flex-shrink: 0; }
.auth-check a { color: var(--auth-primary); }

/* Chip-style single choice (category) */
.auth-choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.625rem; }

.auth-choice {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 0.875rem;
  border: 1.5px solid var(--auth-border);
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9375rem;
  transition: all 0.15s ease;
}

.auth-choice input { position: absolute; opacity: 0; }
.auth-choice:hover { border-color: var(--auth-primary); }
.auth-choice:has(input:checked) {
  border-color: var(--auth-primary);
  background: var(--auth-primary-soft);
  color: var(--auth-primary);
  box-shadow: 0 0 0 3px var(--auth-primary-ring);
}

.auth-choice i { font-size: 1.1rem; }

/* Multi-select list (specializations, languages) */
.auth-multi {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.5rem;
  max-height: 260px;
  overflow-y: auto;
  padding: 0.25rem;
  border: 1px solid var(--auth-border);
  border-radius: 10px;
}

.auth-multi label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  font-size: 0.875rem;
  cursor: pointer;
}

.auth-multi label:hover { background: var(--auth-primary-soft); }
.auth-multi input { accent-color: var(--auth-primary); width: 16px; height: 16px; }

.auth-multi-search {
  margin-bottom: 0.5rem;
}

/* --- Buttons & nav --- */
.auth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: 10px;
  font-size: 0.9375rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.auth-btn-primary {
  background: var(--auth-primary);
  color: #fff;
}

.auth-btn-primary:hover { background: var(--auth-primary-hover); color: #fff; box-shadow: 0 4px 12px rgba(139, 0, 0, 0.25); }
.auth-btn-primary:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; }

.auth-btn-ghost {
  background: #fff;
  border: 1.5px solid var(--auth-border);
  color: var(--auth-text-light);
}

.auth-btn-ghost:hover { border-color: var(--auth-primary); color: var(--auth-primary); }

.auth-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--auth-primary-ring); }

.auth-nav {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.auth-nav .auth-btn { width: auto; flex: 1; }
.auth-nav .auth-btn-ghost { flex: 0 0 auto; min-width: 120px; }

.auth-footer {
  text-align: center;
  margin-top: 1.5rem;
  color: var(--auth-text-light);
  font-size: 0.9375rem;
}

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

.auth-link-muted { color: var(--auth-text-light); font-size: 0.875rem; text-decoration: none; }
.auth-link-muted:hover { color: var(--auth-primary); }

/* --- Phone rows (step 3) --- */
.auth-phone-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.625rem;
  flex-wrap: wrap;
}

.auth-phone-row .auth-input { flex: 1; min-width: 160px; }

.auth-phone-flags { display: flex; gap: 0.75rem; }

.auth-phone-flag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8125rem;
  color: var(--auth-text-light);
  cursor: pointer;
}

.auth-phone-remove {
  border: none;
  background: var(--auth-danger-soft);
  color: var(--auth-danger);
  border-radius: 8px;
  width: 34px;
  height: 34px;
  cursor: pointer;
}

.auth-add-phone {
  border: 1.5px dashed var(--auth-border);
  background: transparent;
  color: var(--auth-primary);
  border-radius: 10px;
  padding: 0.5rem 0.875rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

.auth-add-phone:hover { border-color: var(--auth-primary); background: var(--auth-primary-soft); }

/* --- Alerts / notices --- */
.auth-notice {
  display: flex;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-radius: 10px;
  font-size: 0.9375rem;
  margin-bottom: 1.25rem;
}

.auth-notice i { flex-shrink: 0; margin-top: 2px; }
.auth-notice-info { background: #eff6ff; color: #1e40af; }
.auth-notice-warn { background: #fffbeb; color: #92400e; }
.auth-notice-success { background: var(--auth-success-soft); color: #065f46; }
.auth-notice-danger { background: var(--auth-danger-soft); color: #991b1b; }

/* Big result icon (verify / success pages) */
.auth-result-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  margin: 0 auto 1.25rem;
}

.auth-result-icon.ok { background: var(--auth-success-soft); color: var(--auth-success); }
.auth-result-icon.wait { background: #eff6ff; color: #2563eb; }
.auth-result-icon.err { background: var(--auth-danger-soft); color: var(--auth-danger); }

/* --- Mobile --- */
@media (max-width: 575.98px) {
  .auth-page { padding: 1.5rem 0.75rem 3rem; }
  .auth-card-head, .auth-card-body { padding-left: 1.25rem; padding-right: 1.25rem; }
  .auth-row { grid-template-columns: 1fr; }
  .auth-role-grid { grid-template-columns: 1fr; }
  .auth-nav { flex-direction: column-reverse; }
  .auth-nav .auth-btn { width: 100%; }
  .auth-step-label { display: none; }
  .auth-step-line { width: 16px; }
}
