@import url("../tokens.css");

.auth-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    max(24px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
  background: linear-gradient(180deg, var(--color-primary) 0%, var(--color-bg) 320px);
}

.auth-shell {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ---- Mobile brand header ---- */
.auth-brand-mobile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
  color: #fff;
  text-align: center;
}
.auth-brand-mobile img,
.auth-side img {
  width: 72px; height: 72px; border-radius: var(--radius-md);
  background: #fff; object-fit: contain; padding: 6px;
  animation: floatLogo 4s ease-in-out infinite;
}
.auth-brand-mobile h1 { margin: 0; font-size: clamp(1.1rem, 4vw, 1.4rem); }
.auth-brand-mobile p { margin: 0; opacity: .85; font-size: .9rem; }

/* ---- Desktop side panel (hidden on mobile) ---- */
.auth-side { display: none; }
.auth-points { list-style: none; padding: 0; margin: var(--space-4) 0 0; display: flex; flex-direction: column; gap: var(--space-3); font-size: .95rem; }
.auth-points li { display: flex; align-items: center; gap: var(--space-3); }
.auth-points li::before {
  content: "✓"; display: inline-flex; width: 22px; height: 22px; flex-shrink: 0;
  align-items: center; justify-content: center; border-radius: 999px;
  background: rgba(255,255,255,.22); font-size: .75rem;
}

/* ---- Card ---- */
.auth-card {
  width: 100%;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-6) var(--space-4);
  animation: authFadeUp .5s ease both;
}
.auth-card h2 {
  margin: 0 0 var(--space-4);
  font-size: clamp(1.05rem, 2.5vw, 1.3rem);
  color: var(--color-text);
  text-align: center;
}

.field { margin-bottom: var(--space-4); }
.field label { display: block; font-size: .85rem; color: var(--color-muted); margin-bottom: var(--space-1); }
.field input {
  width: 100%; min-height: 46px; padding: 0 var(--space-3);
  border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  font-size: 1rem; background: var(--color-bg); color: var(--color-text);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.field input:focus {
  outline: none; border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(79,70,229,.15);
}

.auth-error {
  background: #FEF2F2; color: var(--color-danger); border: 1px solid #FCA5A5;
  border-radius: var(--radius-sm); padding: var(--space-2) var(--space-3);
  font-size: .85rem; margin-bottom: var(--space-4); display: none;
}
.auth-error.show { display: block; animation: authFadeUp .3s ease both; }

.checkbox-field label {
  display: flex; align-items: center; gap: var(--space-2);
  font-size: .85rem; color: var(--color-muted); line-height: 1.4;
}
.checkbox-field input[type="checkbox"] {
  width: 18px; height: 18px; flex-shrink: 0; margin: 0;
  accent-color: var(--color-primary);
}
.checkbox-field a { font-weight: 600; }

.auth-submit { width: 100%; margin-top: var(--space-2); }
.auth-switch { text-align: center; margin-top: var(--space-4); font-size: .9rem; color: var(--color-muted); }
.auth-switch a { font-weight: 600; }

/* ---- Buttons: hover / press feel ---- */
.btn { box-shadow: 0 1px 2px rgba(15,23,42,.08); }
.btn:not(:disabled):hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(79,70,229,.28); }
.btn:not(:disabled):active { transform: translateY(0) scale(.98); box-shadow: none; }

/* ---- Animations ---- */
@keyframes authFadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes floatLogo {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
@media (prefers-reduced-motion: reduce) {
  .auth-card, .auth-error.show, .auth-brand-mobile img, .auth-side img { animation: none; }
}

/* ---- Tablet / small desktop ---- */
@media (min-width: 640px) {
  .auth-shell { max-width: 440px; }
}

/* ---- Desktop / large tablet: split-screen layout ---- */
@media (min-width: 900px) {
  .auth-page { background: linear-gradient(135deg, var(--color-primary), var(--color-accent)); }

  .auth-shell {
    max-width: 960px;
    flex-direction: row;
    align-items: stretch;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
  }

  .auth-brand-mobile { display: none; }

  .auth-side {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1 1 44%;
    padding: var(--space-8);
    color: #fff;
    background: linear-gradient(160deg, var(--color-primary), var(--color-accent));
  }
  .auth-side h1 { margin: var(--space-4) 0 var(--space-1); font-size: 1.6rem; }
  .auth-side p { margin: 0; opacity: .9; }

  .auth-main {
    flex: 1 1 56%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-8);
  }
  .auth-card { box-shadow: none; max-width: 360px; animation: none; }
}

/* ---- Big screens / TV ---- */
@media (min-width: 1440px) {
  .auth-shell { max-width: 1080px; }
  .auth-side { padding: var(--space-8) calc(var(--space-8) + 16px); }
}

