/* ═══════════════════════════════════════════
   THE RITUAL — Authentication Views
   NOTE: No CSS nesting — must support iOS Safari 15+
═══════════════════════════════════════════ */

.auth-layout {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-darker) 100%);
  padding: 20px;
}

.auth-card {
  background: var(--navy-card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

.auth-header {
  text-align: center;
  margin-bottom: 32px;
}

.auth-title {
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 300;
  letter-spacing: 0.1em;
  color: var(--text);
  margin: 0 0 8px 0;
}

.auth-subtitle {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 15px;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  opacity: 0.6;
  margin: 0;
}

/* ── Forms ── */

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

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

.auth-form h2 {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 400;
  letter-spacing: 0.06em;
  color: var(--text);
  margin: 0 0 10px 0;
}

/* ── Form Groups ── */

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

.form-group label {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.form-group input {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  padding: 12px 14px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  letter-spacing: 0.02em;
  transition: border-color 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--gold-line);
  background: rgba(255,255,255,0.04);
}

.form-group input::placeholder {
  color: var(--text-muted);
  opacity: 0.5;
}

.form-group small {
  font-size: 13px;
  color: var(--text-muted);
  opacity: 0.6;
  margin-top: 2px;
}

/* ── Auth Button ── */

.btn-auth {
  background: var(--gold);
  border: none;
  border-radius: 8px;
  padding: 12px 16px;
  color: var(--navy);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(196,164,107,0.2);
}

.btn-auth:hover {
  background: var(--gold-bright);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(196,164,107,0.3);
}

.btn-auth:disabled {
  background: rgba(196,164,107,0.4);
  color: rgba(11,21,32,0.6);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ── Divider ── */

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0;
  color: var(--text-muted);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.auth-divider span {
  opacity: 0.6;
}

/* ── OAuth Buttons ── */

.oauth-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn-oauth {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-oauth svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.btn-oauth:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.15);
  transform: translateY(-1px);
}

.btn-oauth:active {
  transform: translateY(0);
}

.btn-google:hover {
  border-color: rgba(66, 133, 244, 0.5);
  background: rgba(66, 133, 244, 0.08);
}

.btn-google svg {
  color: #4285f4;
}

.btn-apple:hover {
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.08);
}

.btn-apple svg {
  color: var(--text);
}

/* ── Auth Toggle / Footer ── */

.auth-toggle {
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  margin: 0;
}

.auth-toggle a {
  color: var(--gold);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.auth-toggle a:hover {
  color: var(--gold-bright);
  text-decoration: underline;
}

.auth-footer {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  margin: 0;
}

.auth-footer a {
  color: var(--gold);
  text-decoration: none;
  transition: color 0.2s;
}

.auth-footer a:hover {
  color: var(--gold-bright);
}

.auth-legal-links {
  margin-top: 8px !important;
  opacity: 0.55;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.auth-legal-links a { color: var(--text-muted); font-size: 12px; }
.auth-legal-links a:hover { color: var(--gold); }
.auth-legal-sep { color: var(--text-muted); opacity: 0.4; font-size: 12px; }

/* ── Toggle / footer as buttons (no href="#" hash pollution) ── */
.auth-toggle-btn,
.auth-link-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
}

.auth-toggle-btn {
  color: var(--gold);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: color 0.2s;
}
.auth-toggle-btn:hover { color: var(--gold-bright); text-decoration: underline; }

.auth-link-btn {
  color: var(--gold);
  font-size: 13px;
  letter-spacing: 0.02em;
  transition: color 0.2s;
}
.auth-link-btn:hover { color: var(--gold-bright); }

/* ── Error / Success States ── */

.auth-success {
  background: rgba(109,186,133,0.08);
  border: 1px solid rgba(109,186,133,0.3);
  border-radius: 6px;
  padding: 12px;
  color: #6dba85;
  font-size: 14px;
  letter-spacing: 0.02em;
  text-align: center;
  line-height: 1.6;
}

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

.auth-error {
  background: rgba(201,112,112,0.1);
  border: 1px solid rgba(201,112,112,0.3);
  border-radius: 6px;
  padding: 12px;
  color: #c97070;
  font-size: 14px;
  letter-spacing: 0.02em;
  text-align: center;
}

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

.auth-error.success {
  background: rgba(109,186,133,0.1);
  border-color: rgba(109,186,133,0.3);
  color: #6dba85;
}

/* ── Loading State ── */

.auth-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px 20px;
}

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

.auth-loading .spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(196,164,107,0.2);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.auth-loading p {
  color: var(--text-muted);
  font-size: 14px;
  letter-spacing: 0.06em;
  margin: 0;
}

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

/* ────────────────────────────────────────── */
/* Responsive */
/* ────────────────────────────────────────── */

/* ── Demo Button ── */

.btn-demo {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(196,164,107,0.06);
  border: 1px solid var(--gold);
  border-radius: 8px;
  padding: 14px 18px;
  color: var(--gold);
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 4px;
  text-align: center;
}

.btn-demo:hover {
  background: rgba(196,164,107,0.14);
  box-shadow: 0 0 0 1px var(--gold);
}

.btn-demo-icon {
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
  opacity: 0.85;
}

.btn-demo-text {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.btn-demo-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1;
}

.btn-demo-sub {
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.04em;
  opacity: 0.7;
  text-transform: none;
  line-height: 1;
}

.btn-demo:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.auth-demo-note {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  opacity: 0.6;
  letter-spacing: 0.04em;
  margin: 6px 0 0;
}

/* ── Demo Banner (shown inside app when demo user is active) ── */

.demo-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: rgba(196,164,107,0.22);
  border-bottom: 2px solid rgba(196,164,107,0.5);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--gold);
  letter-spacing: 0.06em;
  backdrop-filter: blur(6px);
  box-shadow: 0 2px 12px rgba(196,164,107,0.15);
}

.demo-banner-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.demo-banner-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  flex-shrink: 0;
  opacity: 0.8;
  animation: demo-pulse 2s infinite;
}

@keyframes demo-pulse {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 0.3; }
}

.demo-banner-label {
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 12px;
  flex-shrink: 0;
}

.demo-banner-sep {
  opacity: 0.4;
  flex-shrink: 0;
}

.demo-banner-desc {
  opacity: 0.65;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.demo-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.demo-banner-btn {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 5px;
  padding: 5px 12px;
  transition: all 0.18s;
  line-height: 1;
}

.demo-banner-btn--story {
  background: transparent;
  border: 1px solid rgba(196,164,107,0.45);
  color: var(--gold);
}

.demo-banner-btn--story:hover {
  border-color: var(--gold);
  background: rgba(196,164,107,0.08);
}

.demo-banner-btn--signup {
  background: var(--gold);
  border: 1px solid var(--gold);
  color: #0d1117;
}

/* Push layout down when demo banner is visible */
body.demo-active {
  padding-top: 40px; /* pushes position:relative content (.app-content) down */
}

body.demo-active .sidebar {
  top: 40px !important;              /* reposition fixed sidebar */
  height: calc(100vh - 40px) !important;
}

@media (max-width: 480px) {
  /* Top-align on mobile so tall cards don't overflow off-screen without scrolling */
  .auth-layout {
    align-items: flex-start;
    padding: 24px 16px 48px;
    overflow-y: auto;
  }

  .auth-card {
    padding: 30px 20px;
  }

  .auth-title {
    font-size: 28px;
  }

  .btn-auth {
    padding: 11px 14px;
    font-size: 13px;
  }
}
