/* ==========================================================================
   KABIDE — Auth pages (sign-in + signup) stylesheet
   Shared by /app/index.html and /app/signup/index.html
   Matches the homepage palette exactly.
   ========================================================================== */

:root {
  --teal-50:  #f0fdfa;
  --teal-100: #ccfbf1;
  --teal-200: #99f6e4;
  --teal-300: #5eead4;
  --teal-400: #2dd4bf;
  --teal-500: #14b8a6;
  --teal-600: #0d9488;
  --teal-700: #0f766e;
  --teal-800: #115e59;
  --teal-900: #134e4a;
  --teal-950: #042f2e;

  --cyan-400: #22d3ee;
  --cyan-500: #06b6d4;
  --cyan-600: #0891b2;

  --slate-50:  #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;

  --rose-50:   #fff1f2;
  --rose-200:  #fecdd3;
  --rose-700:  #be123c;

  --bg-veil: rgba(255, 255, 255, 0.78);

  --font-serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-hebrew: 'Frank Ruhl Libre', 'Times New Roman', serif;
  --font-hebrew-display: 'David Libre', 'Frank Ruhl Libre', 'Times New Roman', serif;

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-xl: 28px;

  --shadow-sm: 0 1px 2px rgba(15, 118, 110, 0.06), 0 2px 6px rgba(15, 118, 110, 0.05);
  --shadow-md: 0 6px 20px rgba(15, 118, 110, 0.10), 0 2px 6px rgba(15, 118, 110, 0.06);
  --shadow-lg: 0 20px 50px rgba(15, 118, 110, 0.14), 0 6px 18px rgba(15, 118, 110, 0.08);
  --shadow-glow: 0 12px 36px rgba(20, 184, 166, 0.22);
}

/* ---------- RESET ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body, h1, h2, h3, h4, p, ul, ol, figure, blockquote, form, fieldset { margin: 0; padding: 0; }
ul, ol { list-style: none; }
img { max-width: 100%; display: block; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; background: none; border: 0; color: inherit; padding: 0; }
input, select, textarea { font: inherit; }

/* ---------- BASE ---------- */
body {
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--slate-800);
  line-height: 1.6;
  background-color: #eef9fb;
  background-image: url('../kabide-bg.png');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
  position: relative;
  min-height: 100vh;
  overflow-x: hidden;
}

/* The auth pages are typically nested one level deeper, so the relative path
   to the bg image differs. Each page sets its own bg url override. */

.bg-veil {
  position: fixed;
  inset: 0;
  background: var(--bg-veil);
  pointer-events: none;
  z-index: 0;
}

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 500;
  color: var(--slate-900);
  letter-spacing: -0.01em;
  line-height: 1.15;
}

/* ============================================================
   AUTH SHELL (centered card on the wave background)
   ============================================================ */
.auth-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.auth-header {
  padding: 24px clamp(20px, 5vw, 40px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.auth-brand-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex-shrink: 0;
}
.auth-brand-text { display: flex; flex-direction: column; line-height: 1; }
.auth-brand-name {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 500;
  color: var(--teal-900);
  letter-spacing: -0.01em;
}
.auth-brand-tagline {
  font-size: 11px;
  font-weight: 600;
  color: var(--teal-700);
  letter-spacing: 0.04em;
  margin-top: 4px;
}

.auth-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--teal-700);
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(20, 184, 166, 0.2);
  backdrop-filter: blur(6px);
  transition: background 150ms ease, color 150ms ease, transform 150ms ease;
}
.auth-back:hover { background: rgba(255, 255, 255, 0.9); color: var(--teal-900); transform: translateX(-2px); }
.auth-back svg { transition: transform 200ms ease; }
.auth-back:hover svg { transform: translateX(-2px); }

.auth-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px clamp(20px, 5vw, 40px) 64px;
}

.auth-card {
  width: 100%;
  max-width: 480px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(15, 118, 110, 0.1);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: clamp(32px, 5vw, 48px);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(8px);
  animation: fadeUp 600ms ease both;
}
.auth-card-wide { max-width: 560px; }

.auth-card::before {
  content: '';
  position: absolute;
  top: -120px;
  right: -120px;
  width: 280px;
  height: 280px;
  background: radial-gradient(closest-side, rgba(45, 212, 191, 0.18), transparent 70%);
  pointer-events: none;
}

.auth-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal-700);
  background: rgba(204, 251, 241, 0.55);
  border: 1px solid rgba(20, 184, 166, 0.18);
  padding: 6px 12px;
  border-radius: 999px;
  margin-bottom: 16px;
}
.auth-eyebrow-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal-500);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.18);
}

.auth-title {
  font-size: clamp(28px, 4vw, 36px);
  font-weight: 500;
  color: var(--slate-900);
  margin-bottom: 8px;
  position: relative;
}
.auth-subtitle {
  color: var(--slate-600);
  font-size: 15px;
  margin-bottom: 28px;
  position: relative;
}

/* ---------- FORM FIELDS ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
  position: relative;
}
.field-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--teal-800);
}
.field-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.9);
  font-size: 15px;
  color: var(--slate-800);
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}
.field-input::placeholder { color: var(--slate-400); }
.field-input:hover { border-color: var(--slate-300); }
.field-input:focus {
  outline: none;
  border-color: var(--teal-500);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.18);
}
.field-input.is-invalid {
  border-color: var(--rose-200);
  background: var(--rose-50);
}
.field-help {
  font-size: 12px;
  color: var(--slate-500);
  margin-top: -2px;
}
.field-error {
  font-size: 12px;
  color: var(--rose-700);
  margin-top: -2px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 480px) {
  .field-row { grid-template-columns: 1fr; }
}

/* ---------- PASSWORD FIELD WITH TOGGLE ---------- */
.field-password { position: relative; }
.field-password .field-input { padding-right: 44px; }
.field-toggle {
  position: absolute;
  right: 8px;
  bottom: 6px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--slate-500);
  border-radius: 8px;
  transition: color 150ms ease, background 150ms ease;
}
.field-toggle:hover { color: var(--teal-700); background: var(--teal-50); }
.field-toggle:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.25); }

/* ---------- CHECKBOX ---------- */
.checkbox-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--slate-600);
}
.checkbox-row input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 1px solid var(--slate-300);
  border-radius: 5px;
  background: #fff;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  margin-top: 1px;
  transition: border-color 150ms ease, background 150ms ease;
}
.checkbox-row input[type="checkbox"]:hover { border-color: var(--teal-500); }
.checkbox-row input[type="checkbox"]:checked {
  background: var(--teal-600);
  border-color: var(--teal-600);
}
.checkbox-row input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 1px;
  width: 6px;
  height: 11px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.checkbox-row input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.25);
}
.checkbox-row a { color: var(--teal-700); font-weight: 600; border-bottom: 1px solid rgba(20, 184, 166, 0.4); }
.checkbox-row a:hover { color: var(--teal-900); }

/* ---------- BUTTONS ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  padding: 12px 22px;
  border-radius: var(--radius-md);
  transition: transform 150ms ease, box-shadow 200ms ease, background 150ms ease, color 150ms ease;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.35);
}
.btn-block { width: 100%; }
.btn-lg { padding: 14px 26px; font-size: 15px; }

.btn-primary {
  background: linear-gradient(135deg, var(--teal-600), var(--teal-700));
  color: #fff;
  box-shadow: var(--shadow-glow);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 40px rgba(20, 184, 166, 0.32);
}
.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.65);
  color: var(--teal-800);
  border-color: rgba(20, 184, 166, 0.22);
}
.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(20, 184, 166, 0.4);
}

/* Loading spinner inside primary button */
.btn-primary[data-loading="true"] {
  pointer-events: none;
}
.btn-primary[data-loading="true"] .btn-label { opacity: 0.7; }
.btn-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
  display: none;
}
.btn-primary[data-loading="true"] .btn-spinner { display: inline-block; }

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

/* ---------- DIVIDER + ALT METHODS ---------- */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--slate-400);
  text-transform: uppercase;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--slate-200);
}

.btn-google,
.btn-magic {
  width: 100%;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--slate-200);
  color: var(--slate-700);
  margin-bottom: 10px;
  padding: 12px 18px;
  font-weight: 600;
  font-size: 14px;
  border-radius: var(--radius-md);
}
.btn-google:hover,
.btn-magic:hover {
  background: #fff;
  border-color: var(--slate-300);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

/* ---------- FOOTER PROMPT ---------- */
.auth-foot {
  margin-top: 24px;
  text-align: center;
  font-size: 14px;
  color: var(--slate-600);
  position: relative;
}
.auth-foot a {
  color: var(--teal-700);
  font-weight: 600;
  border-bottom: 1px solid rgba(20, 184, 166, 0.4);
  transition: color 150ms ease, border-color 150ms ease;
}
.auth-foot a:hover { color: var(--teal-900); border-color: var(--teal-700); }

/* ---------- FORGOT PASSWORD LINK ---------- */
.field-with-link {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.field-with-link a {
  font-size: 12px;
  font-weight: 600;
  color: var(--teal-700);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.field-with-link a:hover { color: var(--teal-900); }

/* ---------- ALERT (errors / info) ---------- */
.auth-alert {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-size: 14px;
  position: relative;
  align-items: flex-start;
}
.auth-alert-error {
  background: var(--rose-50);
  border: 1px solid var(--rose-200);
  color: var(--rose-700);
}
.auth-alert-success {
  background: var(--teal-50);
  border: 1px solid rgba(20, 184, 166, 0.25);
  color: var(--teal-800);
}
.auth-alert svg { flex-shrink: 0; margin-top: 2px; }

/* ---------- SIDE PANEL (signup page extras) ---------- */
.signup-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  max-width: 480px;
  margin: 0 auto;
}

/* ---------- DEDICATION ---------- */
.auth-dedication {
  margin-top: 28px;
  padding: 14px 18px;
  background: linear-gradient(135deg, rgba(204, 251, 241, 0.5), rgba(255, 255, 255, 0.7));
  border: 1px solid rgba(20, 184, 166, 0.22);
  border-radius: var(--radius-md);
  text-align: center;
  box-shadow: 0 3px 12px rgba(20, 184, 166, 0.14);
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  position: relative;
}
.auth-dedication-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--teal-700);
}
.auth-dedication-hebrew {
  font-family: var(--font-hebrew-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--teal-900);
  letter-spacing: 0.005em;
}

/* ---------- BOTTOM FOOTER ---------- */
.auth-footnote {
  text-align: center;
  font-size: 12px;
  color: var(--slate-500);
  padding: 16px 20px 32px;
  position: relative;
  z-index: 1;
}
.auth-footnote a { color: var(--teal-700); }
.auth-footnote a:hover { color: var(--teal-900); }

/* ---------- ANIMATIONS ---------- */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 540px) {
  .auth-header { padding: 16px 18px; gap: 12px; }
  .auth-brand-tagline { display: none; }
  .auth-back { padding: 6px 12px; font-size: 12px; }
  .auth-main { padding: 12px 18px 40px; align-items: flex-start; }
  .auth-card { padding: 28px 22px; }
}
