/* components.css — pezzi riusabili: glass, bottoni, modali, toast, bottom-nav.
   Nessuno stile specifico di sezione. Espanso nelle fasi UI (3-7). */

/* ===== Glass card ===== */
.glass {
  background: var(--panel);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 12px 40px rgba(0, 0, 0, 0.35);
}
.glass-strong {
  background: rgba(22, 22, 34, 0.75);
  backdrop-filter: blur(24px) saturate(1.3);
  -webkit-backdrop-filter: blur(24px) saturate(1.3);
  border: 1px solid var(--panel-border-strong);
  border-radius: 18px;
}

/* ===== Bottoni ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 12px;
  font-weight: 500;
  font-size: 14px;
  transition: all 180ms ease;
  cursor: pointer;
  border: 1px solid transparent;
  user-select: none;
}
.btn-primary {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: white;
  box-shadow: 0 8px 24px -8px rgba(124, 58, 237, 0.7);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 32px -8px rgba(124, 58, 237, 0.85);
}
.btn-primary:active { transform: translateY(0); }
.btn-ghost {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--panel-border);
  color: var(--text);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.08); border-color: var(--panel-border-strong); }
.btn-danger {
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: #fca5a5;
}
.btn-danger:hover { background: rgba(248, 113, 113, 0.2); }

/* ===== Modali ===== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  animation: fadeIn 200ms ease-out;
}
/* Lock screen: invisibile durante il prompt biometrico, rivelata al fallback PIN. */
.modal-overlay.lock-silent { opacity: 0; pointer-events: none; }
.modal-overlay.lock-reveal { opacity: 1; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 88px; left: 50%; transform: translateX(-50%);
  z-index: 200;
  padding: 12px 18px; border-radius: 12px;
  background: rgba(20, 20, 30, 0.95);
  border: 1px solid var(--panel-border-strong);
  backdrop-filter: blur(12px);
  color: #fff; font-size: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  animation: slideUp 280ms cubic-bezier(.2, .8, .2, 1);
}
.toast-success { border-color: rgba(74, 222, 128, 0.4); }
.toast-error { border-color: rgba(248, 113, 113, 0.4); }

/* ===== Layout app: contenuto tab + bottom-nav ===== */
.tab-content {
  min-height: 100vh;
  padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  /* Schermo opaco come nei mockup: il mesh resta solo dietro i modali. */
  background: #0d0d12;
}

/* ===== Bottom-nav a 4 voci ===== */
.bnav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 90;
  display: flex;
  background: rgba(13, 13, 18, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid rgba(124, 58, 237, 0.18);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.bnav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 4px 10px;
  background: transparent;
  border: 0;
  color: rgba(229, 229, 245, 0.55);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: color 160ms ease;
  min-height: 56px;
}
.bnav-item:hover, .bnav-item:active { color: rgba(229, 229, 245, 0.85); }
.bnav-item.active {
  color: #a78bfa;
  position: relative;
}
.bnav-item.active::before {
  content: '';
  position: absolute;
  top: 0; left: 25%; right: 25%;
  height: 2px;
  border-radius: 0 0 2px 2px;
  background: linear-gradient(90deg, transparent 0%, #7c3aed 50%, transparent 100%);
}

/* ===== Placeholder di sezione (Fase 1 — sostituito dalle sezioni reali) ===== */
.section-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
  padding: 24px;
}
.section-placeholder-card {
  padding: 28px 32px;
  text-align: center;
  max-width: 360px;
}
.section-placeholder-card h2 {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}
.section-placeholder-card p {
  margin: 0;
  font-size: 14px;
  color: var(--text-dim);
}

/* ===== Modale a tutto schermo: scheda agente + Evoca (guscio Fase 6) ===== */
.agent-modal {
  position: fixed; inset: 0; z-index: 95;
  background: #0d0d12;
  display: flex; flex-direction: column;
  animation: fadeIn 180ms ease-out;
}
.agent-tb {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 15px;
  padding-top: calc(13px + env(safe-area-inset-top, 0px));
  flex-shrink: 0; border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.agent-x {
  font-size: 20px; line-height: 1; color: #cfc6e6;
  background: 0; border: 0; cursor: pointer; padding: 0 2px; width: 22px;
}
.agent-tb-t { font-size: 15px; font-weight: 800; color: #fff; }
.agent-bd {
  flex: 1; overflow-y: auto;
  padding: 10px 14px calc(28px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 13px;
}
.agent-loading { text-align: center; color: var(--text-dim); font-size: 13px; padding: 32px; }

/* --- Scheda agente --- */
.agent-hero {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 8px 0 0;
}
.agent-av {
  width: 70px; height: 70px; border-radius: 50%;
  border: 2px solid; display: flex; align-items: center; justify-content: center;
  font-size: 32px;
}
.agent-nm { font-size: 18px; font-weight: 800; color: #fff; }
.agent-mt { font-size: 12px; color: var(--text-dim); }
.agent-sline {
  align-self: center; display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--text-dim);
  background: rgba(255, 255, 255, 0.04); padding: 4px 11px; border-radius: 11px;
}
.agent-d { width: 6px; height: 6px; border-radius: 50%; }

.agent-qa { display: flex; gap: 8px; }
.agent-qabtn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 9px 4px; background: #15151c;
  border: 1px solid #24242e; border-radius: 12px; cursor: pointer;
}
.agent-qabtn:hover { border-color: rgba(124, 58, 237, 0.4); }
.agent-qabtn .qi { font-size: 16px; }
.agent-qabtn .ql { font-size: 9.5px; font-weight: 700; color: #cfc6e6; }

.agent-stats { display: flex; gap: 8px; }
.agent-stat {
  flex: 1; background: #15151c; border: 1px solid #22222c;
  border-radius: 12px; padding: 9px 6px; text-align: center;
}
.agent-stat .sv { font-size: 15px; font-weight: 800; color: #fff; }
.agent-stat .sk {
  font-size: 8.5px; color: var(--text-dim); margin-top: 1px;
  text-transform: uppercase; letter-spacing: 0.5px;
}

.agent-glab {
  display: flex; align-items: center; gap: 7px;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.2px;
  color: rgba(255, 255, 255, 0.33); font-weight: 700; margin: 0 0 6px 4px;
}
.agent-row {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 11px 12px; text-align: left;
  background: transparent; border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.035); cursor: pointer;
}
.agent-row:last-child { border-bottom: none; }
.agent-row:hover { background: rgba(255, 255, 255, 0.03); }
.agent-ic {
  width: 32px; height: 32px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; flex-shrink: 0;
}
.agent-rl { flex: 1; min-width: 0; }
.agent-rt { font-size: 13px; font-weight: 700; color: #ececf0; }
.agent-rs { font-size: 10.5px; color: var(--text-dim); margin-top: 1px; }
.agent-chev { color: rgba(255, 255, 255, 0.18); font-size: 15px; }
.agent-tg {
  width: 36px; height: 20px; border-radius: 10px;
  position: relative; flex-shrink: 0; border: 0; cursor: pointer;
}
.agent-tg.on { background: linear-gradient(135deg, #7c3aed, #ec4899); }
.agent-tg.off { background: #33333f; }
.agent-tg::after {
  content: ''; position: absolute; width: 15px; height: 15px;
  border-radius: 50%; background: #fff; top: 2.5px; transition: all 160ms;
}
.agent-tg.on::after { right: 2.5px; }
.agent-tg.off::after { left: 2.5px; }
.agent-danger {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 12px; background: #15151c;
  border: 1px solid #22222c; border-radius: 14px; cursor: pointer;
}
.agent-danger.warn { border-color: rgba(251, 191, 36, 0.2); }
.agent-danger.warn .agent-rt { color: #f5d488; }
.agent-danger.del { border-color: rgba(236, 72, 153, 0.2); }
.agent-danger.del .agent-rt { color: #f78ba8; }

/* --- Evoca un compagno --- */
.evoca-preview {
  background: #13131a; border: 1px solid #2c2740;
  border-radius: 14px; padding: 4px;
}
.evoca-pvlab {
  font-size: 9px; font-weight: 800; letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.27); padding: 6px 8px 2px;
}
.evoca-pvrow {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; position: relative;
}
.evoca-pvrow::before {
  content: ''; position: absolute; left: 0; top: 11px; bottom: 11px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--c, #7c3aed);
}
.evoca-pvav {
  width: 42px; height: 42px; border-radius: 50%;
  border: 2px solid; display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.evoca-pvname { font-size: 14px; font-weight: 700; color: #f3f3f5; }
.evoca-pvstate { font-size: 11px; color: var(--text-dim); margin-top: 1px; }
.evoca-avwrap {
  align-self: center;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
}
.evoca-avpick {
  width: 78px; height: 78px; border-radius: 50%;
  border: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 22px rgba(124, 58, 237, 0.4);
}
.evoca-avpick .e { font-size: 34px; line-height: 1; }
.evoca-avcap {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.3px;
  color: rgba(255, 255, 255, 0.42);
}
.evoca-flbl {
  font-size: 11px; color: rgba(255, 255, 255, 0.4);
  font-weight: 700; margin: 0 0 5px 3px;
}
.evoca-flbl .dim { color: rgba(255, 255, 255, 0.2); font-weight: 400; }
.evoca-fld {
  width: 100%; background: #070709;
  border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 12px;
  padding: 10px 13px; font-size: 12.5px; color: var(--text);
  font-family: inherit; outline: 0;
}
.evoca-fld:focus { border-color: rgba(124, 58, 237, 0.5); }
.evoca-fld::placeholder { color: rgba(255, 255, 255, 0.28); }
.evoca-tpl { display: flex; flex-wrap: wrap; gap: 7px; }
.evoca-chip {
  font-size: 11px; font-weight: 700; padding: 7px 11px;
  border-radius: 10px; background: #15151c;
  border: 1px solid #2a2a36; color: #bdbdc6; cursor: pointer;
}
.evoca-chip.sel { background: rgba(124, 58, 237, 0.15); border-color: #7c3aed; color: #d9c9f7; }
.evoca-tdesc { font-size: 10.5px; color: #a78bfa; margin: 7px 0 0 4px; }
.evoca-opt {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 12px; background: #15151c;
  border: 1px solid #22222c; border-radius: 12px; cursor: pointer;
}
.evoca-opt .ol { flex: 1; text-align: left; font-size: 12.5px; color: #ececf0; font-weight: 600; }
.evoca-opt .ov { font-size: 11.5px; color: #a78bfa; font-weight: 700; }
.evoca-intel { display: flex; gap: 7px; }
.evoca-icard {
  flex: 1; text-align: center; padding: 8px 4px;
  border-radius: 11px; background: #15151c;
  border: 1px solid #2a2a36; cursor: pointer;
}
.evoca-icard.sel { background: rgba(124, 58, 237, 0.13); border-color: #7c3aed; }
.evoca-icard .in { font-size: 12px; font-weight: 800; color: #fff; }
.evoca-icard .id { font-size: 8.5px; color: var(--text-dim); margin-top: 2px; }
.evoca-dots { display: flex; gap: 9px; padding: 2px; }
.evoca-dot {
  width: 24px; height: 24px; border-radius: 50%;
  border: 0; cursor: pointer; padding: 0;
}
.evoca-dot.sel { box-shadow: 0 0 0 2px #0d0d12, 0 0 0 4px #fff; }
.evoca-btn {
  padding: 13px; border-radius: 14px; border: 0; cursor: pointer;
  background: linear-gradient(135deg, #7c3aed, #ec4899);
  font-size: 14px; font-weight: 800; color: #fff;
  box-shadow: 0 10px 26px rgba(124, 58, 237, 0.45);
}

/* --- Selettore a fogliotto (avatar, indole) --- */
.evoca-sheet-bk {
  position: fixed; inset: 0; z-index: 110;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn 160ms ease-out;
}
.evoca-sheet {
  width: 100%; max-width: 520px;
  background: #15151c;
  border: 1px solid #2a2a36; border-bottom: 0;
  border-radius: 18px 18px 0 0;
  padding: 8px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  max-height: 75vh; overflow-y: auto;
  animation: slideUp 200ms ease-out;
}
.evoca-sheet-grab {
  width: 36px; height: 4px; border-radius: 2px;
  background: rgba(255, 255, 255, 0.18);
  margin: 4px auto 12px;
}
.evoca-sheet-t {
  font-size: 13px; font-weight: 800; color: #fff;
  margin: 0 0 12px 2px;
}
.evoca-pkgrid {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 9px;
}
.evoca-pktile {
  aspect-ratio: 1; border-radius: 13px;
  background: #0d0d12; border: 1px solid #2a2a36;
  font-size: 26px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.evoca-pktile.sel { background: rgba(124, 58, 237, 0.16); border-color: #7c3aed; }
.evoca-pklist { display: flex; flex-direction: column; gap: 7px; }
.evoca-pkrow {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 12px 13px; background: #0d0d12;
  border: 1px solid #2a2a36; border-radius: 12px; cursor: pointer;
}
.evoca-pkrow .t { flex: 1; text-align: left; font-size: 13px; color: #ececf0; font-weight: 600; }
.evoca-pkrow .ck { font-size: 13px; color: #a78bfa; opacity: 0; font-weight: 800; }
.evoca-pkrow.sel { background: rgba(124, 58, 237, 0.13); border-color: #7c3aed; }
.evoca-pkrow.sel .ck { opacity: 1; }
