/* Auth page — full-page centered layout */
.auth-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--color-bg, #FCF6F2);
  padding: var(--space-4, 1rem);
  /* Safe area untuk notch/status bar */
  padding-top: max(var(--space-4, 1rem), env(safe-area-inset-top));
  padding-bottom: max(var(--space-4, 1rem), env(safe-area-inset-bottom));
  padding-left: max(var(--space-4, 1rem), env(safe-area-inset-left));
  padding-right: max(var(--space-4, 1rem), env(safe-area-inset-right));
  font-family: 'Poppins', sans-serif;
}

.auth-card {
  background: white;
  border-radius: var(--radius-xl, 1rem);
  box-shadow: var(--shadow-md, 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06));
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 440px;
}

.auth-header { 
  text-align: center; 
  margin-bottom: 2rem; 
}
.auth-header__title { 
  font-size: 1.75rem; 
  font-weight: 700; 
  color: var(--color-text, #1E1E1E); 
  margin: 0;
}
.auth-header__logo { 
  font-size: 1.5rem; 
  margin-top: 0.5rem; 
  color: var(--color-primary, #841622); 
  font-weight: 600; 
}
.auth-header__subtitle { 
  font-size: 0.875rem; 
  color: var(--color-border, #3E2723); 
  margin-top: 0.5rem; 
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.auth-input-group {
  display: flex;
  flex-direction: column;
  position: relative;
  gap: 0.25rem;
}

.auth-input-group__label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-border, #3E2723);
}

.auth-input-group__input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid #E5E7EB;
  border-radius: var(--radius-md, 0.5rem);
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.auth-input-group__input:focus {
  outline: none;
  border-color: var(--color-primary, #841622);
  box-shadow: 0 0 0 3px rgba(132, 22, 34, 0.1);
}

.auth-input-group__input.has-error {
  border-color: var(--color-accent, #BD1413);
}

.auth-input-group__toggle {
  position: absolute;
  right: 1rem;
  top: 1.95rem; /* adjust based on label */
  background: none;
  border: none;
  color: var(--color-border, #3E2723);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-input-group__error {
  font-size: 0.75rem;
  color: var(--color-accent, #BD1413);
  margin-top: 0.25rem;
  display: none;
}

.auth-btn {
  width: 100%;
  padding: 0.875rem 1.5rem;
  background-color: var(--color-primary, #841622);
  color: white;
  border: none;
  border-radius: var(--radius-md, 0.5rem);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: inherit;
}

.auth-btn:hover {
  background-color: var(--color-accent, #BD1413);
}

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

.auth-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.auth-btn--loading::after {
  content: "";
  width: 1rem;
  height: 1rem;
  border: 2px solid white;
  border-top-color: transparent;
  border-radius: 50%;
  animation: auth-spin 0.8s linear infinite;
  margin-left: 0.5rem;
}

@keyframes auth-spin {
  to { transform: rotate(360deg); }
}

.auth-link {
  color: var(--color-accent, #BD1413);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.875rem;
  transition: opacity 0.2s;
}

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

.auth-footer-text {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.875rem;
  color: var(--color-border, #3E2723);
}

.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 1.5rem 0;
  color: #9CA3AF;
  font-size: 0.875rem;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid #E5E7EB;
}

.auth-divider:not(:empty)::before {
  margin-right: 0.5rem;
}
.auth-divider:not(:empty)::after {
  margin-left: 0.5rem;
}

.auth-message {
  padding: 1rem;
  border-radius: var(--radius-md, 0.5rem);
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
  display: none;
}
.auth-message.success {
  background-color: #DEF7EC;
  color: #03543F;
  border: 1px solid #84E1BC;
  display: block;
}
.auth-message.error {
  background-color: #FDE8E8;
  color: #9B1C1C;
  border: 1px solid #F8B4B4;
  display: block;
}

.auth-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--color-border, #3E2723);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  margin-top: 1.5rem;
  transition: color 0.2s;
}
.auth-back-link:hover {
  color: var(--color-primary, #841622);
}

.auth-btn-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #6b5c54;
  background: #ffffff;
  border: 1px solid rgba(62, 39, 35, 0.08);
  padding: 8px 16px;
  border-radius: 9999px;
  text-decoration: none;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  margin-bottom: 1.25rem;
  box-shadow: 0 4px 14px rgba(62, 39, 35, 0.04);
}

.auth-btn-back:hover {
  background: #ffffff;
  color: #841622;
  transform: translateX(-4px);
  box-shadow: 0 6px 18px rgba(132, 22, 34, 0.12);
  border-color: rgba(132, 22, 34, 0.25);
}

.auth-page__footer {
  margin-top: 2rem;
  text-align: center;
  font-size: 0.875rem;
  color: #9CA3AF;
}

/* ============================================================
 *  Mobile Smartphone Responsive Tweaks (Max-Width: 480px)
 * ============================================================ */
@media (max-width: 480px) {
  .auth-page {
    padding: 1.5rem 1rem 2.5rem;
    justify-content: center;
  }
  .auth-card {
    padding: 1.75rem 1.25rem;
    border-radius: 18px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  }
  .auth-header {
    margin-bottom: 1.5rem;
  }
  .auth-header__title {
    font-size: 1.45rem;
  }
  .auth-header__subtitle {
    font-size: 0.8125rem;
  }
  .auth-input-group__input {
    font-size: 16px; /* Prevents auto-zoom on iOS */
    padding: 0.75rem 0.875rem;
  }
  .auth-btn {
    padding: 0.8rem 1.25rem;
    font-size: 0.9375rem;
  }
}

/* ── Auth Pages Dark Mode ─────────────────────────────────── */
[data-theme="dark"] .auth-page {
  background-color: #161311;
  color: #f4eee9;
}

[data-theme="dark"] .auth-btn-back {
  background-color: #241d1a;
  border-color: #3d322d;
  color: #f4eee9;
}

[data-theme="dark"] .auth-btn-back:hover {
  background-color: #2c231f;
  color: #f38ba8;
}

[data-theme="dark"] .auth-card {
  background-color: #241d1a;
  border-color: #3d322d;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] .auth-header__title {
  color: #f4eee9;
}

[data-theme="dark"] .auth-header__subtitle {
  color: #baa89e;
}

[data-theme="dark"] .auth-input-group__label {
  color: #cfbfb5;
}

[data-theme="dark"] .auth-input-group__input {
  background-color: #1c1715;
  border-color: #423530;
  color: #f4eee9;
}

[data-theme="dark"] .auth-input-group__input:focus {
  border-color: #a82433;
  box-shadow: 0 0 0 3px rgba(168, 36, 51, 0.25);
}

[data-theme="dark"] .auth-footer {
  color: #baa89e;
}

/* ─────────────────────────────────────────────────────────
 *  HP Sangat Kecil < 380px (iPhone SE, Galaxy A kecil)
 * ───────────────────────────────────────────────────────── */
@media (max-width: 380px) {
  .auth-card {
    padding: 1.5rem 1rem;
    border-radius: 16px;
  }

  .auth-header__title {
    font-size: 1.35rem;
  }

  .auth-header__logo {
    font-size: 1.25rem;
  }

  .auth-btn {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
  }

  .auth-btn-back {
    font-size: 0.75rem;
    padding: 6px 12px;
  }
}
