/* Miranda login theme v2 — GLPI 11 anonymous pages only.
 * Loaded via Hooks::ADD_CSS_ANONYMOUS_PAGE, strictly scoped to
 * body.miranda-login (added by js/login_links.js when #login_name exists).
 * Goal: full-viewport mockup fidelity (login.png), real GLPI form untouched.
 * Palette: bg #04070e, panel #0a1220, cyan #2fd4f2, muted #93a1b8.
 */

/* ---------- 1. Break out of GLPI's centered card funnel → full viewport --- */
body.miranda-login.welcome-anonymous {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  color: #e8eef7;
  background-color: #04070e;
  /* Layered art: cyan brush blobs + diagonal sheen over deep base */
  background-image:
    radial-gradient(900px 480px at 12% 88%, rgba(47, 212, 242, 0.16), transparent 65%),
    radial-gradient(700px 420px at 42% 30%, rgba(47, 212, 242, 0.10), transparent 65%),
    radial-gradient(1100px 700px at 85% 110%, rgba(20, 90, 130, 0.25), transparent 60%),
    linear-gradient(115deg, transparent 55%, rgba(47, 212, 242, 0.05) 78%, transparent 92%),
    radial-gradient(1400px 800px at 15% 0%, #0a1626 0%, #04070e 55%);
  background-attachment: fixed;
}

/* faint dot texture */
body.miranda-login.welcome-anonymous::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(148, 178, 205, 0.10) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: linear-gradient(120deg, black 30%, transparent 75%);
}

body.miranda-login .page-anonymous {
  background: transparent;
  min-height: 100dvh;
  display: block;
  padding: 0;
  margin: 0;
  /* robot overlap (translateX) must never create horizontal scroll */
  overflow-x: clip;
}

body.miranda-login .page-anonymous > .flex-fill {
  margin-top: 0 !important;
  padding: 0 !important;
  display: block;
  min-height: 100dvh;
}

body.miranda-login .container-tight {
  max-width: none !important;
  width: 100%;
  margin: 0 !important;
  padding: 0 !important;
}

/* ---------- 2. Hide GLPI chrome (scoped to login only) -------------------- */
body.miranda-login .glpi-logo,
body.miranda-login .page-anonymous > .flex-fill > .container-tight > .text-center:first-child,
body.miranda-login .page-anonymous .text-muted.mt-3,
body.miranda-login .page-anonymous .text-center.mt-3,
body.miranda-login .card.main-content-card > .card-header:empty {
  display: none !important;
}

body.miranda-login .card.main-content-card {
  background: transparent;
  border: 0;
  box-shadow: none;
  margin: 0;
}

body.miranda-login .card-body {
  padding: 0;
}

/* ---------- 3. Split layout: brand (fluid) + form (fixed card) ------------ */
body.miranda-login .miranda-row {
  display: flex;
  align-items: stretch;
  justify-content: center;
  flex-wrap: nowrap;
  gap: clamp(24px, 5vw, 88px);
  width: 100%;
  min-height: 100dvh;
  margin: 0;
  padding: clamp(20px, 4vh, 48px) clamp(20px, 5vw, 72px) 0;
  box-sizing: border-box;
}

body.miranda-login .miranda-brand {
  /* Flexible (not auto): absorbs leftover so brand + 400px form + gap can
   * never overflow the row and wrap. min-width:0 lets %-children shrink. */
  flex: 1 1 0;
  min-width: 0;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  padding: clamp(8px, 3vh, 32px) 0 0;
}

body.miranda-login .miranda-logo-wrap {
  position: relative;
  display: inline-block;
  width: min(300px, 62%);
  line-height: 0;
}

body.miranda-login .miranda-logo {
  display: block;
  width: 100%;
  height: auto;
  margin-bottom: 0;
}

body.miranda-login .miranda-logo-tag {
  position: absolute;
  right: 4px;
  bottom: 2px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1;
  color: #d7e0ee;
  opacity: 1;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.9), 0 0 2px rgba(0, 0, 0, 0.9);
  pointer-events: none;
  white-space: nowrap;
}

/* safety: hide slogan from cached old JS */
body.miranda-login .miranda-slogan {
  display: none !important;
}

body.miranda-login .miranda-robo {
  width: min(440px, 92%);
  height: auto;
  align-self: flex-end;
  margin-top: auto;
  margin-bottom: 0;
  margin-right: clamp(0px, 2vw, 32px);
  /* ponte em direção ao form: invade o vão e passa atrás do card */
  transform: translateX(clamp(50px, 7vw, 130px));
  position: relative;
  z-index: 0;
  filter: drop-shadow(0 24px 60px rgba(47, 212, 242, 0.30));
}

body.miranda-login .miranda-robo img {
  display: block;
  width: 100%;
  height: auto;
}

/* ---------- 4. Form card -------------------------------------------------- */
body.miranda-login .miranda-row .col-md-5 {
  flex: 0 0 auto;
  width: min(400px, 100%);
  max-width: 400px;
  align-self: center;
  position: relative;
  z-index: 1;
  background: rgba(10, 18, 32, 0.92);
  border: 1px solid rgba(47, 212, 242, 0.35);
  border-radius: 16px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4), 0 24px 80px rgba(0, 0, 0, 0.55), 0 0 44px rgba(47, 212, 242, 0.10), 0 0 90px rgba(47, 212, 242, 0.22);
  padding: 36px 32px 28px;
  margin: 0;
  backdrop-filter: blur(4px);
}

body.miranda-login .miranda-form-head {
  text-align: center;
  margin-bottom: 22px;
}

body.miranda-login .miranda-form-head .ti-headset {
  font-size: 56px;
  color: #2fd4f2;
  line-height: 1;
  display: block;
  margin-bottom: 10px;
  filter: drop-shadow(0 0 18px rgba(47, 212, 242, 0.55));
}

body.miranda-login .miranda-form-head h2 {
  color: #fff;
  font-size: clamp(20px, 5vw, 24px);
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
}

body.miranda-login .miranda-subtitle {
  color: #93a1b8;
  font-size: 13.5px;
  line-height: 1.5;
  margin: 0;
}

/* hide original labels visually (kept for screen readers) / extra rows */
body.miranda-login .miranda-row .col-md-5 > .card-header,
body.miranda-login .miranda-auth-source,
body.miranda-login .miranda-remember {
  display: none !important;
}

body.miranda-login .miranda-row label.form-label {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

body.miranda-login .miranda-row .mb-3,
body.miranda-login .miranda-row .mb-4 {
  margin-bottom: 14px !important;
}

/* ---------- 5. Inputs with icons + eye toggle ------------------------------ */
body.miranda-login .miranda-field {
  position: relative;
}

body.miranda-login .miranda-field > .ti {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  color: #8fa1b8;
  pointer-events: none;
}

body.miranda-login .miranda-row .form-control {
  height: 52px;
  background: #0d1626;
  border: 1px solid rgba(47, 212, 242, 0.35);
  border-radius: 10px;
  color: #fff;
  /* 16px minimum: below this iOS Safari auto-zooms on focus and breaks layout */
  font-size: 16px;
  padding-left: 48px;
  width: 100%;
  box-sizing: border-box;
}

body.miranda-login .miranda-row .form-control::placeholder {
  color: #7d8ea6;
}

body.miranda-login .miranda-row .form-control:focus {
  border-color: #2fd4f2;
  box-shadow: 0 0 0 3px rgba(47, 212, 242, 0.22);
  background: #0d1626;
  color: #fff;
  outline: none;
}

body.miranda-login .miranda-field-password .form-control {
  padding-right: 48px;
}

body.miranda-login .miranda-eye {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 0;
  color: #8fa1b8;
  cursor: pointer;
  /* 44px touch target (WCAG) */
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 0;
}

body.miranda-login .miranda-eye:hover {
  color: #2fd4f2;
}

body.miranda-login .miranda-eye .ti {
  font-size: 20px;
}

/* ---------- 6. Buttons ----------------------------------------------------- */
body.miranda-login .miranda-row .form-footer {
  margin-top: 6px;
}

body.miranda-login .miranda-row .form-footer .btn-primary {
  --tblr-btn-bg: #2fd4f2;
  --tblr-btn-border-color: #2fd4f2;
  --tblr-btn-hover-bg: #19c2e6;
  --tblr-btn-hover-border-color: #19c2e6;
  --tblr-btn-active-bg: #12aecf;
  --tblr-btn-active-border-color: #12aecf;
  --tblr-btn-color: #03222b;
  --tblr-btn-hover-color: #03222b;
  background: linear-gradient(180deg, #3fe0f7, #1fc6e8);
  border-color: #2fd4f2;
  color: #03222b;
  font-weight: 800;
  font-size: 16px;
  height: 52px;
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(47, 212, 242, 0.35);
}

body.miranda-login .miranda-row .form-footer .btn-primary:hover {
  background: #19c2e6;
  border-color: #19c2e6;
  color: #03222b;
}

body.miranda-login .miranda-row .form-footer .btn-primary .ti {
  font-size: 20px;
  vertical-align: -3px;
  margin-left: 6px;
}

body.miranda-login #selfreg-account-btn,
body.miranda-login #selfreg-downloads-btn {
  --tblr-btn-color: #2fd4f2;
  --tblr-btn-hover-color: #2fd4f2;
  --tblr-btn-border-color: rgba(47, 212, 242, 0.55);
  --tblr-btn-hover-border-color: #2fd4f2;
  --tblr-btn-hover-bg: rgba(47, 212, 242, 0.12);
  border: 1px solid rgba(47, 212, 242, 0.55);
  color: #2fd4f2;
  background: transparent;
  height: 48px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

body.miranda-login #selfreg-account-btn:hover,
body.miranda-login #selfreg-downloads-btn:hover {
  background: rgba(47, 212, 242, 0.12);
  border-color: #2fd4f2;
  color: #2fd4f2;
}

body.miranda-login #selfreg-account-btn .ti,
body.miranda-login #selfreg-downloads-btn .ti {
  font-size: 19px;
}

body.miranda-login .miranda-or {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #7d8aa3;
  font-size: 12.5px;
  margin: 6px 0;
}

body.miranda-login .miranda-or::before,
body.miranda-login .miranda-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(125, 138, 163, 0.35);
}

body.miranda-login .forgot_password {
  display: block !important;
  text-align: center;
  margin-top: 10px;
}

body.miranda-login .forgot_password a {
  color: #2fd4f2;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

body.miranda-login .forgot_password a:hover {
  text-decoration: underline;
}

body.miranda-login .forgot_password a .ti {
  font-size: 17px;
}

/* ---------- 8. Hotfix v2.1: spread full-width, header centering, Tabler wins */
html {
  background-color: #04070e;
}

body.miranda-login .card {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body.miranda-login .miranda-row {
  justify-content: space-between;
  padding-left: clamp(24px, 6vw, 96px);
  padding-right: clamp(24px, 6vw, 96px);
}

body.miranda-login .miranda-brand {
  max-width: 780px;
}

body.miranda-login .miranda-row .col-md-5 {
  margin-left: auto;
  /* form caminha em direção ao robô */
  margin-right: clamp(0px, 2vw, 48px);
}

body.miranda-login .miranda-form-head {
  display: flex;
  flex-direction: column;
  align-items: center;
}

body.miranda-login .miranda-row .form-footer .btn-primary {
  background: linear-gradient(180deg, #3fe0f7, #1fc6e8) !important;
  background-color: #2fd4f2 !important;
  border-color: #2fd4f2 !important;
  color: #03222b !important;
}

body.miranda-login .miranda-row .form-footer .btn-primary:hover,
body.miranda-login .miranda-row .form-footer .btn-primary:focus {
  background: #19c2e6 !important;
  background-color: #19c2e6 !important;
  border-color: #19c2e6 !important;
  color: #03222b !important;
}

body.miranda-login #selfreg-account-btn,
body.miranda-login #selfreg-downloads-btn {
  border: 1px solid rgba(47, 212, 242, 0.55) !important;
  color: #2fd4f2 !important;
  background: transparent !important;
}

body.miranda-login #selfreg-account-btn:hover,
body.miranda-login #selfreg-downloads-btn:hover {
  background: rgba(47, 212, 242, 0.12) !important;
  border-color: #2fd4f2 !important;
  color: #2fd4f2 !important;
}

/* ---------- 9. Error page (login_error.html.twig: Acesso negado) ------------ */
body.miranda-error.welcome-anonymous {
  margin: 0;
  min-height: 100dvh;
  color: #e8eef7;
  background-color: #04070e;
  background-image:
    radial-gradient(800px 420px at 50% 110%, rgba(47, 212, 242, 0.12), transparent 65%),
    radial-gradient(1200px 700px at 50% 0%, #0a1626 0%, #04070e 55%);
  background-attachment: fixed;
}

body.miranda-error .page-anonymous {
  background: transparent;
  min-height: 100dvh;
  display: block;
  padding: 0;
  margin: 0;
}

body.miranda-error .page-anonymous > .flex-fill {
  margin-top: 0 !important;
  padding: 24px 16px !important;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  box-sizing: border-box;
}

body.miranda-error .container-tight {
  max-width: 560px !important;
  width: 100%;
  margin: 0 !important;
  padding: 0 !important;
}

body.miranda-error .glpi-logo,
body.miranda-error .page-anonymous .text-muted.mt-3,
body.miranda-error .page-anonymous .text-center.mt-3,
body.miranda-error .card.main-content-card > .card-header:empty {
  display: none !important;
}

body.miranda-error .card.main-content-card {
  background: rgba(10, 18, 32, 0.94) !important;
  border: 1px solid rgba(47, 212, 242, 0.35) !important;
  border-radius: 16px !important;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55), 0 0 60px rgba(47, 212, 242, 0.12) !important;
}

body.miranda-error .card-body {
  padding: 36px 32px 28px;
  text-align: center;
}

body.miranda-error .miranda-error-logo {
  width: min(200px, 55%);
  height: auto;
  margin-bottom: 18px;
}

body.miranda-error .card-body .alert {
  background: #0d1626;
  border: 1px solid rgba(47, 212, 242, 0.30);
  border-radius: 10px;
  color: #e8eef7;
  text-align: left;
}

body.miranda-error .card-body .alert .alert-title {
  color: #fff;
}

body.miranda-error .card-body .alert .ti-alert-triangle {
  color: #2fd4f2;
}

body.miranda-error .card-body .btn-primary {
  background: linear-gradient(180deg, #3fe0f7, #1fc6e8) !important;
  background-color: #2fd4f2 !important;
  border-color: #2fd4f2 !important;
  color: #03222b !important;
  font-weight: 700;
}

body.miranda-error .card-body .btn-primary:hover {
  background: #19c2e6 !important;
  background-color: #19c2e6 !important;
  border-color: #19c2e6 !important;
  color: #03222b !important;
}

/* ---------- 7. Responsive -------------------------------------------------- */
/* Breakpoints are content-driven (see docs/responsividade-telas-publicas.md):
 * 1400/1200/1100 compress the side-by-side zone, 1024 stacks to column,
 * 380 compacts small phones, max-height handles landscape/short windows. */
@media (max-width: 1400px) {
  /* Upper compression zone (small notebooks/tablet landscape large):
   * robot steps down and pulls back from the card. */
  body.miranda-login .miranda-robo {
    width: min(360px, 88%);
    transform: translateX(clamp(12px, 2vw, 32px));
  }

  body.miranda-login .miranda-row .col-md-5 {
    margin-right: 0;
  }
}

@media (max-width: 1200px) {
  body.miranda-login .miranda-row {
    padding-left: clamp(20px, 4vw, 48px);
    padding-right: clamp(20px, 4vw, 48px);
    gap: clamp(16px, 3vw, 48px);
  }

  /* Compression zone: shrink robot + pull back the bridge so it breathes
   * next to the card instead of crowding it. */
  body.miranda-login .miranda-robo {
    width: min(340px, 88%);
    transform: translateX(clamp(8px, 1.5vw, 24px));
  }
}

@media (max-width: 1100px) {
  body.miranda-login .miranda-brand {
    max-width: 560px;
  }

  body.miranda-login .miranda-robo {
    width: min(320px, 85%);
    transform: translateX(8px);
  }

  body.miranda-login .miranda-row .col-md-5 {
    margin-right: 0;
  }
}

@media (max-width: 1024px) {
  body.miranda-login .miranda-row {
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 100dvh;
    gap: 20px;
    /* respiro inferior: form não gruda na borda em telas menores */
    padding-bottom: 40px;
  }

  /* Flatten brand so logo / form / robot can be reordered:
   * mobile order = logo -> form -> reduced robot (no scroll trap). */
  body.miranda-login .miranda-brand {
    display: contents;
  }

  body.miranda-login .miranda-logo-wrap {
    order: 1;
    width: min(240px, 64%);
  }

  body.miranda-login .miranda-logo-tag {
    font-size: 11px;
    right: 3px;
    bottom: 1px;
  }

  body.miranda-login .miranda-row .col-md-5 {
    order: 2;
    flex-basis: auto;
    width: min(400px, 100%);
    max-width: 400px;
    /* reset desktop side margins: stacked card must center, not hug right */
    margin-left: 0;
    margin-right: 0;
  }

  body.miranda-login .miranda-robo {
    order: 3;
    width: min(200px, 52%);
    align-self: center;
    margin-top: 4px;
    transform: none;
  }
}

/* Short windows / landscape phones: shrink art, keep form reachable */
@media (min-width: 1025px) and (max-height: 620px) {
  body.miranda-login .miranda-logo-wrap {
    width: min(220px, 40%);
  }

  body.miranda-login .miranda-robo {
    width: min(300px, 60%);
    transform: translateX(clamp(10px, 2vw, 40px));
  }

  body.miranda-login .miranda-form-head .ti-headset {
    font-size: 40px;
    margin-bottom: 6px;
  }

  body.miranda-login .miranda-form-head {
    margin-bottom: 14px;
  }

  body.miranda-login .miranda-row .col-md-5 {
    padding: 28px 28px 22px;
  }
}

/* Compact phones */
@media (max-width: 380px) {
  body.miranda-login .miranda-row {
    padding-left: 16px;
    padding-right: 16px;
    gap: 16px;
  }

  body.miranda-login .miranda-logo-wrap {
    width: min(200px, 60%);
  }

  body.miranda-login .miranda-row .col-md-5 {
    padding: 24px 20px 20px;
  }

  body.miranda-login .miranda-form-head {
    margin-bottom: 16px;
  }

  body.miranda-login .miranda-form-head .ti-headset {
    font-size: 44px;
  }
}
