@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

*,
*::before,
*::after {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

/* —— Tema terang (default) —— */
html[data-theme="light"] {
  color-scheme: light;
  --auth-bg-solid: #e8f0fe;
  --auth-surface: #ffffff;
  --auth-border: #e2e8f0;
  --auth-text: #0f172a;
  --auth-muted: #64748b;
  --auth-accent: #1e40af;
  --auth-accent-hover: #1d4ed8;
  --auth-input-bg: #f8fafc;
  --auth-input-bg-focus: #ffffff;
  --auth-focus-ring: rgba(30, 64, 175, 0.2);
  --auth-label-float-bg: #ffffff;
  --auth-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 14px 36px rgba(15, 23, 42, 0.09);
  --auth-visual-panel: linear-gradient(160deg, #f8fafc 0%, #eef2ff 55%, #e0f2fe 100%);
  --auth-toggle-bg: rgba(255, 255, 255, 0.85);
  --auth-toggle-border: rgba(226, 232, 240, 0.95);
  --auth-toggle-color: #475569;
  --auth-otp-dev: #0c5460;
  --auth-password-toggle-hover: rgba(30, 64, 175, 0.06);
}

/* —— Tema malam (night) —— */
html[data-theme="dark"] {
  color-scheme: dark;
  --auth-bg-solid: #0b1120;
  --auth-surface: #1e293b;
  --auth-border: #334155;
  --auth-text: #f1f5f9;
  --auth-muted: #94a3b8;
  --auth-accent: #60a5fa;
  --auth-accent-hover: #93c5fd;
  --auth-input-bg: #0f172a;
  --auth-input-bg-focus: #1e293b;
  --auth-focus-ring: rgba(96, 165, 250, 0.25);
  --auth-label-float-bg: #1e293b;
  --auth-shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 16px 40px rgba(0, 0, 0, 0.45);
  --auth-visual-panel: linear-gradient(160deg, #1e293b 0%, #312e81 50%, #1e3a5f 100%);
  --auth-toggle-bg: rgba(30, 41, 59, 0.92);
  --auth-toggle-border: rgba(51, 65, 85, 0.95);
  --auth-toggle-color: #cbd5e1;
  --auth-otp-dev: #7dd3fc;
  --auth-password-toggle-hover: rgba(96, 165, 250, 0.12);
}

html[data-theme="light"],
html[data-theme="dark"] {
  --auth-radius: 12px;
  --auth-radius-sm: 10px;
  --auth-fs-title: 1.125rem;
  --auth-fs-lead: 0.8125rem;
  --auth-fs-input: 0.875rem;
  --auth-input-h: 40px;
  --auth-btn-h: 40px;
  --auth-space: 0.75rem;
}

body,
input,
button {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
}

body {
  color: var(--auth-text);
  background: var(--auth-bg-solid);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* —— Halaman login: gradien warna tetap terlihat (light & dark) —— */
.auth-page {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(0.75rem, 3vw, 1.25rem);
  padding-top: clamp(2.15rem, 5vw, 2.65rem);
  background:
    radial-gradient(ellipse 95% 75% at 100% 0%, rgba(167, 139, 250, 0.42), transparent 52%),
    radial-gradient(ellipse 85% 65% at 0% 100%, rgba(56, 189, 248, 0.35), transparent 48%),
    radial-gradient(ellipse 55% 45% at 40% 35%, rgba(199, 210, 254, 0.3), transparent 55%),
    linear-gradient(155deg, #eef2ff 0%, #e0f2fe 38%, #f0f9ff 72%, #f5f3ff 100%);
}

html[data-theme="dark"] .auth-page {
  background:
    radial-gradient(ellipse 90% 70% at 95% 5%, rgba(99, 102, 241, 0.35), transparent 50%),
    radial-gradient(ellipse 80% 60% at 5% 95%, rgba(14, 165, 233, 0.18), transparent 48%),
    radial-gradient(ellipse 50% 40% at 50% 40%, rgba(79, 70, 229, 0.15), transparent 60%),
    linear-gradient(160deg, #0f172a 0%, #1e1b4b 42%, #0c1222 100%);
}

/* Tombol ganti tema (kompak) */
.auth-theme-toggle {
  position: absolute;
  top: clamp(0.5rem, 1.5vw, 0.85rem);
  right: clamp(0.5rem, 1.5vw, 0.85rem);
  z-index: 10;
  width: 2rem;
  height: 2rem;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--auth-toggle-border);
  background: var(--auth-toggle-bg);
  color: var(--auth-toggle-color);
  cursor: pointer;
  box-shadow: 0 1px 6px rgba(15, 23, 42, 0.07);
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

html[data-theme="dark"] .auth-theme-toggle {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

.auth-theme-toggle .theme-icon {
  font-size: 1rem;
  line-height: 1;
}

.auth-theme-toggle:hover {
  transform: scale(1.04);
  color: var(--auth-accent);
}

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

/* Ikon: bulan = mode terang (klik → gelap), matahari = mode gelap (klik → terang) */
html[data-theme="light"] .auth-theme-toggle .icon-sun {
  display: none;
}

html[data-theme="dark"] .auth-theme-toggle .icon-moon {
  display: none;
}

/* Shell: satu kartu, dua kolom di layar lebar */
.auth-shell {
  width: 100%;
  max-width: 560px;
  background: var(--auth-surface);
  border: 1px solid var(--auth-border);
  border-radius: var(--auth-radius);
  box-shadow: var(--auth-shadow);
  display: grid;
  grid-template-columns: 1fr;
  overflow: hidden;
}

@media (min-width: 640px) {
  .auth-shell {
    max-width: 600px;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.85fr);
  }
}

.auth-panel {
  padding: clamp(1rem, 3vw, 1.35rem) clamp(1rem, 3vw, 1.5rem);
}

.auth-panel--form {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-panel--visual {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  padding: 1rem 1rem 1.15rem;
  background: var(--auth-visual-panel);
  border-left: 1px solid var(--auth-border);
  text-align: center;
}

@media (min-width: 640px) {
  .auth-panel--visual {
    display: flex;
  }
}

.auth-brand img {
  height: 32px;
  width: auto;
  display: block;
}

.auth-brand {
  margin-bottom: 0.75rem;
}

.auth-heading h1,
.auth-heading h2 {
  font-size: var(--auth-fs-title);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--auth-text);
  line-height: 1.25;
}

.auth-heading p {
  margin-top: 0.35rem;
  font-size: var(--auth-fs-lead);
  font-weight: 400;
  color: var(--auth-muted);
  line-height: 1.45;
}

.auth-fields {
  margin-top: 1rem;
}

/* Single-column card (fallback / other pages) */
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--auth-surface);
  border: 1px solid var(--auth-border);
  border-radius: var(--auth-radius);
  box-shadow: var(--auth-shadow);
  padding: clamp(1.25rem, 4vw, 1.5rem);
}

.auth-card__brand {
  margin-bottom: 1rem;
}

.auth-card__brand img {
  height: 32px;
  width: auto;
  display: block;
}

.auth-card__title {
  font-size: var(--auth-fs-title);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--auth-text);
  margin-bottom: 0.35rem;
}

.auth-card__lead {
  font-size: var(--auth-fs-lead);
  color: var(--auth-muted);
  line-height: 1.5;
  margin-bottom: 1.25rem;
}

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

.auth-form.otp-active {
  max-height: min(88vh, 520px);
  overflow-y: auto;
  padding-right: 2px;
}

/* Floating label inputs */
.input-wrap {
  position: relative;
  margin-bottom: var(--auth-space);
}

.input-wrap:last-of-type {
  margin-bottom: 0.2rem;
}

.input-field {
  width: 100%;
  height: var(--auth-input-h);
  background: var(--auth-input-bg);
  border: 1px solid var(--auth-border);
  border-radius: var(--auth-radius-sm);
  outline: none;
  padding: 0 0.75rem;
  padding-right: 2.5rem;
  font-size: var(--auth-fs-input);
  color: var(--auth-text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.input-field:hover {
  border-color: #cbd5e1;
}

html[data-theme="dark"] .input-field:hover {
  border-color: #475569;
}

.input-field:focus,
.input-field.active {
  background: var(--auth-input-bg-focus);
  border-color: var(--auth-accent);
  box-shadow: 0 0 0 2px var(--auth-focus-ring);
}

.password-field {
  padding-right: 2.65rem !important;
}

label {
  position: absolute;
  left: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: var(--auth-fs-input);
  color: var(--auth-muted);
  pointer-events: none;
  transition: all 0.15s ease;
  background: linear-gradient(to bottom, var(--auth-input-bg) 55%, transparent 55%);
  padding: 0 0.3rem;
  line-height: 1;
}

.input-field:focus + label,
.input-field.active + label,
.input-field:not(:placeholder-shown) + label {
  top: 0;
  transform: translateY(-50%);
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--auth-accent);
  background: var(--auth-label-float-bg);
  letter-spacing: 0.03em;
}

.password-toggle {
  position: absolute;
  right: 0.4rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: #94a3b8;
  font-size: 0.875rem;
  padding: 0.3rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: color 0.15s ease, background 0.15s ease;
}

.password-toggle:hover {
  color: var(--auth-accent);
  background: var(--auth-password-toggle-hover);
}

.sign-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: var(--auth-btn-h);
  margin-top: 0.85rem;
  background: var(--auth-accent);
  color: #fff;
  border: none;
  border-radius: var(--auth-radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.sign-btn:hover:not(:disabled) {
  background: var(--auth-accent-hover);
}

.sign-btn:active:not(:disabled) {
  transform: scale(0.99);
}

.sign-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.auth-illustration {
  width: 100%;
  max-width: 140px;
  height: auto;
  max-height: 120px;
  object-fit: contain;
  display: block;
}

.auth-company {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--auth-accent);
  letter-spacing: 0.02em;
  line-height: 1.35;
  max-width: 12rem;
}

/* Mobile: gambar kecil di bawah form */
.auth-visual-mobile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--auth-border);
}

@media (min-width: 640px) {
  .auth-visual-mobile {
    display: none;
  }
}

.auth-visual-mobile .auth-illustration {
  max-width: 120px;
  max-height: 100px;
}

.auth-visual-mobile .auth-company {
  font-size: 0.65rem;
}

/* OTP mode */
.sign-in-form.otp-active,
.auth-form.otp-active {
  justify-content: flex-start;
  overflow-y: auto;
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
}

.sign-in-form.otp-active .input-wrap,
.auth-form.otp-active .input-wrap {
  min-height: var(--auth-input-h);
  margin-bottom: 0.65rem;
}

.sign-in-form.otp-active .sign-btn,
.auth-form.otp-active .sign-btn {
  margin-top: 0.5rem;
  margin-bottom: 0.25rem;
  height: var(--auth-btn-h);
}

#otpHint {
  margin-bottom: 0.45rem !important;
  font-size: 0.75rem !important;
}

#otpDevWrap {
  margin-top: 0 !important;
  margin-bottom: 0.5rem !important;
}

#otpDevWrap small,
.auth-otp-dev-label {
  font-size: 0.6875rem;
}

.auth-otp-dev-label {
  display: block;
  color: var(--auth-otp-dev);
  margin-bottom: 0.2rem;
}

#otpDevValue {
  height: 32px;
  font-size: 0.78rem !important;
  padding: 0.25rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--auth-border);
  background: var(--auth-input-bg-focus);
  color: var(--auth-text);
  width: 100%;
}

.auth-card__footer {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--auth-border);
  text-align: center;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--auth-muted);
  letter-spacing: 0.02em;
}

.auth-form.otp-active .input-wrap {
  height: auto;
  min-height: var(--auth-input-h);
}

.auth-form.otp-active .sign-btn {
  margin-top: 0.6rem;
  margin-bottom: 0;
}

#toast-container {
  font-family: "Inter", sans-serif;
}

/* Tanpa Bootstrap: jarak ikon di tombol */
.sign-btn > i:first-child,
.sign-btn .fas:first-child {
  margin-right: 0.35rem;
}

.me-2 {
  margin-right: 0.35rem !important;
}
