@import './variables.css';
@import './base.css';
@import './typography.css';
@import './buttons.css';
@import './layout.css';
@import './header.css';
@import './order-portal.css';

.auth-page.order-portal {
  min-height: 100vh;
  background:
    radial-gradient(ellipse 100% 70% at 0% 0%, rgba(129, 140, 248, 0.3), transparent 50%),
    radial-gradient(ellipse 80% 60% at 100% 20%, rgba(56, 189, 248, 0.25), transparent 45%),
    linear-gradient(165deg, var(--portal-bg), var(--portal-bg-2));
  color: var(--portal-text);
}

.auth-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.auth-bg__orb {
  position: absolute;
  width: min(75vmin, 520px);
  height: min(75vmin, 520px);
  border-radius: 9999px;
  filter: blur(56px);
  opacity: 0.5;
  animation: orbFloat 6s ease-in-out infinite;
  will-change: transform;
}

@media (max-width: 768px) {
  .auth-bg__orb {
    filter: blur(56px);
    opacity: 0.5;
    animation-duration: 8s;
  }
}

.auth-bg__orb--a {
  left: -15vmin;
  top: -12vmin;
  background: radial-gradient(circle, rgba(129, 140, 248, 0.5), transparent 65%);
}

.auth-bg__orb--b {
  right: -18vmin;
  bottom: -15vmin;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.45), transparent 65%);
  animation-delay: -2.5s;
}

.auth-bg__grid {
  position: absolute;
  inset: 0;
  opacity: 0.4;
  background:
    radial-gradient(circle at 20% 40%, rgba(255, 255, 255, 0.6), transparent 45%),
    repeating-linear-gradient(90deg, rgba(99, 102, 241, 0.04) 0 1px, transparent 1px 56px),
    repeating-linear-gradient(0deg, rgba(99, 102, 241, 0.04) 0 1px, transparent 1px 56px);
}

.auth-bg__noise {
  display: none;
}

.auth-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: calc(var(--portal-header-offset) + 1rem) 1rem 3rem;
}

.auth-card {
  width: min(520px, 100%);
  border-radius: var(--portal-radius);
  padding: clamp(1.5rem, 4vw, 2rem) clamp(1.25rem, 3vw, 1.75rem);
  background: var(--portal-surface);
  border: 1px solid var(--portal-border);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  box-shadow: var(--portal-shadow-lg);
  position: relative;
  transform: translate3d(0, 16px, 0);
  opacity: 0;
  animation: portalCardIn 0.65s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.auth-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(14, 165, 233, 0.04));
  pointer-events: none;
}

.auth-headline {
  display: grid;
  gap: 0.45rem;
  margin-bottom: 1.35rem;
  position: relative;
  z-index: 1;
}

.auth-kicker {
  font-size: 0.7rem;
  color: var(--portal-accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.auth-title {
  font-size: clamp(1.5rem, 5vw, 2rem);
  letter-spacing: -0.03em;
  font-weight: 700;
  color: var(--portal-text);
}

.auth-subtitle {
  color: var(--portal-text-muted);
  font-size: 0.9375rem;
  line-height: 1.5;
}

.auth-form {
  display: grid;
  gap: 0.95rem;
  position: relative;
  z-index: 1;
}

.field {
  display: grid;
  gap: 0.4rem;
}

.field__label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--portal-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.auth-page.order-portal .input {
  width: 100%;
  padding: 0.95rem 1rem;
  border-radius: var(--portal-radius-sm);
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--portal-border-soft);
  color: var(--portal-text);
  outline: none;
  min-height: var(--portal-touch);
  font-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.auth-page.order-portal .input:focus {
  border-color: var(--portal-accent-light);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
  transform: translateY(-1px);
}

.auth-page.order-portal .input::placeholder {
  color: #94a3b8;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.65rem;
  align-items: end;
}

.captcha {
  display: flex;
  align-items: center;
  gap: 8px;
}

.captcha__box {
  height: 46px;
  width: 132px;
  border-radius: var(--portal-radius-sm);
  border: 1px solid var(--portal-border-soft);
  background: #f1f5f9;
  overflow: hidden;
}

.captcha__refresh {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #fff;
  border: 1px solid var(--portal-border-soft);
  color: var(--portal-accent);
  font-size: 1.1rem;
  transition: transform 0.25s ease, box-shadow 0.2s ease;
}

.captcha__refresh:hover {
  transform: rotate(90deg);
  box-shadow: var(--portal-shadow);
}

.auth-actions {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.btn-auth {
  width: 100%;
  border-radius: var(--portal-radius-sm);
  padding: 1rem 1.1rem;
  font-size: 0.95rem;
  font-weight: 600;
  min-height: var(--portal-touch);
  background: linear-gradient(135deg, var(--portal-accent), var(--portal-accent-2));
  color: #fff;
  border: none;
  box-shadow: 0 10px 24px rgba(99, 102, 241, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-auth:hover {
  box-shadow: 0 14px 28px rgba(99, 102, 241, 0.4);
  transform: translateY(-1px);
}

.btn-auth:active {
  transform: scale(0.98);
}

.auth-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.15rem;
  gap: 1rem;
  flex-wrap: wrap;
  color: var(--portal-text-muted);
  font-size: 0.875rem;
}

.auth-link,
.auth-link-btn {
  color: var(--portal-accent);
  font-weight: 600;
  transition: opacity 0.2s ease;
}

.auth-link:hover,
.auth-link-btn:hover {
  opacity: 0.8;
}

.auth-alert {
  border-radius: var(--portal-radius-sm);
  padding: 0.9rem 1rem;
  border: 1px solid var(--portal-border-soft);
  background: rgba(255, 255, 255, 0.9);
  color: var(--portal-text);
  font-size: 0.9rem;
  display: none;
}

.auth-alert.is-visible {
  display: block;
  animation: alertIn 0.24s ease-out both;
}

.auth-alert.is-error {
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(254, 226, 226, 0.5);
  color: #b91c1c;
}

.auth-alert.is-success {
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(209, 250, 229, 0.5);
  color: #047857;
}

.support-actions {
  display: none;
  margin-top: 0.75rem;
}

.support-actions.is-visible {
  display: grid;
  animation: alertIn 0.24s ease-out both;
}

.support-btn {
  width: 100%;
  border-radius: var(--portal-radius-sm);
  padding: 0.95rem;
  min-height: var(--portal-touch);
}

.auth-divider {
  height: 1px;
  background: var(--portal-border-soft);
  margin: 1.25rem 0 0.9rem;
}

.auth-footnote {
  color: var(--portal-text-muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

@keyframes alertIn {
  from {
    transform: translate3d(0, -6px, 0);
    opacity: 0;
  }
  to {
    transform: translate3d(0, 0, 0);
    opacity: 1;
  }
}

@keyframes orbFloat {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(0, -14px, 0) scale(1.02); }
}

@media (prefers-reduced-motion: reduce) {
  .auth-bg__orb,
  .auth-card {
    animation: none;
    opacity: 1;
    transform: none;
  }
}
