/* Alarys Auth Theme - shared for admin/vendor/client */

:root {
  --al-bg-0: #0f0a1e;
  --al-bg-1: #130d24;
  --al-surface: #221840;
  --al-surface-hover: #2d2052;
  --al-text: #ffffff;
  --al-muted: #c4b5e0;
  --al-muted-2: #8b7aad;
  --al-border: rgba(255, 255, 255, 0.1);
  --al-border-strong: rgba(168, 85, 247, 0.35);
  --al-glow: rgba(168, 85, 247, 0.4);
  --al-cyan: #22d3ee;
  --al-rose: #f472b6;
  --al-accent-1: #a855f7;
  --al-accent-2: #22d3ee;
  --al-accent-3: #f472b6;
  --al-gradient-primary: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 50%, #ec4899 100%);
  --al-gradient-hero: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #1e3a5f 100%);
  --al-shadow-glow: 0 0 24px var(--al-glow);
  --al-radius: 12px;
  --al-radius-lg: 16px;
  --al-duration-fast: 150ms;
  --al-duration-base: 240ms;
  --al-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Base (scoped to auth pages) */
body.auth,
body.auth *,
body.auth *::before,
body.auth *::after {
  box-sizing: border-box;
}

body.auth {
  min-height: 100vh;
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--al-text);
  background: var(--al-bg-1);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Background: vibrant gradient mesh + glow */
body.auth::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 10% 0%, rgba(168, 85, 247, 0.22), transparent 50%),
    radial-gradient(ellipse 60% 50% at 90% 20%, rgba(236, 72, 153, 0.18), transparent 50%),
    radial-gradient(ellipse 70% 50% at 50% 100%, rgba(34, 211, 238, 0.14), transparent 50%),
    radial-gradient(ellipse 50% 40% at 80% 80%, rgba(59, 130, 246, 0.12), transparent 50%),
    linear-gradient(180deg, var(--al-bg-0) 0%, var(--al-bg-1) 55%, #1a0a2e 100%);
  z-index: -2;
  pointer-events: none;
}

body.auth::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(168, 85, 247, 0.035) 0%, transparent 55%),
    radial-gradient(circle at 80% 80%, rgba(34, 211, 238, 0.035) 0%, transparent 55%);
  opacity: 0.7;
  z-index: -1;
  pointer-events: none;
}

/* Centering helper */
.auth-wrap,
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 64px 20px;
}

/* Login card */
.auth-card {
  width: 100%;
  max-width: 420px;
  background: linear-gradient(145deg, rgba(30, 20, 60, 0.85), rgba(40, 25, 80, 0.65));
  border: 1px solid var(--al-border);
  border-radius: var(--al-radius-lg);
  box-shadow:
    0 16px 48px rgba(0, 0, 0, 0.45),
    0 0 40px rgba(168, 85, 247, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  padding: 32px 28px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.auth-card h1,
.auth-card h2 {
  margin: 0 0 20px 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--al-text);
}

.auth-subtitle {
  margin: 0 0 20px 0;
  font-size: 0.95rem;
  color: var(--al-muted);
}

.auth-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.auth-brand-logo {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--al-text);
}

.auth-badge {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--al-border-strong);
  background: rgba(168, 85, 247, 0.2);
  color: #e9d5ff;
}

.auth-badge--vendor {
  border-color: rgba(34, 211, 238, 0.4);
  background: rgba(34, 211, 238, 0.18);
  color: #cffafe;
}

.auth-badge--client {
  border-color: rgba(244, 114, 182, 0.4);
  background: rgba(244, 114, 182, 0.18);
  color: #ffe4e6;
}

.auth-env {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--al-border);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.78rem;
  color: var(--al-muted);
  text-transform: none;
}

.auth-env-label {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.7rem;
  color: var(--al-muted-2);
}

.auth-env-value {
  font-weight: 600;
  color: var(--al-text);
}

.auth-form {
  display: block;
}

.auth-footer {
  margin-top: 18px;
  text-align: center;
  font-size: 0.9rem;
  color: var(--al-muted-2);
}

.auth-footer .auth-link {
  font-weight: 600;
}

.hidden {
  display: none !important;
}

/* Alerts */
.auth-alert {
  padding: 12px 14px;
  border-radius: var(--al-radius);
  font-size: 0.9rem;
  margin-bottom: 16px;
  border: 1px solid transparent;
}

.auth-alert--error {
  background: rgba(248, 113, 113, 0.12);
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.35);
}

.auth-alert--info {
  background: rgba(168, 85, 247, 0.12);
  color: #e9d5ff;
  border-color: rgba(168, 85, 247, 0.35);
}

.auth-alert--success {
  background: rgba(34, 197, 94, 0.12);
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.35);
}

/* Inputs */
.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.auth-label {
  font-size: 0.9rem;
  color: var(--al-muted);
}

.auth-hint {
  font-size: 0.8rem;
  color: var(--al-muted-2);
}

.token-toggle {
  font-size: 0.85rem;
  color: var(--al-muted);
  cursor: pointer;
  text-decoration: underline;
  margin-top: 6px;
}

.token-section {
  display: none;
  margin-top: 10px;
}

.token-section.show {
  display: block;
}

.auth-input,
.auth-select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--al-border);
  background: var(--al-surface);
  color: var(--al-text);
  font-size: 1rem;
  transition: border-color var(--al-duration-fast) var(--al-ease),
              box-shadow var(--al-duration-fast) var(--al-ease),
              background var(--al-duration-fast) var(--al-ease);
}

.auth-input::placeholder {
  color: var(--al-muted-2);
}

.auth-input:focus,
.auth-select:focus {
  outline: none;
  border-color: var(--al-accent-1);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.2);
  background: var(--al-surface-hover);
}

.auth-input[aria-invalid="true"] {
  border-color: rgba(248, 113, 113, 0.6);
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.2);
}

/* Buttons */
.auth-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.auth-btn {
  width: 100%;
  min-height: 44px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 0.98rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--al-duration-fast) var(--al-ease),
              box-shadow var(--al-duration-fast) var(--al-ease),
              background var(--al-duration-base) var(--al-ease);
}

.auth-btn-primary {
  color: #ffffff;
  background: var(--al-gradient-primary);
  box-shadow: 0 8px 24px rgba(168, 85, 247, 0.35);
}

.auth-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(236, 72, 153, 0.4);
}

.auth-btn-secondary {
  color: var(--al-text);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.auth-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--al-border-strong);
  box-shadow: 0 8px 20px rgba(168, 85, 247, 0.2);
}

/* Links */
.auth-link {
  color: #c084fc;
  text-decoration: none;
}

.auth-link:hover {
  color: var(--al-text);
}

/* Responsive */
@media (max-width: 640px) {
  .auth-page {
    padding: 40px 16px;
  }

  .auth-card {
    padding: 24px 18px;
    border-radius: 14px;
  }

  .auth-card h1,
  .auth-card h2 {
    font-size: 1.35rem;
  }

  .auth-btn,
  .auth-input,
  .auth-select {
    min-height: 44px;
  }

  .auth-brand {
    gap: 8px;
  }

  .auth-brand-logo {
    font-size: 1rem;
  }

  .auth-badge {
    font-size: 0.66rem;
    padding: 3px 8px;
  }

  .auth-env {
    font-size: 0.72rem;
  }
}

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

  .auth-btn-primary:hover,
  .auth-btn-secondary:hover {
    transform: none;
  }
}

/* Language switcher (auth pages) */
.lang-switch {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 4px;
  gap: 4px;
  backdrop-filter: blur(8px);
}

.lang-switch__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--al-text);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
}

.lang-switch__link.is-active {
  background: #101828;
  color: #fff;
}
