/* ?? Auth Pages ? Human-Centered Design System v3 ??
   Principles:
   - No Material Symbols: custom inline SVG icons
   - Deep claymorphism with layered depth (clay-card-depth, clay-btn-depth)
   - Human microcopy, sentence case, no ? arrows on buttons
   - No role selection (handled internally from DB)
   - One memorable visual per page, rest quiet
   - Motion answers action, never decoration
   ??????????????????????????????????????????????????? */

.auth-page {
  min-height: 100vh;
  background: var(--bg);
}

/* Container: split on desktop, stacked on mobile */
.auth-container {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100vh;
}

/* Visual side ? hidden on mobile, shown on desktop */
.auth-visual {
  display: none;
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, var(--bg) 0%, var(--bg-secondary) 100%);
}

.auth-visual::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 30%, rgba(92, 98, 252, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 70%, rgba(157, 80, 255, 0.06) 0%, transparent 50%);
  pointer-events: none;
}

.auth-visual-inner {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--space-12) var(--space-8);
}

.auth-illustration {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-8);
}

.illustration-svg {
  width: 180px;
  height: 180px;
  filter: drop-shadow(0 20px 40px rgba(92, 98, 252, 0.15));
  animation: floatGentle 6s ease-in-out infinite;
}

@keyframes floatGentle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.auth-visual-copy {
  text-align: center;
  margin-bottom: var(--space-10);
}

.auth-visual-copy h1 {
  font-family: var(--font-display);
  font-size: clamp(var(--text-2xl), 4vw, var(--text-3xl));
  font-weight: 500;
  line-height: 1.2;
  color: var(--text-main);
  margin-bottom: var(--space-3);
}

.auth-visual-copy h1 em {
  font-style: italic;
  color: var(--accent-2);
  font-weight: 400;
}

.auth-visual-copy p {
  font-size: var(--text-base);
  color: var(--text-dim);
  max-width: 320px;
  margin: 0 auto;
  line-height: 1.6;
}

/* Trust badges on visual side */
.auth-visual-trust {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  align-items: center;
  padding-top: var(--space-6);
  border-top: 1px solid var(--border);
}

.auth-visual-trust li {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-dim);
}

.trust-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--accent);
  opacity: 0.8;
}

/* Form wrapper */
.auth-form-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-10) var(--space-6);
  background: var(--bg);
  min-height: 100vh;
}

/* Card with depth */
.auth-card {
  width: 100%;
  max-width: 420px;
}

.clay-card-depth {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.3),
    0 8px 24px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.03),
    inset 0 -1px 0 rgba(0, 0, 0, 0.2);
  padding: var(--space-8);
  position: relative;
}

.clay-card-depth::before {
  content: '';
  position: absolute;
  top: 0;
  left: var(--space-6);
  right: var(--space-6);
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(92, 98, 252, 0.3), transparent);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

/* Header */
.auth-header {
  text-align: center;
  margin-bottom: var(--space-7);
}

.auth-header h2 {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 500;
  color: var(--text-main);
  margin-bottom: var(--space-2);
  letter-spacing: -0.01em;
}

.auth-header p {
  color: var(--text-dim);
  font-size: var(--text-sm);
  line-height: 1.5;
}

/* Form */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.form-label {
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  color: var(--text-main);
}

.form-input,
.password-wrapper .form-input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--text-main);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
  box-sizing: border-box;
}

.form-input:hover {
  border-color: var(--border-strong);
  background: var(--surface-3);
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow:
    0 0 0 3px var(--accent-light),
    0 2px 8px rgba(92, 98, 252, 0.15);
}

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

.form-input.error {
  border-color: var(--danger, #ef4444);
  background: rgba(239, 68, 68, 0.05);
}

.form-input.error:focus {
  box-shadow:
    0 0 0 3px rgba(239, 68, 68, 0.15),
    0 2px 8px rgba(239, 68, 68, 0.1);
}

/* Hint text */
.form-hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin: 0;
  line-height: 1.4;
}

.form-hint .text-link {
  color: var(--accent);
  font-weight: var(--fw-medium);
}

.form-hint .text-link:hover {
  text-decoration: underline;
}

/* Password wrapper */
.password-wrapper {
  position: relative;
}

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

.password-toggle {
  position: absolute;
  right: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: var(--space-1);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast);
  border-radius: var(--radius-sm);
}

.password-toggle:hover {
  color: var(--text-main);
  background: var(--surface-3);
}

.password-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.password-toggle .icon-eye,
.password-toggle .icon-eye-off {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.password-toggle[aria-pressed="true"] .icon-eye {
  display: none;
}

.password-toggle[aria-pressed="true"] .icon-eye-off {
  display: block;
}

.password-toggle .icon-eye-off {
  display: none;
}

/* Checkbox */
.checkbox-wrapper {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--text-dim);
  user-select: none;
}

.checkbox-wrapper input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  flex-shrink: 0;
  cursor: pointer;
}

/* Form options row */
.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--text-sm);
}

.form-options .text-link {
  color: var(--accent);
  font-weight: var(--fw-medium);
}

.form-options .text-link:hover {
  text-decoration: underline;
}

/* Button depth variant */
.clay-btn-depth {
  position: relative;
  background: var(--accent-gradient);
  border: none;
  box-shadow:
    0 2px 8px rgba(92, 98, 252, 0.3),
    0 8px 20px rgba(92, 98, 252, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.clay-btn-depth:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow:
    0 4px 12px rgba(92, 98, 252, 0.4),
    0 12px 28px rgba(92, 98, 252, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  background: var(--accent-gradient-hover);
}

.clay-btn-depth:active:not(:disabled) {
  transform: translateY(0);
  box-shadow:
    0 1px 4px rgba(92, 98, 252, 0.3),
    inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.clay-btn-depth:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.clay-btn-depth:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-block {
  width: 100%;
}

.btn-primary.btn-lg {
  padding: var(--space-4) var(--space-6);
  font-size: var(--text-base);
  font-weight: var(--fw-semibold);
}

.btn-loader {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.btn-loader .spin {
  width: 20px;
  height: 20px;
  animation: spin 1s linear infinite;
}

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

.btn-text.hidden {
  display: none;
}

/* Footer link */
.auth-footer {
  text-align: center;
  margin-top: var(--space-6);
  font-size: var(--text-sm);
  color: var(--text-dim);
}

.auth-footer .text-link {
  font-weight: var(--fw-medium);
  color: var(--accent);
}

.auth-footer .text-link:hover {
  text-decoration: underline;
}

/* Messages */
.form-message {
  min-height: 1.5em;
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  text-align: center;
  transition: opacity var(--transition-fast), color var(--transition-fast);
}

.form-message.error {
  color: var(--danger, #ef4444);
}

.form-message.success {
  color: var(--success);
}

/* Inline trust badges */
.auth-trust {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-4);
  margin-top: var(--space-7);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border);
  font-size: var(--text-xs);
  color: var(--text-dim);
  line-height: 1.5;
}

.trust-icon-inline {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  vertical-align: middle;
  margin-right: var(--space-1);
  color: var(--accent);
  opacity: 0.8;
}

/* Desktop: show visual side */
@media (min-width: 769px) {
  .auth-container {
    grid-template-columns: 1fr 1fr;
  }
  .auth-visual {
    display: flex;
  }
  .auth-form-wrapper {
    min-height: 100vh;
  }
  .auth-visual-inner {
    padding: var(--space-16) var(--space-10);
  }
  .illustration-svg {
    width: 220px;
    height: 220px;
  }
  .auth-visual-copy h1 {
    font-size: var(--text-3xl);
  }
}

/* Tablet */
@media (max-width: 768px) {
  .auth-form-wrapper {
    padding: var(--space-8) var(--space-4);
  }
  .auth-card {
    padding: var(--space-6);
  }
  .clay-card-depth {
    padding: var(--space-6);
  }
  .auth-header h2 {
    font-size: var(--text-xl);
  }
}

/* Small mobile */
@media (max-width: 380px) {
  .auth-form-wrapper {
    padding: var(--space-6) var(--space-3);
  }
  .auth-card {
    padding: var(--space-5);
  }
  .clay-card-depth {
    padding: var(--space-5);
  }
  .auth-visual-copy h1 {
    font-size: var(--text-xl);
  }
  .auth-visual-copy p {
    font-size: var(--text-sm);
  }
  .illustration-svg {
    width: 140px;
    height: 140px;
  }
  .form-options {
    flex-direction: column;
    gap: var(--space-3);
    align-items: flex-start;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .illustration-svg {
    animation: none;
  }
  .clay-btn-depth,
  .form-input,
  .password-toggle {
    transition: none;
  }
}
