/*
 * M ITALIA NEXT — stili condivisi
 * Theme base, body background, tipografia, menu drawer.
 * Le pagine specifiche aggiungono layout (grid, card, sezioni).
 * NON applicare a index.html (dashboard cliente, tema rosso indipendente).
 */
@import url("https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@500;600;700;800&family=Titillium+Web:wght@400;600;700&display=swap");

:root {
  --bg: #050505;
  --panel: rgba(30, 33, 36, 0.9);
  --line: rgba(255, 255, 255, 0.16);
  --text: #f2f2f2;
  --muted: #a5adb7;
  --ok: #1f9d55;
  --warn: #ffb300;
  --danger: #d20a10;
  --anthracite: #23272e;
  --anthracite-2: #2e333b;
  --black-soft: #0d0f12;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Titillium Web", Inter, Arial, sans-serif;
  background:
    radial-gradient(circle at 10% -5%, rgba(210, 10, 16, 0.2), transparent 34%),
    linear-gradient(145deg, #020202 0%, #08090b 46%, #101317 100%);
  color: var(--text);
  min-height: 100vh;
}

h1, h2 {
  font-family: "Barlow Condensed", Arial, sans-serif;
  letter-spacing: 0.4px;
}

/* ---------- Topnav + menu drawer (admin / magazzino) ---------- */
.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 8px 0 14px;
}

.topnav-brand {
  display: block;
  width: min(260px, 52vw);
  max-height: 56px;
  object-fit: contain;
}

.topnav-brand-home {
  cursor: pointer;
}

.menu-toggle {
  margin: 0;
  min-height: 36px;
  min-width: 36px;
  width: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.menu-toggle-lines {
  width: 22px;
  height: 16px;
  display: grid;
  align-content: space-between;
}

.menu-toggle-lines span {
  display: block;
  height: 2px;
  width: 100%;
  border-radius: 999px;
  background: var(--danger);
}

.menu-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
  z-index: 1050;
}

.menu-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(320px, 86vw);
  height: 100vh;
  background: #111317;
  border-left: 1px solid var(--line);
  padding: 16px;
  transform: translateX(100%);
  transition: transform 240ms ease;
  z-index: 1060;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.menu-drawer.is-open { transform: translateX(0); }
.menu-drawer-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.menu-drawer a,
.menu-drawer .menu-link {
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: linear-gradient(120deg, #1c2027, #272d36);
  font-size: 14px;
}

.menu-drawer button.menu-link {
  width: 100%;
  text-align: left;
  font-family: inherit;
  cursor: pointer;
}

.menu-drawer-title {
  margin: 0 0 4px 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.menu-drawer-divider {
  margin: 8px 0 4px;
  border: 0;
  border-top: 1px solid var(--line);
}

.menu-link {
  display: flex;
  align-items: center;
  gap: 10px;
}

.menu-link i {
  color: var(--danger);
  font-size: 16px;
  line-height: 1;
}

.menu-link.is-active {
  border-color: rgba(210, 10, 16, 0.6);
  background: linear-gradient(120deg, rgba(210, 10, 16, 0.22), rgba(210, 10, 16, 0.08));
}

.menu-link.menu-link-logout {
  border-color: rgba(210, 10, 16, 0.55);
  background: linear-gradient(120deg, rgba(210, 10, 16, 0.18), rgba(143, 36, 43, 0.12));
}

.menu-link.menu-link-logout i {
  color: #ff8e92;
}

.menu-close-icon-btn {
  align-self: flex-end;
  width: 42px;
  min-width: 42px;
  min-height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.menu-close-icon-btn i {
  font-size: 19px;
  line-height: 1;
}

/* ---------- Summary banner condiviso (admin + planning) ---------- */
.summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 18px 0;
}

.summary-tile {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  backdrop-filter: blur(10px);
}

.summary-label {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.summary-value {
  margin: 4px 0 0 0;
  font-family: "Barlow Condensed", Arial, sans-serif;
  font-size: 30px;
  line-height: 1;
  font-weight: 800;
}

.summary-tile.valid .summary-value { color: #7de0a4; }
.summary-tile.warning .summary-value { color: #ffd57a; }
.summary-tile.expired .summary-value { color: #ff8a8e; }
.summary-tile.total .summary-value { color: var(--text); }

.summary.is-loading .summary-value {
  color: var(--muted);
  opacity: 0.55;
  animation: summary-pulse 1.1s ease-in-out infinite;
}

@keyframes summary-pulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 0.75; }
}

@media (max-width: 760px) {
  .summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
