/* Halaman auth tenant & owner — login, lupa password, galat.
 *
 * Hanya dimuat oleh `ui/auth_base.html`. Menggunakan token CSS dari `tokens.css`
 * serta mendukung override `--auth-accent` per tenant.
 */

.auth-body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
}

.auth-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 32px 16px;
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  padding: 34px 32px 30px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: auth-rise 0.32s ease-out both;
}

/* Garis aksen tipis di tepi atas kartu — satu-satunya hiasan, warnanya aksen tenant. */
.auth-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--auth-accent, var(--primary));
}

@keyframes auth-rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-card { animation: none; }
}

/* ----------------------------------------------------- Tata Letak Split */

.auth-split {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(420px, 1.05fr) minmax(420px, 0.95fr);
}

.auth-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 40px 44px;
  color: #f8fafc;
  background-color: #0f172a;
  background-size: cover;
  background-position: center;
  overflow: hidden;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

/* Sampul (foto unggahan tenant) dipadukan dengan warna tema: `luminosity` mengambil terang-gelap foto
   dan mewarnainya dengan warna tema, sehingga foto apa pun (kopi, kapal, kantor) tampil serasi dan
   teks tetap terbaca — bukan sekadar ditimpa lapisan gelap. */
.auth-stage-photo {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0.42;
  mix-blend-mode: luminosity;
  z-index: 0;
  pointer-events: none;
}

.auth-theme-maritime .auth-stage { background-color: #0f172a; }
.auth-theme-ocean .auth-stage { background-color: #0c4a6e; }
.auth-theme-emerald .auth-stage { background-color: #064e3b; }

.auth-stage-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at 30% 35%, rgba(0, 0, 0, 0.85), transparent 85%);
  pointer-events: none;
  z-index: 1;
}

.auth-stage-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    155deg,
    rgba(15, 23, 42, 0.90) 0%,
    rgba(15, 23, 42, 0.72) 55%,
    rgba(15, 23, 42, 0.92) 100%
  );
  pointer-events: none;
  z-index: 2;
}

.auth-theme-ocean .auth-stage-scrim {
  background: linear-gradient(
    155deg,
    rgba(12, 74, 110, 0.90) 0%,
    rgba(7, 89, 133, 0.72) 55%,
    rgba(8, 47, 73, 0.94) 100%
  );
}

.auth-theme-emerald .auth-stage-scrim {
  background: linear-gradient(
    155deg,
    rgba(6, 78, 59, 0.92) 0%,
    rgba(17, 94, 89, 0.72) 55%,
    rgba(2, 44, 34, 0.94) 100%
  );
}

.auth-stage-inner {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  max-width: 560px;
}

.auth-stage-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.auth-stage-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-stage-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--auth-accent, var(--primary));
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.4px;
  flex-shrink: 0;
}

.auth-stage-mark-img {
  background: rgba(255, 255, 255, 0.96);
  padding: 5px;
}

.auth-stage-mark-img img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.auth-stage-code {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: #ffffff;
}

.auth-stage-domain {
  font-size: 12px;
  color: rgba(248, 250, 252, 0.72);
}

.auth-stage-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 12px;
  font-weight: 500;
  color: #e2e8f0;
}

.auth-stage-copy {
  margin: auto 0;
  padding: 40px 0 28px;
}

.auth-stage-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(226, 232, 240, 0.82);
}

.auth-stage-eyebrow::before {
  content: "";
  width: 28px;
  height: 2px;
  background: var(--auth-accent, #60a5fa);
}

.auth-stage-title {
  margin: 0 0 16px;
  font-size: clamp(28px, 3.4vw, 46px);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.03em;
  color: #ffffff;
  text-wrap: balance;
}

.auth-stage-desc {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
  color: rgba(241, 245, 249, 0.84);
  max-width: 46ch;
}

.auth-stage-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 12px;
  color: rgba(226, 232, 240, 0.80);
}

.auth-stage-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.auth-pane {
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--bg);
}

.auth-layout-split .auth-card {
  max-width: 440px;
}

/* ------------------------------------------------------------------ Kepala */

.auth-head {
  text-align: left;
  margin-bottom: 26px;
}

.auth-eyebrow {
  display: block;
  margin-bottom: 6px;
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.auth-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin-bottom: 18px;
  border-radius: var(--radius-lg);
  background: var(--auth-accent, var(--primary));
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.auth-logo-img {
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 6px;
  overflow: hidden;
}

.auth-logo-img img {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
}

.auth-head h1 {
  margin: 0;
  font-size: clamp(22px, 2.2vw, 26px);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.015em;
  overflow-wrap: break-word;
}

.auth-sub {
  margin: 8px 0 0;
  font-size: var(--fs-md);
  color: var(--text-muted);
}

/* ------------------------------------------------------------------- Form */

.auth-form .form-group {
  margin-bottom: 16px;
}

.auth-form .form-control:focus {
  border-color: var(--auth-accent, var(--primary));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--auth-accent, var(--primary)) 18%, transparent);
}

.auth-form .input-icon {
  position: relative;
}

.auth-form .input-icon input {
  padding-right: 38px;
}

.auth-peek {
  position: absolute;
  top: 0;
  right: 0;
  width: 38px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 15px;
}

.auth-peek:hover {
  color: var(--text-muted);
}

.auth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin: 6px 0 20px;
  font-size: 13px;
}

.auth-check {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
}

.auth-check input {
  width: 15px;
  height: 15px;
  accent-color: var(--auth-accent, var(--primary));
}

.auth-link {
  color: var(--primary-text);
  text-decoration: none;
  font-weight: 500;
}

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

.auth-submit {
  width: 100%;
  justify-content: center;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 10px 14px;
  font-size: var(--fs-md);
  font-weight: 600;
  background-color: var(--auth-accent, var(--primary));
  border-color: var(--auth-accent, var(--primary));
  color: #fff;
}

.auth-submit:hover,
.auth-submit:focus-visible {
  background-color: color-mix(in srgb, var(--auth-accent, var(--primary)) 88%, #000);
  border-color: color-mix(in srgb, var(--auth-accent, var(--primary)) 88%, #000);
}

.auth-help {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ------------------------------------------------------------------- Lain */

.auth-foot {
  margin: 0;
  font-size: 12px;
  color: var(--text-faint);
  text-align: center;
}

.auth-theme {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 20;
  background: var(--surface);
  border: 1px solid var(--border);
}

@media (max-width: 960px) {
  .auth-split {
    grid-template-columns: 1fr;
  }
  /* Panel visual menyusut jadi pita identitas; kartu login naik menimpa tepinya. */
  .auth-stage {
    padding: 22px 20px 56px;
    border-right: 0;
  }
  .auth-stage-copy {
    padding: 18px 0 0;
    margin: 0;
  }
  .auth-stage-title {
    font-size: clamp(22px, 6vw, 30px);
    margin-bottom: 8px;
  }
  .auth-stage-desc,
  .auth-stage-chips,
  .auth-stage-meta,
  .auth-stage-badge {
    display: none;
  }
  .auth-pane {
    margin-top: -36px;
    position: relative;
    z-index: 4;
    background: transparent;
  }
  .auth-layout-split .auth-shell {
    min-height: auto;
    padding: 0 16px 36px;
  }
}

@media (max-width: 480px) {
  .auth-single .auth-shell {
    justify-content: flex-start;
    padding-top: 56px;
  }
  .auth-card {
    padding: 26px 20px 22px;
    border-radius: var(--radius-lg);
  }
  .auth-stage-eyebrow {
    margin-bottom: 10px;
  }
}

/* Layar pendek (laptop kecil, ponsel landscape): jangan memaksa tinggi penuh. */
@media (max-height: 640px) and (min-width: 961px) {
  .auth-stage { padding-top: 24px; padding-bottom: 24px; }
  .auth-stage-copy { padding: 16px 0; }
}

/* ------------------------------------------------------- Halaman galat */

/* templates/error.html memakai kerangka yang sama dengan halaman auth:
   satu kartu di tengah, tanpa sidebar dan tanpa menu — karena halaman galat
   justru sering muncul ketika keduanya tidak bisa dibangun. */
.error-card {
  max-width: 460px;
  text-align: center;
}

.error-code {
  font-size: 46px;
  font-weight: 800;
  line-height: 1;
  color: var(--text-faint);
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
}

.error-card h1 {
  margin: 12px 0 8px;
  font-size: 19px;
  font-weight: 600;
}

.error-card .auth-help {
  margin-bottom: 20px;
}

.error-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.error-actions .btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

/* ------------------------------------------- Chip cakupan (panel visual) */

.auth-stage-chips {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 22px;
  padding: 0;
}

.auth-stage-chips li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.20);
  background: rgba(255, 255, 255, 0.07);
  font-size: var(--fs-sm);
  color: #e2e8f0;
}

.auth-stage-chips li span {
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-xs);
  color: rgba(226, 232, 240, 0.64);
}

/* ------------------------------------------------ Kontrol form (lebih lega) */

.auth-form .form-label {
  font-size: var(--fs-sm);
  font-weight: 600;
  margin-bottom: 6px;
}

.auth-form .form-control {
  min-height: 44px;
  font-size: var(--fs-md);
}

.auth-form .input-icon > .bi:first-child {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
}

.auth-form .input-icon > input {
  padding-left: 40px;
}

.auth-capslock {
  display: none;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: var(--fs-sm);
  color: var(--warning-text);
}

.auth-capslock.is-on {
  display: flex;
}

.auth-foot a {
  color: var(--text-muted);
  font-weight: 600;
}

/* Aturan dasar chip ditulis SETELAH media query di atas; sembunyikan lagi di layar sempit. */
@media (max-width: 960px) {
  .auth-stage-chips { display: none; }
}


.auth-copy {
  margin: -6px 0 0;
  font-size: var(--fs-xs);
  color: var(--text-faint);
  text-align: center;
}

/* ------------------------------------------------------------- Gelombang laut */

.auth-waves {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 40%;
  z-index: 2;
  overflow: hidden;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to top, #000 70%, transparent);
          mask-image: linear-gradient(to top, #000 70%, transparent);
}

.auth-wave {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 100%;
  /* paralaks kursor (diisi auth-waves.js lewat --mx/--my pada .auth-stage) */
  transform: translate3d(calc(var(--mx, 0) * var(--depth, 10) * -1px), calc(var(--my, 0) * var(--depth, 10) * -0.5px), 0);
  transition: transform 0.6s ease-out;
}

.auth-wave svg {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 200%;
  height: 78%;
  fill: #ffffff;
  animation: auth-wave-drift var(--dur, 28s) linear infinite;
  will-change: transform;
}

.auth-wave-1 { --depth: 30; --dur: 34s; }
.auth-wave-1 svg { fill-opacity: 0.08; height: 92%; }
.auth-wave-2 { --depth: 18; --dur: 24s; }
.auth-wave-2 svg { fill-opacity: 0.11; height: 72%; animation-direction: reverse; }
.auth-wave-3 { --depth: 8;  --dur: 17s; }
.auth-wave-3 svg { fill-opacity: 0.15; height: 52%; }

@keyframes auth-wave-drift {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* Riak dari titik kursor */
.auth-ripple {
  position: absolute;
  z-index: 2;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border: 1.5px solid rgba(255, 255, 255, 0.38);
  border-radius: 50%;
  pointer-events: none;
  animation: auth-ripple 1.2s ease-out forwards;
}

@keyframes auth-ripple {
  to { transform: scale(18); opacity: 0; border-width: 0.5px; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-wave svg { animation: none; }
  .auth-wave { transition: none; transform: none; }
  .auth-ripple { display: none; }
}

@media (max-width: 960px) {
  .auth-waves { display: none; }
}

/* Dengan foto sampul, lapisan gelap dilonggarkan: foto sudah diwarnai tema (luminosity). */
.auth-stage:has(.auth-stage-photo) .auth-stage-scrim { opacity: 0.62; }

/* ------------------------------------------- Variasi Struktur Login Baru */

/* 1. Split Terbalik (Form di kiri, panel visual di kanan) */
.auth-layout-split-right .auth-split {
  grid-template-columns: minmax(420px, 0.95fr) minmax(420px, 1.05fr);
}
.auth-layout-split-right .auth-stage {
  order: 2;
  border-right: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}
.auth-layout-split-right .auth-pane { order: 1; }
@media (max-width: 960px) {
  .auth-layout-split-right .auth-stage { order: 1; border-left: 0; }
  .auth-layout-split-right .auth-pane { order: 2; }
}

/* 2. Pita Samping Ringkas (Panel brand 28-32% di kiri, ruang fokus luas di kanan) */
.auth-layout-compact-rail .auth-split {
  grid-template-columns: minmax(290px, 340px) minmax(0, 1fr);
}
.auth-layout-compact-rail .auth-stage {
  padding: 32px 28px;
  background-color: #064e3b;
}
.auth-layout-compact-rail .auth-stage-title { font-size: clamp(22px, 2.2vw, 30px); }
.auth-layout-compact-rail .auth-stage-chips { display: none; }
.auth-layout-compact-rail .auth-card { max-width: 460px; }

/* 3. Sampul Penuh + Kartu Mengambang di Tengah */
.auth-layout-backdrop .auth-wrap-backdrop {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-layout-backdrop .auth-stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  border: 0;
  background-color: #0c4a6e;
  justify-content: flex-start;
  pointer-events: none;
}
.auth-layout-backdrop .auth-stage-inner {
  max-width: 100%;
  flex-direction: row;
  align-items: flex-start;
  justify-content: space-between;
}
.auth-layout-backdrop .auth-stage-copy,
.auth-layout-backdrop .auth-stage-chips,
.auth-layout-backdrop .auth-stage-meta { display: none; }
.auth-layout-backdrop .auth-pane {
  position: relative;
  z-index: 4;
  width: 100%;
  background: transparent !important;
  background-image: none !important;
}
.auth-layout-backdrop .auth-card {
  max-width: 440px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: 0 24px 60px -16px rgba(2, 6, 23, 0.55);
}
.auth-layout-backdrop .auth-foot,
.auth-layout-backdrop .auth-copy { color: rgba(248, 250, 252, 0.82); }

/* 4. Banner Atas + Kartu Terangkat di Bawahnya */
.auth-layout-hero-top .auth-wrap-hero-top {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.auth-layout-hero-top .auth-stage {
  min-height: 240px;
  padding: 28px 40px 64px;
  border-right: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  background-color: #1e293b;
}
.auth-layout-hero-top .auth-stage-inner {
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
  gap: 18px;
}
.auth-layout-hero-top .auth-stage-copy { margin: 0; padding: 8px 0 0; }
.auth-layout-hero-top .auth-stage-title { font-size: clamp(22px, 2.6vw, 34px); margin-bottom: 8px; }
.auth-layout-hero-top .auth-stage-chips,
.auth-layout-hero-top .auth-stage-meta { display: none; }
.auth-layout-hero-top .auth-pane {
  flex: 1;
  justify-content: flex-start;
  position: relative;
  z-index: 4;
}
.auth-layout-hero-top .auth-shell {
  min-height: auto;
  padding-top: 0;
  margin-top: -54px;
}
.auth-layout-hero-top .auth-card {
  max-width: 460px;
  box-shadow: 0 20px 44px -16px rgba(15, 23, 42, 0.28);
}
