/* =============================================================================
   Hormuud University Staff Sign-In — Clean Ubuntu GDM + Frosted Field Box
   Low-poly geometric planes in Hormuud University Emerald Green (no dots).
   ========================================================================== */

body.ubuntu-login {
  --hu-deep: #042416;
  --hu-forest: #016136;
  --hu-emerald: #168055;
  --hu-mint: #34d399;
  --ub-glass: rgba(255, 255, 255, 0.13);
  --ub-glass-line: rgba(255, 255, 255, 0.22);
  --ub-text: #ffffff;
  --ub-text-2: rgba(255, 255, 255, 0.74);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  position: fixed;
  inset: 0;
  margin: 0;
  overflow: hidden;
  background: var(--hu-deep);
  color: var(--ub-text);
  font-family: 'Ubuntu', 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  touch-action: manipulation;
  transition: opacity 0.32s ease, filter 0.32s ease;
}

html:has(body.ubuntu-login) {
  overflow: hidden;
  height: 100%;
  background: #042416;
}

body.ubuntu-login.is-leaving {
  opacity: 0;
  filter: blur(4px);
}

/* ---- Clean Low-Poly Geometric Background (No Dots) ------------------------ */
.ub-wall {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #042416;
}

.ub-poly {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.ub-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(120% 100% at 50% 45%, transparent 50%, rgba(2, 14, 9, 0.45) 100%);
}

/* ---- Minimal Centered-Clock Top Bar (Zero Top Icons) ---------------------- */
.ub-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  height: 28px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.92);
  background: rgba(3, 18, 11, 0.42);
}

.ub-bar__clock {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

/* ---- Main Center GDM Stage ------------------------------------------------ */
.ub-stage {
  position: fixed;
  inset: 28px 0 0 0;
  z-index: 2;
  display: grid;
  grid-template-rows: 1fr auto;
  justify-items: center;
  align-items: center;
  padding: 20px 16px calc(24px + env(safe-area-inset-bottom));
  overflow-y: auto;
}

.ub-panel {
  width: min(100%, 332px);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  animation: ubFadeIn 0.55s var(--ease) both;
}

@keyframes ubFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* Classic Ubuntu translucent user circle */
.ub-avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.94);
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.ub-title {
  margin: 14px 0 0;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #ffffff;
}

.ub-sub {
  margin: 4px 0 18px;
  font-size: 13px;
  color: var(--ub-text-2);
}

/* ---- Frosted Two-Row Rounded Box (Exact Reference Text Box Design) -------- */
.ub-form {
  width: 100%;
  display: grid;
  gap: 10px;
}

.ub-field-group {
  border-radius: 14px;
  overflow: hidden;
  background: var(--ub-glass);
  -webkit-backdrop-filter: blur(28px) saturate(1.6);
  backdrop-filter: blur(28px) saturate(1.6);
  box-shadow: 0 0 0 1px var(--ub-glass-line) inset, 0 12px 32px rgba(2, 18, 11, 0.34);
  transition: box-shadow 0.22s var(--ease), background 0.22s;
}

.ub-field-group:focus-within {
  background: rgba(255, 255, 255, 0.18);
  box-shadow:
    0 0 0 1px rgba(52, 211, 153, 0.65) inset,
    0 0 0 4px rgba(52, 211, 153, 0.22),
    0 12px 32px rgba(2, 18, 11, 0.38);
}

.ub-field-row {
  position: relative;
  display: flex;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}

.ub-field {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 0;
  outline: 0;
  background: transparent;
  color: #ffffff;
  font: inherit;
  font-size: 14.5px;
  text-align: left;
  caret-color: var(--hu-mint);
}

.ub-field-row .ub-field {
  padding-right: 78px;
}

.ub-field::placeholder {
  color: rgba(255, 255, 255, 0.56);
}

.ub-field::-ms-reveal,
.ub-field::-ms-clear {
  display: none;
}

.ub-field::-webkit-credentials-auto-fill-button {
  visibility: hidden;
  display: none !important;
  pointer-events: none;
}

.ub-field:-webkit-autofill,
.ub-field:-webkit-autofill:focus {
  -webkit-text-fill-color: #ffffff;
  transition: background-color 9999s 0s;
  box-shadow: 0 0 0 40px rgba(1, 97, 54, 0.45) inset;
}

.ub-eye,
.ub-go {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  border: 0;
  cursor: pointer;
  color: #ffffff;
  transition: background 0.18s, transform 0.18s var(--ease), opacity 0.18s;
}

.ub-eye {
  right: 44px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: transparent;
  opacity: 0.72;
}

.ub-eye:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.14);
}

.ub-go {
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.24);
}

.ub-go:hover {
  background: var(--hu-emerald);
}

.ub-go:active {
  transform: translateY(-50%) scale(0.92);
}

.ub-eye:focus-visible,
.ub-go:focus-visible,
.ub-brand-lockup:focus-visible,
.ub-linkbtn:focus-visible {
  outline: 2px solid var(--hu-mint);
  outline-offset: 2px;
}

.ub-form[hidden] {
  display: none;
}

.ub-hint {
  margin: 0 0 2px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ub-text-2);
}

.ub-field-row--single .ub-field {
  padding-right: 46px;
  letter-spacing: 0.04em;
}

.ub-2fa-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin-top: 2px;
}

.ub-linkbtn {
  border: 0;
  background: transparent;
  padding: 4px 6px;
  border-radius: 6px;
  font: inherit;
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.78);
  cursor: pointer;
  transition: color 0.16s, background 0.16s;
}

.ub-linkbtn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.ub-linkbtn[hidden] {
  display: none;
}

.ub-go__spin {
  display: none;
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  animation: ubSpin 0.7s linear infinite;
}

.is-busy .ub-go svg { opacity: 0; }
.is-busy .ub-go__spin { display: block; }
.is-busy { pointer-events: none; }
@keyframes ubSpin { to { transform: rotate(360deg); } }

/* Error feedback & subtle shake */
.ub-error {
  margin: 0;
  min-height: 1.4em;
  font-size: 12.5px;
  line-height: 1.35;
  color: #fecaca;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.ub-error.is-visible { opacity: 1; }
.ub-form.is-error .ub-field-group {
  animation: ubShake 0.42s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}
@keyframes ubShake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-6px); }
  40%, 60% { transform: translateX(6px); }
}

/* Keep me signed in checkbox */
.ub-remember {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--ub-text-2);
  user-select: none;
}

.ub-remember input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.ub-remember__box {
  width: 16px;
  height: 16px;
  border-radius: 5px;
  flex: none;
  background: rgba(255, 255, 255, 0.14);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35) inset;
  display: grid;
  place-items: center;
  transition: background 0.18s, box-shadow 0.18s;
}

.ub-remember input:checked + .ub-remember__box {
  background: var(--hu-emerald);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5) inset;
}

.ub-remember input:checked + .ub-remember__box::after {
  content: "";
  width: 8px;
  height: 4px;
  margin-top: -2px;
  border-left: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
  transform: rotate(-45deg);
}

.ub-remember input:focus-visible + .ub-remember__box {
  outline: 2px solid var(--hu-mint);
  outline-offset: 2px;
}

/* ---- Bottom Center Transparent Logo Lockup (Works on Any Background) ----- */
.ub-foot {
  padding-top: 8px;
}

.ub-brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.96);
  text-decoration: none;
  transition: background 0.16s, transform 0.16s;
}

.ub-brand-lockup:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-1px);
}

.ub-brand-lockup__logo {
  width: 34px;
  height: auto;
  display: block;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.35));
}

.ub-brand-lockup__name {
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

/* ---- Responsive Breakpoints ----------------------------------------------- */
@media (max-width: 560px) {
  .ub-panel {
    width: min(100%, 300px);
  }

  .ub-brand-lockup__logo {
    width: 28px;
  }

  .ub-brand-lockup__name {
    font-size: 17px;
  }
}

@media (max-height: 540px) {
  .ub-avatar {
    width: 64px;
    height: 64px;
  }

  .ub-avatar svg {
    width: 32px;
    height: 32px;
  }

  .ub-sub {
    display: none;
  }

  .ub-title {
    margin: 8px 0 14px;
    font-size: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ub-panel,
  .ub-form.is-error .ub-field-group {
    animation: none !important;
  }

  body.ubuntu-login.is-leaving {
    filter: none;
  }
}
