/* Appsroom SSO — halaman login (glass / iOS style) */

@property --spin {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

:root {
  color-scheme: light;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI Variable Display", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;

  --bg-base: #eaf1fb;
  --orb-a: #6ab6ff;
  --orb-b: #2fd4c0;
  --orb-c: #a99bff;
  --orb-d: #ffd0a8;
  --orb-opacity: .85;

  --text: #0b1b33;
  --text-soft: rgba(11, 27, 51, .66);
  --text-faint: rgba(11, 27, 51, .48);
  --brand-navy: #1a3f7f;
  --brand-teal: #14b8aa;

  --card-bg: linear-gradient(150deg, rgba(255, 255, 255, .72), rgba(255, 255, 255, .38));
  --card-shadow: 0 30px 80px -20px rgba(24, 56, 110, .35), 0 8px 24px -8px rgba(24, 56, 110, .18);
  --card-inset: inset 0 1px 0 rgba(255, 255, 255, .85), inset 0 -1px 0 rgba(255, 255, 255, .25), 0 0 0 1px rgba(40, 90, 170, .10);
  --edge: rgba(255, 255, 255, 1);
  --edge-dim: rgba(255, 255, 255, .0);
  --edge-alt: rgba(96, 165, 250, .55);
  --sheen: rgba(255, 255, 255, .55);

  --btn-bg: linear-gradient(180deg, rgba(255, 255, 255, .92), rgba(255, 255, 255, .62));
  --btn-bg-hover: linear-gradient(180deg, #fff, rgba(255, 255, 255, .78));
  --btn-border: rgba(255, 255, 255, .9);
  --btn-shadow: 0 1px 0 rgba(255, 255, 255, .9) inset, 0 10px 24px -10px rgba(24, 56, 110, .35), 0 2px 6px rgba(24, 56, 110, .08);

  --alert-bg: rgba(255, 59, 48, .12);
  --alert-border: rgba(255, 59, 48, .35);
  --alert-text: #a3160d;

  --toggle-bg: rgba(255, 255, 255, .55);
  --toggle-thumb: #fff;
  --toggle-icon: rgba(11, 27, 51, .55);
  --toggle-icon-on: #0b1b33;

  --focus: #0a84ff;
  --divider: rgba(11, 27, 51, .12);
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg-base: #050813;
  --orb-a: #2563eb;
  --orb-b: #0ea89b;
  --orb-c: #7c3aed;
  --orb-d: #1d4ed8;
  --orb-opacity: .62;

  --text: #f4f7ff;
  --text-soft: rgba(244, 247, 255, .72);
  --text-faint: rgba(244, 247, 255, .5);
  --brand-navy: #cfe0ff;
  --brand-teal: #2ee6d3;

  --card-bg: linear-gradient(150deg, rgba(38, 44, 66, .62), rgba(16, 20, 36, .42));
  --card-shadow: 0 40px 100px -24px rgba(0, 0, 0, .8), 0 10px 30px -10px rgba(0, 0, 0, .55);
  --card-inset: inset 0 1px 0 rgba(255, 255, 255, .22), inset 0 -1px 0 rgba(255, 255, 255, .05);
  --edge: rgba(255, 255, 255, .85);
  --edge-dim: rgba(255, 255, 255, .0);
  --edge-alt: rgba(94, 160, 255, .65);
  --sheen: rgba(255, 255, 255, .16);

  --btn-bg: linear-gradient(180deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, .06));
  --btn-bg-hover: linear-gradient(180deg, rgba(255, 255, 255, .24), rgba(255, 255, 255, .1));
  --btn-border: rgba(255, 255, 255, .2);
  --btn-shadow: 0 1px 0 rgba(255, 255, 255, .22) inset, 0 12px 28px -12px rgba(0, 0, 0, .8);

  --alert-bg: rgba(255, 69, 58, .16);
  --alert-border: rgba(255, 105, 97, .4);
  --alert-text: #ffb4ae;

  --toggle-bg: rgba(255, 255, 255, .1);
  --toggle-thumb: rgba(255, 255, 255, .22);
  --toggle-icon: rgba(244, 247, 255, .55);
  --toggle-icon-on: #fff;

  --focus: #64d2ff;
  --divider: rgba(255, 255, 255, .14);
}

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

html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color .5s ease, color .4s ease;
}

/* ---------- Latar: mesh gradient beranimasi ---------- */
.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: var(--orb-opacity);
  will-change: transform;
  transition: opacity .6s ease, background-color .6s ease;
}
.orb--a { width: 46vmax; height: 46vmax; left: -12vmax; top: -14vmax; background: var(--orb-a); animation: drift-a 26s ease-in-out infinite alternate; }
.orb--b { width: 40vmax; height: 40vmax; right: -10vmax; top: 6vmax;  background: var(--orb-b); animation: drift-b 32s ease-in-out infinite alternate; }
.orb--c { width: 44vmax; height: 44vmax; left: 12vmax; bottom: -22vmax; background: var(--orb-c); animation: drift-c 29s ease-in-out infinite alternate; }
.orb--d { width: 30vmax; height: 30vmax; right: 8vmax; bottom: -10vmax; background: var(--orb-d); animation: drift-a 36s ease-in-out infinite alternate-reverse; }

@keyframes drift-a { to { transform: translate3d(9vmax, 7vmax, 0) scale(1.12); } }
@keyframes drift-b { to { transform: translate3d(-8vmax, 9vmax, 0) scale(.92); } }
@keyframes drift-c { to { transform: translate3d(6vmax, -8vmax, 0) scale(1.08); } }

/* Noise halus supaya blur tidak terlihat "banding" */
.bg::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* ---------- Tombol tema (Terang / Gelap) ---------- */
.theme-switch {
  position: fixed;
  z-index: 5;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
  border-radius: 999px;
  background: var(--toggle-bg);
  border: 1px solid var(--btn-border);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  box-shadow: var(--btn-shadow);
}
.theme-switch__thumb {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc(50% - 3px);
  border-radius: 999px;
  background: var(--toggle-thumb);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .18), inset 0 1px 0 rgba(255, 255, 255, .5);
  transition: transform .45s cubic-bezier(.3, 1.4, .5, 1);
}
:root[data-theme="dark"] .theme-switch__thumb { transform: translateX(100%); }

.theme-switch button {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px 7px 11px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--toggle-icon);
  font: 600 13px/1 var(--font);
  cursor: pointer;
  transition: color .3s ease;
  -webkit-tap-highlight-color: transparent;
}
.theme-switch button svg { width: 16px; height: 16px; flex: none; }
.theme-switch button[aria-pressed="true"] { color: var(--toggle-icon-on); }

/* ---------- Panggung & kartu kaca ---------- */
.stage {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 16px 20px;
  gap: 16px;
}

.glass {
  --mx: 50%;
  --my: 0%;
  --glow: 0;
  position: relative;
  width: 100%;
  max-width: 420px;
  padding: 30px 30px 24px;
  border-radius: 32px;
  background: var(--card-bg);
  -webkit-backdrop-filter: blur(34px) saturate(190%);
  backdrop-filter: blur(34px) saturate(190%);
  box-shadow: var(--card-shadow), var(--card-inset);
  isolation: isolate;
  animation: card-in .9s cubic-bezier(.2, .9, .2, 1) both;
  transition: background .5s ease, box-shadow .5s ease;
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(18px) scale(.965); filter: blur(10px); }
  to   { opacity: 1; transform: none; filter: none; }
}

/* Tepi kaca: sorot cahaya statis di sudut + sorot yang mengikuti kursor */
.glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 2px;
  pointer-events: none;
  z-index: 2;
  background:
    radial-gradient(240px circle at var(--mx) var(--my), var(--edge), transparent 65%),
    conic-gradient(from var(--spin), var(--edge) 0deg, var(--edge-dim) 55deg, var(--edge-dim) 170deg, var(--edge-alt) 215deg, var(--edge-dim) 260deg, var(--edge-dim) 320deg, var(--edge) 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  animation: spin 14s linear infinite;
}
@keyframes spin { to { --spin: 360deg; } }

/* Kilau permukaan (refleksi cahaya) */
.glass::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(420px circle at var(--mx) var(--my), var(--sheen), transparent 60%),
    linear-gradient(115deg, rgba(255, 255, 255, .28) 0%, rgba(255, 255, 255, 0) 32%);
  opacity: calc(.35 + var(--glow) * .65);
  transition: opacity .35s ease;
}

.glass > * { position: relative; z-index: 1; }

/* ---------- Isi kartu ---------- */
.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  margin-bottom: 16px;
}
.brand__logo {
  width: 68px;
  height: 68px;
  margin-bottom: 8px;
  filter: drop-shadow(0 10px 18px rgba(26, 63, 127, .35));
  animation: float 6s ease-in-out infinite;
}
@keyframes float { 50% { transform: translateY(-5px); } }

.brand__name {
  margin: 0;
  font-size: 34px;
  line-height: 1.05;
  letter-spacing: -.035em;
  color: var(--brand-navy);
  font-weight: 300;
}
.brand__name b { font-weight: 800; color: var(--brand-teal); }
.brand__sub {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.title {
  margin: 0 0 6px;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.02em;
}
.lead {
  margin: 0 0 22px;
  text-align: center;
  font-size: 14.5px;
  color: var(--text-soft);
}

.alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 0 0 18px;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--alert-bg);
  border: 1px solid var(--alert-border);
  color: var(--alert-text);
  font-size: 13.5px;
  line-height: 1.4;
  animation: alert-in .5s cubic-bezier(.2, .9, .2, 1) both;
}
.alert svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
@keyframes alert-in { from { opacity: 0; transform: translateY(-6px); } }

.actions { display: grid; gap: 12px; }

.btn {
  --bx: 50%;
  --by: 50%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 54px;
  padding: 0 20px;
  border-radius: 18px;
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--text);
  font: 600 15.5px/1 var(--font);
  letter-spacing: -.005em;
  text-decoration: none;
  box-shadow: var(--btn-shadow);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .35s cubic-bezier(.3, 1.4, .5, 1), background .3s ease, box-shadow .3s ease;
}
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(150px circle at var(--bx) var(--by), rgba(255, 255, 255, .55), transparent 70%);
  opacity: 0;
  transition: opacity .3s ease;
  pointer-events: none;
}
:root[data-theme="dark"] .btn::before { background: radial-gradient(150px circle at var(--bx) var(--by), rgba(255, 255, 255, .2), transparent 70%); }
.btn:hover { background: var(--btn-bg-hover); transform: translateY(-2px); color: var(--text); text-decoration: none; }
.btn:hover::before { opacity: 1; }
.btn:active { transform: scale(.975); }
.btn svg { width: 22px; height: 22px; flex: none; position: relative; }
.btn span { position: relative; }

.btn.is-loading { pointer-events: none; opacity: .85; }
.btn.is-loading svg { display: none; }
.btn.is-loading::after {
  content: "";
  order: -1;
  position: relative;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2.5px solid var(--divider);
  border-top-color: var(--focus);
  animation: rot .7s linear infinite;
}
@keyframes rot { to { transform: rotate(360deg); } }

.btn:focus-visible,
.theme-switch button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 14px;
  color: var(--text-faint);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--divider); }

.secure {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-soft);
}
.secure svg { width: 15px; height: 15px; flex: none; color: var(--brand-teal); }

.foot {
  margin: 0;
  max-width: 420px;
  text-align: center;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-faint);
  animation: card-in 1.1s .15s cubic-bezier(.2, .9, .2, 1) both;
}

/* ---------- Responsif & aksesibilitas ---------- */
@media (max-width: 440px) {
  .glass { padding: 30px 22px 24px; border-radius: 28px; }
  .brand__name { font-size: 30px; }
  .theme-switch button span { display: none; }
  .theme-switch button { padding: 8px 12px; }
}

@media (max-height: 640px) {
  .stage { justify-content: flex-start; }
}

/* Peramban tanpa backdrop-filter: pakai latar yang lebih solid agar teks tetap terbaca */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root { --card-bg: rgba(255, 255, 255, .92); }
  :root[data-theme="dark"] { --card-bg: rgba(20, 24, 40, .94); }
}

@media (prefers-reduced-transparency: reduce) {
  :root { --card-bg: rgba(255, 255, 255, .94); }
  :root[data-theme="dark"] { --card-bg: rgba(20, 24, 40, .96); }
  .glass, .btn, .theme-switch { -webkit-backdrop-filter: none; backdrop-filter: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
}
