/* ============================================================
   NEXORA · Components / Auth — Apple Minimal
   No glass, no gradients, no glows. Flat minimal.
   ============================================================ */

:root { --auth-blue: 0, 0, 0; --auth-blue-2: 0, 0, 0; }

/* ---------- 1 · Sign In button — flat minimal -------------- */

.btn-signin {
  position: relative;
  color: #ffffff;
  background: #1d1d1f;
  border: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  box-shadow: none;
  overflow: hidden;
}

[data-theme="dark"] .btn-signin { background: #ffffff; color: #000000; }

.btn-signin::before { content: none; display: none; }

.btn-signin:hover {
  color: #ffffff;
  background: #000000;
  border-color: transparent;
  transform: translateY(-1px);
  box-shadow: none;
}

[data-theme="dark"] .btn-signin:hover { background: #f5f5f7; color: #000000; }

[data-theme="light"] .btn-signin { color: #ffffff; background: #1d1d1f; border: none; }
[data-theme="light"] .btn-signin:hover { color: #ffffff; background: #000000; }

/* ---------- 2 · Auth dialog shell ---------------------------- */

.auth-card {
  width: min(100%, 452px);
  padding: 1.75rem 1.75rem 1.6rem;
  max-height: calc(100vh - 2.5rem);
  overflow-y: auto;
  background: var(--bg-elevated);
  border: none;
  box-shadow: none;
}

.auth-card::-webkit-scrollbar { width: 6px; }
.auth-card::-webkit-scrollbar-thumb { background: #e8e8ed; border-radius: 99px; }

.auth-brand { display: flex; align-items: center; gap: 0.55rem; margin-bottom: 1.15rem; }
.auth-brand .icon { width: 28px; height: 28px; }
.auth-brand span { font-family: var(--font-display); font-size: 0.95rem; font-weight: 700; letter-spacing: 0.2em; color: var(--text-1); }

/* ---------- 3 · Mode tabs with sliding glider ---------------- */

.auth-tabs {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem;
  padding: 0.28rem;
  border-radius: var(--radius-md);
  background: #f5f5f7;
  box-shadow: none;
  margin-bottom: 1.4rem;
}

[data-theme="dark"] .auth-tabs { background: #1c1c1e; }
[data-theme="light"] .auth-tabs { background: #f5f5f7; }

.auth-tab {
  position: relative; z-index: 1;
  padding: 0.6rem 0.5rem;
  font-family: var(--font-display);
  font-size: 0.9rem; font-weight: 600;
  color: var(--text-3);
  border-radius: calc(var(--radius-md) - 4px);
  transition: color var(--dur) var(--ease-out);
}

.auth-tab.is-active { color: var(--text-1); }
[data-theme="light"] .auth-tab.is-active { color: #1d1d1f; }

.auth-glider {
  position: absolute; z-index: 0;
  top: 0.28rem; bottom: 0.28rem; left: 0.28rem;
  width: calc(50% - 0.34rem);
  border-radius: calc(var(--radius-md) - 4px);
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  transition: transform var(--dur) var(--ease-spring);
}

[data-theme="dark"] .auth-glider { background: #2c2c2e; box-shadow: none; }

.auth-modal[data-mode="signin"] .auth-glider { transform: translateX(calc(100% + 0.12rem)); }

/* ---------- 4 · Heading -------------------------------------- */

.auth-head { margin-bottom: 1.25rem; }
.auth-head h3 { font-size: 1.35rem; margin-bottom: 0.35rem; color: var(--text-1); }
.auth-head p { font-size: 0.88rem; color: var(--text-3); line-height: 1.55; }

/* ---------- 5 · Social buttons -------------------------------- */

.auth-social { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; margin-bottom: 1.1rem; }

.auth-social-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.55rem;
  padding: 0.7rem 0.8rem;
  font-size: 0.88rem; font-weight: 500;
  color: var(--text-1);
  border-radius: var(--radius-md);
  background: #f5f5f7;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  border: none;
  transition: background var(--dur), transform var(--dur-fast);
}

[data-theme="dark"] .auth-social-btn { background: #1c1c1e; }
[data-theme="light"] .auth-social-btn { background: #f5f5f7; }

.auth-social-btn:hover { background: #e8e8ed; transform: none; box-shadow: none; }
[data-theme="dark"] .auth-social-btn:hover { background: #2c2c2e; }
.auth-social-btn .icon { width: 1.05em; height: 1.05em; }

.auth-divider {
  display: flex; align-items: center; gap: 0.85rem;
  margin-bottom: 1.15rem;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}

.auth-divider::before, .auth-divider::after {
  content: ""; flex: 1; height: 1px;
  background: #f5f5f7;
}

[data-theme="dark"] .auth-divider::before,
[data-theme="dark"] .auth-divider::after { background: #1c1c1e; }

/* ---------- 6 · Panes — premium cross-fade + height ---------- */

.auth-panes {
  position: relative;
  display: block;
  overflow: hidden;
  /* height driven by JS for smooth morph; fallback to auto */
  transition: height 0.48s cubic-bezier(0.22, 0.61, 0.36, 1);
  will-change: height;
}

.auth-pane {
  display: grid;
  gap: 0.9rem;
  opacity: 0;
  transform: translateY(12px) scale(0.985);
  filter: blur(8px);
  pointer-events: none;
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  transition:
    opacity 0.34s var(--ease-out),
    transform 0.44s cubic-bezier(0.22, 0.61, 0.36, 1),
    filter 0.34s var(--ease-out);
  will-change: opacity, transform, filter;
}

.auth-pane.is-active {
  position: relative;
  opacity: 1;
  transform: none;
  filter: none;
  pointer-events: auto;
  animation: none;
}

@media (prefers-reduced-motion: reduce) {
  .auth-panes { transition: none; }
  .auth-pane { transition: none; filter: none; transform: none; }
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap > .icon { position: absolute; left: 0.9rem; color: var(--text-3); pointer-events: none; width: 1em; height: 1em; }
.input-wrap .input { padding-left: 2.5rem; }
.input-wrap.has-toggle .input { padding-right: 2.8rem; }

.pw-toggle {
  position: absolute; right: 0.55rem;
  display: grid; place-items: center;
  width: 30px; height: 30px;
  border-radius: var(--radius-xs);
  color: var(--text-3);
  transition: color var(--dur-fast), background var(--dur-fast);
}

.pw-toggle:hover { color: var(--text-1); background: #f5f5f7; }
[data-theme="dark"] .pw-toggle:hover { background: #1c1c1e; }

/* Strength meter — monochrome */
.pw-strength { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 0.15rem; }
.pw-strength i { height: 3px; border-radius: 99px; background: #f5f5f7; transition: background var(--dur) var(--ease-out); }
[data-theme="dark"] .pw-strength i { background: #1c1c1e; }
.pw-strength[data-score="1"] i:nth-child(-n + 1),
.pw-strength[data-score="2"] i:nth-child(-n + 2),
.pw-strength[data-score="3"] i:nth-child(-n + 3),
.pw-strength[data-score="4"] i { background: var(--text-1); }
.pw-hint { font-family: var(--font-mono); font-size: 0.66rem; color: var(--text-3); margin-top: 0.2rem; }

/* Error state */
.input.is-error { box-shadow: 0 0 0 2px rgba(255, 59, 48, 0.4); }
.field-error { display: none; font-size: 0.74rem; color: #ff3b30; }
.field.has-error .field-error { display: block; }

/* ---------- 7 · Checkbox & meta rows --------------------------- */

.check-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; font-size: 0.82rem; color: var(--text-2); }
.checkbox { display: inline-flex; align-items: center; gap: 0.55rem; cursor: pointer; line-height: 1.4; }
.checkbox input { position: absolute; opacity: 0; width: 0; height: 0; }
.checkbox .box {
  display: grid; place-items: center;
  width: 18px; height: 18px; flex: none;
  border-radius: 5px;
  background: #f5f5f7;
  box-shadow: none;
  border: none;
  color: transparent;
  transition: background var(--dur-fast), color var(--dur-fast);
}

[data-theme="dark"] .checkbox .box { background: #1c1c1e; box-shadow: none; }
[data-theme="light"] .checkbox .box { background: #f5f5f7; box-shadow: none; }

.checkbox input:checked + .box { background: #1d1d1f; color: #fff; box-shadow: none; }
[data-theme="dark"] .checkbox input:checked + .box { background: #ffffff; color: #000000; }
.checkbox input:focus-visible + .box { outline: 2px solid #007aff; outline-offset: 2px; }
.checkbox .box .icon { width: 0.72em; height: 0.72em; }
.checkbox a { color: var(--text-1); text-decoration: underline; text-underline-offset: 2px; }
.checkbox a:hover { opacity: 0.7; }
.link-quiet { font-size: 0.82rem; color: var(--text-1); }
.link-quiet:hover { opacity: 0.7; }

/* ---------- 8 · Footer switch ---------------------------------- */

.auth-switch {
  margin-top: 1.15rem; padding-top: 1.05rem;
  border-top: 1px solid #f5f5f7;
  text-align: center; font-size: 0.88rem; color: var(--text-3);
}

[data-theme="dark"] .auth-switch { border-top-color: #1c1c1e; }
.auth-switch button { color: var(--text-1); font-weight: 600; }
.auth-switch button:hover { opacity: 0.7; text-decoration: underline; }

/* ---------- 9 · Success state ---------------------------------- */

.auth-success { display: none; text-align: center; padding: 0.75rem 0 0.25rem; }
.auth-modal.is-success .auth-tabs,
.auth-modal.is-success .auth-head,
.auth-modal.is-success .auth-social,
.auth-modal.is-success .auth-divider,
.auth-modal.is-success .auth-pane,
.auth-modal.is-success .auth-switch { display: none; }
.auth-modal.is-success .auth-success { display: block; animation: refresh-item 0.45s var(--ease-out) both; }

/* ---------- 10 · Responsive ------------------------------------ */

@media (max-width: 560px) {
  .auth-card { padding: 1.35rem 1.25rem 1.25rem; }
  .auth-social, .field-row { grid-template-columns: 1fr; }
}
