/* ============================================
   EXAMZEN — Auth pages
   Extends design system in style.css
   ============================================ */

/* ----- Auth shell ----- */
.auth-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1fr;
  background: var(--bg-base);
}

@media (min-width: 960px) {
  .auth-shell {
    grid-template-columns: minmax(420px, 1fr) 1.1fr;
  }
}

/* ----- Left panel: form ----- */
.auth-form-panel {
  display: flex;
  flex-direction: column;
  padding: var(--space-6);
  position: relative;
}

@media (min-width: 720px) {
  .auth-form-panel { padding: var(--space-10) var(--space-12); }
}

.auth-form-panel .navbar {
  position: static;
  background: transparent;
  box-shadow: none;
}

.auth-form-panel .nav-actions { gap: var(--space-3); }

.auth-form-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-form {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.auth-heading h1 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3.5vw, 2.25rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin: 0 0 var(--space-2);
}
.auth-heading p {
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}
.auth-heading .accent { color: var(--brand-primary); }

/* ----- Right panel: illustration ----- */
.auth-illustration {
  display: none;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 20%, rgba(79, 70, 229, 0.35), transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(249, 115, 22, 0.30), transparent 50%),
    linear-gradient(135deg, #312e81 0%, #1e1b4b 50%, #4c1d95 100%);
  color: white;
}
@media (min-width: 960px) {
  .auth-illustration { display: block; }
}

.auth-illustration-inner {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--space-12);
  position: relative;
  z-index: 2;
}

.auth-illustration h2 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 2.5vw, 2.4rem);
  font-weight: 700;
  line-height: 1.15;
  margin: 0 0 var(--space-4);
  letter-spacing: -0.02em;
}
.auth-illustration p {
  font-size: 1.05rem;
  line-height: 1.55;
  color: rgba(255,255,255,0.85);
  max-width: 38ch;
  margin: 0;
}

.auth-quote {
  border-left: 3px solid var(--brand-accent);
  padding-left: var(--space-4);
  font-size: 0.95rem;
  color: rgba(255,255,255,0.75);
  max-width: 36ch;
}
.auth-quote strong { color: white; font-weight: 600; }

.auth-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
  margin-top: var(--space-8);
}
.auth-stat .v {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: white;
  letter-spacing: -0.02em;
  display: block;
}
.auth-stat .l {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.65);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Decorative shapes */
.auth-shape {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.5;
  pointer-events: none;
}
.auth-shape-1 { width: 280px; height: 280px; background: var(--brand-accent); top: -80px; right: -60px; }
.auth-shape-2 { width: 320px; height: 320px; background: var(--brand-primary); bottom: -100px; left: -80px; opacity: 0.4; }

/* ----- Form fields ----- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}
.field-row {
  position: relative;
}
.field-row .input {
  padding-right: 44px;
}
.input {
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-surface);
  color: var(--text-primary);
  transition: border-color var(--duration) var(--ease-out),
              box-shadow var(--duration) var(--ease-out),
              background-color var(--duration) var(--ease-out);
  outline: none;
  -webkit-appearance: none;
}
.input::placeholder { color: var(--text-muted); }
.input:hover { border-color: var(--border-strong); }
.input:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12);
  background: var(--bg-elevated);
}
.input[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.10);
}
.input[disabled] { opacity: 0.6; cursor: not-allowed; }

.input-affix {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 0;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color var(--duration) var(--ease-out), background-color var(--duration) var(--ease-out);
}
.input-affix:hover { color: var(--text-primary); background: var(--bg-muted); }
.input-affix:focus-visible { outline: 2px solid var(--brand-primary); outline-offset: 2px; }

.field-help {
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.field-error {
  font-size: 0.8rem;
  color: var(--danger);
  display: none;
}
.field[data-error="true"] .field-error { display: block; }

/* ----- Password strength ----- */
.pwd-strength {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}
.pwd-strength span {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: var(--radius-full);
  transition: background-color var(--duration) var(--ease-out);
}
.pwd-strength[data-score="1"] span:nth-child(-n+1) { background: var(--danger); }
.pwd-strength[data-score="2"] span:nth-child(-n+2) { background: var(--warning); }
.pwd-strength[data-score="3"] span:nth-child(-n+3) { background: var(--info); }
.pwd-strength[data-score="4"] span:nth-child(-n+4) { background: var(--success); }

.pwd-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ----- Form options row ----- */
.form-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  font-size: 0.85rem;
}
.form-options label { display: inline-flex; align-items: center; gap: 8px; color: var(--text-secondary); cursor: pointer; }
.form-options input[type="checkbox"] { accent-color: var(--brand-primary); width: 16px; height: 16px; cursor: pointer; }
.form-options a { color: var(--brand-primary); text-decoration: none; font-weight: 500; }
.form-options a:hover { text-decoration: underline; }

/* ----- Submit button ----- */
.btn-submit {
  width: 100%;
  padding: 13px 18px;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: white;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-primary-dark));
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform var(--duration) var(--ease-out), box-shadow var(--duration) var(--ease-out), opacity var(--duration) var(--ease-out);
  box-shadow: 0 6px 20px -8px rgba(79, 70, 229, 0.5);
}
.btn-submit:hover { transform: translateY(-1px); box-shadow: 0 10px 25px -8px rgba(79, 70, 229, 0.6); }
.btn-submit:active { transform: translateY(0); }
.btn-submit[disabled] { opacity: 0.7; cursor: not-allowed; transform: none; }
.btn-submit .spinner { display: none; }
.btn-submit[data-loading="true"] .spinner { display: inline-block; }
.btn-submit[data-loading="true"] .label { opacity: 0.6; }
.btn-submit[data-loading="true"] { pointer-events: none; }

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ----- Divider ----- */
.divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ----- Social auth (UI only — wire up in Phase 8) ----- */
.social-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}
.social-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color var(--duration) var(--ease-out), background-color var(--duration) var(--ease-out);
}
.social-btn:hover { border-color: var(--border-strong); background: var(--bg-muted); }
.social-btn svg { flex-shrink: 0; }

/* ----- Footer line ----- */
.auth-foot {
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.auth-foot a { color: var(--brand-primary); font-weight: 600; text-decoration: none; }
.auth-foot a:hover { text-decoration: underline; }

/* ----- Banner / alert ----- */
.auth-alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  display: none;
  align-items: flex-start;
  gap: 8px;
  border: 1px solid;
}
.auth-alert[data-show="true"] { display: flex; }
.auth-alert[data-kind="error"] { color: var(--danger); background: rgba(239, 68, 68, 0.08); border-color: rgba(239, 68, 68, 0.25); }
.auth-alert[data-kind="success"] { color: var(--success); background: rgba(16, 185, 129, 0.08); border-color: rgba(16, 185, 129, 0.25); }
.auth-alert[data-kind="info"] { color: var(--info); background: rgba(59, 130, 246, 0.08); border-color: rgba(59, 130, 246, 0.25); }
.auth-alert svg { flex-shrink: 0; margin-top: 1px; }

/* ----- Profile / dashboard styles ----- */
.profile-shell {
  min-height: 100vh;
  background: var(--bg-base);
  padding-top: 84px;
  padding-bottom: var(--space-12);
}

.profile-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--space-5);
  align-items: center;
  padding: var(--space-6);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-6);
}
@media (max-width: 640px) {
  .profile-header { grid-template-columns: 1fr; text-align: center; justify-items: center; }
}

.avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  text-transform: uppercase;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.profile-meta h1 {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 2.5vw, 1.75rem);
  margin: 0 0 4px;
  color: var(--text-primary);
}
.profile-meta .email { color: var(--text-secondary); font-size: 0.9rem; margin: 0 0 6px; }
.tier-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.tier-badge[data-tier="free"] { background: var(--bg-muted); color: var(--text-secondary); }
.tier-badge[data-tier="premium"] { background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent)); color: white; }
.tier-badge[data-tier="coaching"] { background: var(--brand-gold); color: white; }

.profile-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-5);
}
@media (min-width: 768px) {
  .profile-grid { grid-template-columns: 1fr 1fr; }
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
}
.card h2 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin: 0 0 var(--space-4);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--space-3);
}
.stat {
  padding: var(--space-4);
  background: var(--bg-muted);
  border-radius: var(--radius);
  text-align: center;
}
.stat .v {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  display: block;
  letter-spacing: -0.02em;
}
.stat .l {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.attempt-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.attempt-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-muted);
  border-radius: var(--radius);
  font-size: 0.9rem;
}
.attempt-item .exam { font-weight: 600; color: var(--text-primary); }
.attempt-item .date { color: var(--text-muted); font-size: 0.8rem; }
.attempt-item .score {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--brand-primary);
  font-size: 0.85rem;
}
.attempt-empty {
  text-align: center;
  padding: var(--space-8);
  color: var(--text-muted);
  font-size: 0.9rem;
}
.attempt-empty .ico {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--bg-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-3);
  color: var(--text-muted);
}

/* ----- Loading skeleton ----- */
.skeleton {
  background: linear-gradient(90deg, var(--bg-muted) 0%, var(--bg-elevated) 50%, var(--bg-muted) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

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