/* ============================================================
   SaaS Vault — Auth Pages CSS
   Covers: login, register, forgot, reset
   ============================================================ */

/* ── Design tokens ── */
:root {
  --primary:        #6366f1;
  --primary-hover:  #4f46e5;
  --primary-light:  #eef2ff;
  --success:        #22c55e;
  --success-bg:     #f0fdf4;
  --danger:         #ef4444;
  --danger-bg:      #fef2f2;
  --warning:        #f59e0b;
  --warning-bg:     #fffbeb;
  --text:           #111827;
  --text-muted:     #6b7280;
  --text-subtle:    #9ca3af;
  --border:         #e5e7eb;
  --border-focus:   #6366f1;
  --bg:             #f8f9fb;
  --card-bg:        #ffffff;
  --input-bg:       #f9fafb;
  --radius:         12px;
  --radius-sm:      8px;
  --shadow-card:    0 1px 3px rgba(0,0,0,.06), 0 8px 32px rgba(0,0,0,.06);
  --font:           'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

html, body {
  height: 100%;
  font-family: var(--font);
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ── Split layout (login / register) ── */
.auth-body { min-height: 100vh; display: flex; }

.auth-split {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* ── Left brand panel ── */
.auth-brand {
  width: 420px;
  flex-shrink: 0;
  background: linear-gradient(145deg, #4f46e5 0%, #7c3aed 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 40px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.auth-brand-inner { color: #fff; max-width: 320px; }

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  margin-bottom: 48px;
}

.brand-icon  { font-size: 28px; }
.brand-name  { font-size: 22px; font-weight: 700; color: #fff; letter-spacing: -0.5px; }

.brand-tagline {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 40px;
  color: rgba(255,255,255,.95);
}

.brand-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.brand-features li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: rgba(255,255,255,.85);
  font-weight: 500;
}

.feat-icon { font-size: 18px; flex-shrink: 0; }

/* ── Right form panel ── */
.auth-form-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  overflow-y: auto;
}

/* ── Centered layout (forgot / reset / small forms) ── */
.auth-center {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

/* ── Auth card ── */
.auth-card {
  background: var(--card-bg);
  border-radius: 20px;
  box-shadow: var(--shadow-card);
  padding: 40px;
  width: 100%;
  max-width: 460px;
}

.auth-card-sm { max-width: 400px; }

.auth-card-header { margin-bottom: 32px; }

.auth-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

.auth-subtitle {
  font-size: 14px;
  color: var(--text-muted);
}

/* ── Form elements ── */
.form-group  { margin-bottom: 20px; }

.form-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.label-link {
  font-weight: 400;
  color: var(--primary);
  text-decoration: none;
  font-size: 12px;
}
.label-link:hover { text-decoration: underline; }

.form-input {
  width: 100%;
  padding: 11px 14px;
  background: var(--input-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.form-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
  background: #fff;
}

.form-input.form-input-otp {
  font-size: 22px;
  letter-spacing: 6px;
  text-align: center;
  font-weight: 600;
}

.form-hint {
  font-size: 12px;
  margin-top: 6px;
}

.input-wrapper {
  position: relative;
}

.input-wrapper .form-input {
  padding-right: 44px;
}

.toggle-password {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  padding: 4px;
  border-radius: 4px;
  transition: color .15s;
}
.toggle-password:hover { color: var(--text); }

/* ── Password strength ── */
.strength-meter { margin-top: 8px; }

.strength-bar {
  height: 4px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 4px;
}

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

.strength-label {
  font-size: 11px;
  font-weight: 600;
}

/* ── Password requirements ── */
.pwd-requirements {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
  margin: -8px 0 20px;
  padding: 12px 14px;
  background: var(--input-bg);
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
}

.req {
  font-size: 12px;
  color: var(--text-muted);
  padding-left: 16px;
  position: relative;
}

.req::before {
  content: '○';
  position: absolute;
  left: 0;
  color: var(--text-subtle);
}

.req-pass { color: var(--success); }
.req-pass::before { content: '✓'; color: var(--success); }

.req-fail { color: var(--danger); }
.req-fail::before { content: '✗'; color: var(--danger); }

/* ── Checkbox ── */
.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1.5;
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

/* ── Zero-knowledge notice ── */
.zk-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--primary-light);
  border: 1.5px solid #c7d2fe;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 12px;
  color: #3730a3;
  margin: 16px 0 20px;
  line-height: 1.5;
}

.zk-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background .15s, transform .1s, opacity .15s;
  white-space: nowrap;
}

.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover:not(:disabled) { background: var(--bg); color: var(--text); }

.btn-full { width: 100%; }

.btn-spinner { display: inline-flex; }

/* ── Spinner animation ── */
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin .7s linear infinite; }

/* ── Alerts ── */
.alert {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
  line-height: 1.5;
}

.alert-error   { background: var(--danger-bg);  color: #b91c1c; border: 1px solid #fecaca; }
.alert-success { background: var(--success-bg); color: #15803d; border: 1px solid #bbf7d0; }
.alert-warning { background: var(--warning-bg); color: #92400e; border: 1px solid #fde68a; }

/* ── 2FA header ── */
.twofa-header {
  text-align: center;
  margin-bottom: 24px;
}
.twofa-icon { font-size: 40px; margin-bottom: 12px; }
.twofa-header h3 { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.twofa-header p  { font-size: 13px; color: var(--text-muted); line-height: 1.5; }

/* ── Links ── */
.auth-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}
.auth-link:hover { text-decoration: underline; }

.auth-footer-text {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 24px;
}

/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */
@media (max-width: 768px) {
  .auth-brand { display: none; }

  .auth-split {
    flex-direction: column;
  }

  .auth-form-panel {
    padding: 24px 16px;
    align-items: flex-start;
    padding-top: 40px;
  }

  .auth-card {
    padding: 28px 20px;
    border-radius: 16px;
    box-shadow: none;
    border: 1px solid var(--border);
  }

  .pwd-requirements {
    grid-template-columns: 1fr;
  }

  /* Show mini brand header on mobile */
  .auth-form-panel::before {
    content: '🔐 ' attr(data-app);
    display: block;
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 24px;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .auth-card { padding: 24px 16px; }
  .auth-title { font-size: 20px; }
}
