/* Auth pages: sign-up and sign-in (Hebrew, RTL) */

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: #f5f3ff;
  color: #1f2937;
  margin: 0;
  padding: 0;
  min-block-size: 100dvb;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-page {
  inline-size: min(440px, 100%);
  margin: 24px auto;
  padding: 32px 28px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(107, 33, 168, 0.10);
  position: relative;
}

/* ---- Header ---- */
.auth-header {
  text-align: center;
  margin-block-end: 28px;
}

.auth-logo {
  font-size: 2.5rem;
  line-height: 1;
  display: block;
  margin-block-end: 8px;
}

.auth-header h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: #6b21a8;
  margin: 0 0 4px;
}

.auth-header p {
  font-size: 0.9rem;
  color: #6b7280;
  margin: 0;
}

/* ---- Form layout ---- */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field-row .form-group { min-width: 0; }

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

label {
  font-size: 0.9rem;
  font-weight: 500;
  color: #374151;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"] {
  block-size: 42px;
  padding-inline: 12px;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.9rem;
  color: #1f2937;
  background: #fff;
  transition: border-color 0.15s;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="password"]:focus {
  outline: none;
  border-color: #6b21a8;
  box-shadow: 0 0 0 3px rgba(107, 33, 168, 0.12);
}

/* ---- Roles checkboxes ---- */
.roles-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.roles-group legend {
  font-size: 0.9rem;
  font-weight: 500;
  color: #374151;
  margin-block-end: 6px;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 6px 16px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  inline-size: 16px;
  block-size: 16px;
  accent-color: #6b21a8;
  cursor: pointer;
}

/* ---- Password show/hide toggle ---- */
.password-field { position: relative; }
.password-field input { padding-inline-end: 52px; }
.password-toggle {
  position: absolute;
  inset-block-start: 0;
  inset-inline-end: 0;
  block-size: 42px;
  padding-inline: 10px;
  background: none;
  border: none;
  color: #9ca3af;
  display: flex;
  align-items: center;
  cursor: pointer;
}
.password-toggle:hover { color: #6b21a8; }

/* ---- Terms checkbox ---- */
.terms-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.88rem;
  cursor: pointer;
}

.terms-label input[type="checkbox"] {
  flex-shrink: 0;
  margin-block-start: 2px;
  accent-color: #6b21a8;
  cursor: pointer;
}

.terms-label a {
  color: #6b21a8;
  text-decoration: underline;
}

/* ---- Privacy note ---- */
.privacy-note {
  font-size: 0.85rem;
  color: #6b7280;
  margin: 0.25rem 0 0.75rem;
}

/* ---- Submit button ---- */
.btn-primary {
  block-size: 46px;
  border: none;
  border-radius: 10px;
  background: #6b21a8;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.btn-primary:hover {
  background: #581c87;
}

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

/* ---- Error / Success messages ---- */
.alert {
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
  display: none;
}

.alert-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.alert-success {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

/* ---- Confirm step (SMS code) ---- */
.confirm-step {
  text-align: center;
}

.confirm-step p {
  color: #4b5563;
  font-size: 0.95rem;
  margin-block-end: 20px;
}

.code-input {
  inline-size: 100%;
  block-size: 54px;
  text-align: center;
  font-size: 1.8rem;
  letter-spacing: 0.3em;
  padding-inline: 12px;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
}

.code-input:focus {
  outline: none;
  border-color: #6b21a8;
  box-shadow: 0 0 0 3px rgba(107, 33, 168, 0.12);
}

.resend-row {
  margin-block-start: 14px;
  font-size: 0.88rem;
  color: #6b7280;
}

.resend-btn {
  background: none;
  border: none;
  color: #6b21a8;
  font-size: 0.88rem;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.resend-btn:disabled {
  color: #9ca3af;
  cursor: not-allowed;
  text-decoration: none;
}

/* ---- Close button (X) ---- */
.close-btn {
  position: absolute;
  top: 14px;
  inset-inline-end: 16px;
  color: #9ca3af;
  text-decoration: none;
  display: flex;
}
.close-btn:hover { color: #374151; }

/* ---- Footer links ---- */
.auth-footer {
  margin-block-start: 20px;
  text-align: center;
  font-size: 0.88rem;
  color: #6b7280;
}

.auth-footer a {
  color: #6b21a8;
  text-decoration: none;
  font-weight: 500;
}

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

/* Ensure [hidden] always wins over any class-level display rule. */
[hidden] { display: none !important; }

/* ---- Forgot-password inline step ---- */
.forgot-step {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ---- Divider ---- */
.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #9ca3af;
  font-size: 0.82rem;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  block-size: 1px;
  background: #e5e7eb;
}

/* Accessibility */
button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid #6b21a8;
  outline-offset: 2px;
}
