/*
  SOLE AI — Authentication Pages (register.html / login.html)
  Design Philosophy: Dark Intelligence × Tech Minimalism
  - Deep black background with subtle grid pattern
  - White/off-white text for contrast
  - Gold accent (#c9a96e) for brand identity
  - Noto Serif JP for headings, Noto Sans JP for body
*/

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

:root {
  --bg: #0a0a0a;
  --bg-card: #111111;
  --bg-input: #1a1a1a;
  --border: rgba(255,255,255,0.1);
  --border-focus: rgba(201,169,110,0.6);
  --text: #f0ede8;
  --text-muted: rgba(240,237,232,0.5);
  --text-subtle: rgba(240,237,232,0.3);
  --gold: #c9a96e;
  --gold-light: #e8c98a;
  --white: #ffffff;
  --error: #e05555;
  --success: #4caf7d;
  --radius: 12px;
  --radius-sm: 8px;
  --font-serif: 'Noto Serif JP', serif;
  --font-sans: 'Noto Sans JP', sans-serif;
}

body.auth-body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

/* ── Background ── */
.auth-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.auth-bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 60px 60px;
}

.auth-bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.15;
}

.orb1 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, #c9a96e 0%, transparent 70%);
  top: -200px;
  right: -100px;
}

.orb2 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, #4a6fa5 0%, transparent 70%);
  bottom: -100px;
  left: -100px;
}

/* ── Header ── */
.auth-header {
  position: relative;
  z-index: 10;
  padding: 1.5rem 2rem;
  display: flex;
  align-items: center;
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--text);
}

.auth-logo-mark {
  width: 36px;
  height: 36px;
  background: var(--gold);
  color: #000;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.1rem;
}

.auth-logo-text {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 1.1rem;
  letter-spacing: 0.05em;
}

/* ── Main ── */
.auth-main {
  position: relative;
  z-index: 10;
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem 4rem;
}

/* ── Card ── */
.auth-card {
  width: 100%;
  max-width: 560px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2.5rem;
  backdrop-filter: blur(10px);
}

.login-card {
  max-width: 460px;
  margin-top: 2rem;
}

/* ── Steps indicator ── */
.auth-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 2.5rem;
}

.auth-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  opacity: 0.35;
  transition: opacity 0.3s;
}

.auth-step.active {
  opacity: 1;
}

.auth-step.done {
  opacity: 0.7;
}

.step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  background: transparent;
  transition: all 0.3s;
}

.auth-step.active .step-num {
  border-color: var(--gold);
  background: var(--gold);
  color: #000;
}

.auth-step.done .step-num {
  border-color: var(--success);
  background: var(--success);
  color: #fff;
}

.step-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
}

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

.auth-step-line {
  flex: 1;
  height: 1px;
  background: var(--border);
  min-width: 40px;
  max-width: 80px;
  margin-bottom: 1.2rem;
}

/* ── Card header ── */
.auth-card-header {
  margin-bottom: 2rem;
}

.auth-title {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.auth-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ── Form ── */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-row {
  display: grid;
  gap: 0.8rem;
}

.form-row.two-col { grid-template-columns: 1fr 1fr; }
.form-row.three-col { grid-template-columns: 1fr 1fr 1fr; }

.form-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.form-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-label-link {
  font-size: 0.8rem;
}

.required {
  color: var(--gold);
  margin-left: 2px;
}

.form-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  padding: 0.75rem 1rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input::placeholder {
  color: var(--text-subtle);
}

.form-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(201,169,110,0.1);
}

.form-select-wrap {
  position: relative;
}

.form-select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  padding: 0.75rem 2rem 0.75rem 1rem;
  outline: none;
  appearance: none;
  cursor: pointer;
  transition: border-color 0.2s;
}

.form-select:focus {
  border-color: var(--border-focus);
}

.form-select-wrap::after {
  content: '▾';
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 0.8rem;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-subtle);
}

/* Password toggle */
.input-password-wrap {
  position: relative;
}

.input-password-wrap .form-input {
  padding-right: 3rem;
}

.toggle-password {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}

.toggle-password:hover {
  color: var(--text);
}

/* Gender options */
.gender-options {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.gender-option {
  display: flex;
  align-items: center;
  gap: 0;
  cursor: pointer;
}

.gender-option input[type="radio"] {
  display: none;
}

.gender-label {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: all 0.2s;
  cursor: pointer;
}

.gender-option input[type="radio"]:checked + .gender-label {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(201,169,110,0.1);
}

/* Checkbox */
.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  display: none;
}

.checkbox-custom {
  width: 18px;
  height: 18px;
  min-width: 18px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-input);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
  transition: all 0.2s;
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom {
  background: var(--gold);
  border-color: var(--gold);
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom::after {
  content: '✓';
  font-size: 0.7rem;
  color: #000;
  font-weight: 700;
}

.checkbox-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── Buttons ── */
.auth-btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.9rem 1.5rem;
  background: var(--gold);
  color: #000;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 0.5rem;
  letter-spacing: 0.02em;
}

.auth-btn-primary:hover {
  background: var(--gold-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(201,169,110,0.3);
}

.auth-btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.auth-btn-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.9rem 1.5rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.auth-btn-secondary:hover {
  border-color: rgba(255,255,255,0.3);
  color: var(--text);
}

.auth-btn-social {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.85rem 1.5rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 0.5rem;
}

.auth-btn-social:hover {
  border-color: rgba(255,255,255,0.25);
  color: var(--text);
}

.auth-btn-row {
  display: flex;
  gap: 0.8rem;
  margin-top: 1.5rem;
}

.auth-btn-row .auth-btn-primary {
  flex: 1;
  margin-top: 0;
}

/* ── Divider ── */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.5rem 0 0.5rem;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-divider span {
  font-size: 0.8rem;
  color: var(--text-subtle);
  white-space: nowrap;
}

/* ── Links ── */
.auth-link {
  color: var(--gold);
  text-decoration: none;
  transition: color 0.2s;
}

.auth-link:hover {
  color: var(--gold-light);
}

/* ── Footer text ── */
.auth-footer-text {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 1.5rem;
}

/* ── Error ── */
.auth-error {
  background: rgba(224,85,85,0.1);
  border: 1px solid rgba(224,85,85,0.3);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  color: #e05555;
}

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

/* ── Plan cards ── */
.plan-cards {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin-bottom: 0.5rem;
}

.plan-card {
  position: relative;
  background: var(--bg-input);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
  cursor: pointer;
  transition: all 0.2s;
}

.plan-card:hover {
  border-color: rgba(201,169,110,0.4);
}

.plan-card.selected {
  border-color: var(--gold);
  background: rgba(201,169,110,0.05);
}

.plan-card.recommended {
  border-color: rgba(201,169,110,0.35);
}

.plan-badge-top {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--gold);
  color: #000;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.8rem;
  border-radius: 20px;
  white-space: nowrap;
}

.plan-card-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.plan-badge {
  font-size: 0.72rem;
  color: var(--text-subtle);
  margin-bottom: 0.2rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.plan-name {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 500;
  color: var(--text);
}

.plan-price {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gold);
  margin: 0.2rem 0;
}

.plan-price span {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text-muted);
}

.plan-tokens {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.plan-level {
  display: inline-block;
  font-size: 0.72rem;
  color: var(--gold);
  border: 1px solid rgba(201,169,110,0.4);
  border-radius: 20px;
  padding: 0.15rem 0.6rem;
  margin-bottom: 0.6rem;
}

.plan-features {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1rem;
}

.plan-features li {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── Complete screen ── */
.auth-complete {
  text-align: center;
  padding: 1rem 0;
}

.complete-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(76,175,125,0.1);
  border: 2px solid rgba(76,175,125,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  color: var(--success);
}

.complete-quote {
  margin: 1.5rem auto;
  max-width: 300px;
  padding: 1rem 1.5rem;
  border-left: 2px solid var(--gold);
  text-align: left;
}

.complete-quote p {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 0.4rem;
}

.complete-quote span {
  font-size: 0.8rem;
  color: var(--text-subtle);
}

/* ── Step content transitions ── */
.auth-step-content {
  animation: fadeInUp 0.35s ease;
}

.auth-step-content.hidden {
  display: none;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .auth-card { padding: 1.5rem 1rem; border-radius: 14px; }
  .login-card { margin-top: 1rem; }
  .form-row.two-col { grid-template-columns: 1fr; }
  .auth-title { font-size: 1.4rem; }
  .auth-subtitle { font-size: 13px; }
  .plan-cards { gap: 0.5rem; }
  .auth-steps { gap: 0; margin-bottom: 1.5rem; }
  .auth-step-label { font-size: 10px; }
  .auth-step-line { width: 24px; }
  .auth-wrapper { padding: 1rem 0.75rem; }
}

/* ---- Auth Legal Links ---- */
.auth-legal-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
}
.auth-legal-link {
  font-size: 11px;
  color: rgba(255,255,255,0.3);
  text-decoration: none;
  transition: color 0.2s;
}
.auth-legal-link:hover { color: rgba(255,255,255,0.6); }
.auth-legal-sep {
  font-size: 11px;
  color: rgba(255,255,255,0.2);
}

/* ===== LIGHT THEME OVERRIDE (auth) ===== */
html.theme-light {
  --bg: #F5F5F3;
  --bg-card: #FFFFFF;
  --bg-input: #EFEFED;
  --border: rgba(0,0,0,0.1);
  --border-focus: rgba(0,0,0,0.4);
  --text: #111111;
  --text-muted: rgba(0,0,0,0.5);
  --text-subtle: rgba(0,0,0,0.3);
}
html.theme-light .auth-card { box-shadow: 0 4px 24px rgba(0,0,0,0.08); }
html.theme-light .form-input { color: #111; }
html.theme-light .btn-primary { background: #111; color: #fff; }
