/*
 * Managearo brand layer for the master console (/master/*).
 *
 * Inspinia (app.min.css) is a Bootstrap 5.3 build with the `ins-` CSS-variable prefix: every
 * colour the theme paints comes from a variable set on :root / [data-bs-theme] / html[data-skin] /
 * [data-menu-color]. This sheet loads AFTER app.min.css and re-points those variables at the
 * app's design tokens (ui/css/tokens.css) — primary blue-800 #1b4db1, cool blue-25 surfaces, navy
 * sidebar, Inter — so the console reads as the same product as the Next.js app without touching
 * the vendored theme. Selectors deliberately match or beat the theme's own specificity
 * (html[data-skin] ties with html[data-skin=modern]; source order then decides).
 *
 * Only the master templates include it (templates/base/master/*.html.twig).
 */

/* ── Light theme (the default) ─────────────────────────────────────────────── */
:root,
html,
html[data-skin],
html[data-bs-theme=light],
html[data-bs-theme=light][data-skin] {
  --ins-font-sans-serif: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --ins-primary: #1b4db1;
  --ins-primary-rgb: 27, 77, 177;
  --ins-primary-text-emphasis: #163f90;
  --ins-primary-bg-subtle: rgba(27, 77, 177, 0.1);
  --ins-primary-border-subtle: rgba(27, 77, 177, 0.3);

  --ins-link-color: #1b4db1;
  --ins-link-color-rgb: 27, 77, 177;
  --ins-link-hover-color: #163f90;
  --ins-link-hover-color-rgb: 22, 63, 144;

  --ins-body-bg: #f5f8fd;
  --ins-body-bg-rgb: 245, 248, 253;
  --ins-body-color: #4b5563;
  --ins-heading-color: #0a1f44;
  --ins-secondary-bg: #ffffff;
  --ins-tertiary-bg: #f3f7fe;
  --ins-border-color: #e4e9f4;

  --ins-focus-ring-color: rgba(27, 77, 177, 0.25);
}

/* Topbar: white rail with a hairline, like the app shell header. */
html[data-topbar-color=light],
html[data-bs-theme=light][data-topbar-color=light] {
  --ins-topbar-bg: #ffffff;
  --ins-topbar-border-color: #e4e9f4;
  --ins-topbar-item-color: #5e6b8a;
  --ins-topbar-item-hover-color: #1b4db1;
}

/* Sidebar: the app's navy (navy-900) with slate text and a soft blue active pill. */
html[data-menu-color=dark],
html[data-bs-theme=light][data-menu-color=dark] {
  --ins-sidenav-bg: #0f1d33;
  --ins-sidenav-border-color: #0f1d33;
  --ins-sidenav-item-color: #aeb6c4;
  --ins-sidenav-item-hover-color: #e8eef8;
  --ins-sidenav-item-hover-bg: rgba(255, 255, 255, 0.06);
  --ins-sidenav-item-active-color: #ffffff;
  --ins-sidenav-item-active-bg: rgba(59, 130, 246, 0.22);
}

/* ── Dark theme (topbar moon toggle) ───────────────────────────────────────── */
html[data-bs-theme=dark],
html[data-bs-theme=dark][data-skin] {
  --ins-primary: #3b82f6;
  --ins-primary-rgb: 59, 130, 246;
  --ins-primary-text-emphasis: #93c5fd;
  --ins-primary-bg-subtle: rgba(59, 130, 246, 0.22);
  --ins-primary-border-subtle: rgba(59, 130, 246, 0.4);

  --ins-link-color: #93c5fd;
  --ins-link-color-rgb: 147, 197, 253;
  --ins-link-hover-color: #bfdbfe;
  --ins-link-hover-color-rgb: 191, 219, 254;

  --ins-body-bg: #0a1426;
  --ins-body-bg-rgb: 10, 20, 38;
  --ins-body-color: #aeb6c4;
  --ins-heading-color: #e8eef8;
  --ins-secondary-bg: #0f1d33;
  --ins-tertiary-bg: #16243d;
  --ins-border-color: #22324d;

  --ins-focus-ring-color: rgba(59, 130, 246, 0.35);
}

html[data-bs-theme=dark][data-topbar-color],
html[data-bs-theme=dark][data-topbar-color=light] {
  --ins-topbar-bg: #0f1d33;
  --ins-topbar-border-color: #22324d;
  --ins-topbar-item-color: #aeb6c4;
  --ins-topbar-item-hover-color: #93c5fd;
}

html[data-bs-theme=dark][data-menu-color],
html[data-bs-theme=dark][data-menu-color=dark] {
  --ins-sidenav-bg: #0c1830;
  --ins-sidenav-border-color: #16243d;
  --ins-sidenav-item-color: #9aa7c0;
  --ins-sidenav-item-hover-color: #e8eef8;
  --ins-sidenav-item-hover-bg: rgba(255, 255, 255, 0.06);
  --ins-sidenav-item-active-color: #ffffff;
  --ins-sidenav-item-active-bg: rgba(59, 130, 246, 0.22);
}

/* ── Chrome details ────────────────────────────────────────────────────────── */

/* Wordmark sizing: the SVGs are 291×53 (wordmark) and 94×68 (icon). */
.sidenav-menu .logo .logo-lg img,
.logo-topbar .logo-lg img {
  height: 26px;
  width: auto;
}
.sidenav-menu .logo .logo-sm img,
.logo-topbar .logo-sm img {
  height: 28px;
  width: auto;
}

/* Section labels in the sidebar (Communication / Configuration / …). */
.sidenav-menu .side-nav-title {
  color: #5e6b8a;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 600;
}

/* The signed-in operator block at the top of the sidebar. */
.sidenav-menu .ma-operator {
  margin: 0 12px 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.sidenav-menu .ma-operator .ma-operator-badge {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: rgba(59, 130, 246, 0.22);
  color: #bfdbfe;
  flex: none;
}
.sidenav-menu .ma-operator .ma-operator-name {
  color: #ffffff;
  font-weight: 600;
  display: block;
  line-height: 1.2;
}
.sidenav-menu .ma-operator .ma-operator-role {
  color: #9aa7c0;
  font-size: 11.5px;
}

/* Cards: the app's flat card with a hairline border, no drop shadow. */
.card {
  border: 1px solid var(--ins-border-color);
  box-shadow: none;
  border-radius: 12px;
}

/* "Managearo Admin" pill in the topbar — says where you are, at a glance. */
.ma-console-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ins-primary-text-emphasis);
  background: var(--ins-primary-bg-subtle);
  border: 1px solid var(--ins-primary-border-subtle);
}

/* ── Sign-in page (templates/master/security/login.html.twig) ─────────────────
   Mirrors the app's AuthShell: a dark indigo brand stage on the left with the drifting grid and
   module chips, the form rail on the right. */
.ma-auth {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}
.ma-auth > * {
  min-width: 0;
}
@media (min-width: 992px) {
  .ma-auth {
    grid-template-columns: minmax(0, 1fr) 480px;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }
}
@media (min-width: 1200px) {
  .ma-auth {
    grid-template-columns: minmax(0, 1fr) 560px;
  }
}

.ma-auth-stage {
  position: relative;
  display: none;
  overflow: hidden;
  color: #ffffff;
  background:
    radial-gradient(120% 90% at 12% 8%, rgba(60, 62, 176, 0.85) 0%, rgba(20, 21, 63, 0) 60%),
    radial-gradient(80% 70% at 92% 96%, rgba(154, 156, 240, 0.32) 0%, rgba(20, 21, 63, 0) 65%),
    #14153f;
}
@media (min-width: 992px) {
  .ma-auth-stage {
    display: block;
  }
}
.ma-auth-grid {
  position: absolute;
  inset: -10%;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.055) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(85% 75% at 30% 30%, #000 20%, transparent 100%);
  mask-image: radial-gradient(85% 75% at 30% 30%, #000 20%, transparent 100%);
  animation: ma-grid-drift 40s linear infinite;
}
@keyframes ma-grid-drift {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-64px, -64px, 0); }
}
.ma-auth-stage-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
  height: 100%;
  padding: 40px;
}
@media (min-width: 1200px) {
  .ma-auth-stage-inner {
    padding: 56px;
  }
}
.ma-auth-stage .ma-auth-logo {
  height: 34px;
  width: auto;
  opacity: 0.95;
  align-self: flex-start;
}
.ma-auth-kicker {
  margin: 0 0 16px;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #9a9cf0;
}
.ma-auth-headline {
  margin: 0 0 16px;
  font-size: clamp(34px, 3.4vw, 50px);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.02em;
  color: #ffffff;
}
.ma-auth-headline span {
  color: #9a9cf0;
}
.ma-auth-copy {
  max-width: 46ch;
  margin: 0;
  font-size: 17px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.7);
}
.ma-auth-facts {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 460px;
}
.ma-auth-facts-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
}
.ma-auth-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #5de3a4;
  animation: ma-dot-pulse 2.4s ease-out infinite;
}
@keyframes ma-dot-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(93, 227, 164, 0.5); }
  70%  { box-shadow: 0 0 0 9px rgba(93, 227, 164, 0); }
  100% { box-shadow: 0 0 0 0 rgba(93, 227, 164, 0); }
}
.ma-auth-fact {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(4px);
  animation: ma-fact-in 0.6s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}
.ma-auth-fact:nth-child(2) { animation-delay: 260ms; }
.ma-auth-fact:nth-child(3) { animation-delay: 480ms; }
.ma-auth-fact:nth-child(4) { animation-delay: 700ms; }
@keyframes ma-fact-in {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}
.ma-auth-fact-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 9px;
  background: rgba(154, 156, 240, 0.18);
  color: #cdcefb;
  font-size: 17px;
}
.ma-auth-fact-text {
  display: block;
  min-width: 0;
}
.ma-auth-fact-text b {
  display: block;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #ffffff;
}
.ma-auth-fact-text small {
  display: block;
  margin-top: 2px;
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.55);
}
.ma-auth-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ma-auth-chip {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.7);
}

.ma-auth-rail {
  height: 100%;
  overflow-y: auto;
  background: var(--ins-secondary-bg);
}
@media (min-width: 992px) {
  .ma-auth-rail {
    border-left: 1px solid var(--ins-border-color);
  }
}
.ma-auth-rail-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100%;
  padding: 36px 24px;
}
@media (min-width: 576px) {
  .ma-auth-rail-inner { padding: 36px 40px; }
}
@media (min-width: 1200px) {
  .ma-auth-rail-inner { padding: 36px 64px; }
}
.ma-auth-rail .ma-auth-logo-small {
  height: 44px;
  width: auto;
  margin-top: 8px;
}
@media (min-width: 992px) {
  .ma-auth-rail .ma-auth-logo-small { display: none; }
}
.ma-auth-form {
  width: 100%;
  max-width: 380px;
  margin: auto 0;
  padding: 36px 0;
}
.ma-auth-badge {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  border-radius: 12px;
  background: var(--ins-primary-bg-subtle);
  color: var(--ins-primary);
  font-size: 24px;
}
.ma-auth-title {
  margin: 0 0 8px;
  text-align: center;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ins-heading-color);
}
.ma-auth-subtitle {
  margin: 0 0 28px;
  text-align: center;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--ins-secondary-color, #5e6b8a);
}
.ma-auth-form .form-label {
  font-weight: 500;
  color: var(--ins-heading-color);
}
.ma-auth-form .form-control,
.ma-auth-form .input-group-text {
  padding-top: 0.6rem;
  padding-bottom: 0.6rem;
}
.ma-auth-form .btn-primary {
  padding-top: 0.65rem;
  padding-bottom: 0.65rem;
  font-weight: 600;
  border-radius: 8px;
}
.ma-auth-foot {
  text-align: center;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--ins-secondary-color, #5e6b8a);
}
.ma-auth-foot a {
  color: inherit;
}
.ma-auth-foot a:hover {
  text-decoration: underline;
}

@media (prefers-reduced-motion: reduce) {
  .ma-auth-grid,
  .ma-auth-live-dot,
  .ma-auth-fact {
    animation: none;
  }
}
