/* ══════════════════════════════════════════════════
   BMS Engagement — Journey Builder POC
   ══════════════════════════════════════════════════ */

/* ─── Reset & Base ─────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f0f2f5;
  color: #1a2332;
  margin: 0;
}

/* ─── Layout ────────────────────────────────────── */
.app-container {
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  overflow-y: auto;
  min-width: 0;
}

/* ─── Sidebar ───────────────────────────────────── */
.sidebar {
  width: 250px;
  min-height: 100vh;
  background: #111827;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-header {
  padding: 24px 20px 12px;
}

.sidebar-logo {
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #3b82f6;
  font-weight: 700;
  margin-bottom: 4px;
}

.sidebar-title {
  font-size: 15px;
  font-weight: 700;
  color: #f9fafb;
  margin: 0;
  line-height: 1.3;
}

.sidebar-subtitle {
  font-size: 11px;
  color: #6b7280;
  margin: 3px 0 0;
}

.sidebar-divider {
  border-color: #1f2937;
  margin: 8px 0;
}

.sidebar-nav {
  padding: 4px 10px;
}

.sidebar-nav .nav-link,
.sidebar-link {
  color: #9ca3af !important;
  font-size: 14px;
  border-radius: 8px;
  padding: 9px 12px !important;
  margin-bottom: 2px;
  transition: background 0.15s, color 0.15s;
  display: flex;
  align-items: center;
  text-decoration: none;
}

.sidebar-nav .nav-link:hover {
  color: #f9fafb !important;
  background: #1f2937;
}

.sidebar-nav .nav-link.active {
  color: #fff !important;
  background: #2563eb !important;
  font-weight: 500;
}

.sidebar-link-disabled {
  color: #374151;
  font-size: 14px;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  cursor: default;
  user-select: none;
}

.sidebar-coming-soon {
  display: flex;
  align-items: center;
  margin-bottom: 2px;
  border-radius: 8px;
  padding: 0 2px;
}

/* ─── Pages ─────────────────────────────────────── */
.page-container {
  padding: 32px 40px;
  max-width: 1200px;
}
/* Wizard Journey Builder: sfrutta più spazio orizzontale (mappa + form). */
.page-container-wide {
  max-width: 1440px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 4px;
}

.page-subtitle {
  color: #6b7280;
  font-size: 14px;
  margin-bottom: 28px;
}

.section-title {
  font-size: 15px;
  font-weight: 600;
  color: #111827;
}

/* ─── KPI cards ─────────────────────────────────── */
.kpi-card {
  border: 1px solid #e5e7eb !important;
  border-radius: 12px !important;
  background: #fff !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06) !important;
}

.kpi-icon {
  font-size: 26px;
  flex-shrink: 0;
}

.kpi-value {
  font-size: 26px;
  font-weight: 700;
  color: #111827;
}

.kpi-label {
  font-size: 12px;
}

/* ─── Journey table ─────────────────────────────── */
.journey-table th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #6b7280;
  font-weight: 600;
  border-top: none;
}

.journey-table td {
  font-size: 14px;
  vertical-align: middle;
}

/* ─── Wizard progress ───────────────────────────── */
.wizard-progress {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.wizard-step {
  flex: 1;
  min-width: 80px;
  padding: 8px 6px;
  text-align: center;
  background: #e5e7eb;
  border-radius: 8px;
  font-size: 12px;
  color: #9ca3af;
  font-weight: 500;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.wizard-step.active {
  background: #2563eb;
  color: #fff;
  font-weight: 600;
}

.wizard-step.done {
  background: #d1fae5;
  color: #065f46;
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  font-size: 11px;
  font-weight: 700;
}

/* ─── Wizard card ───────────────────────────────── */
.wizard-card {
  border: 1px solid #e5e7eb !important;
  border-radius: 12px !important;
  background: #fff !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06) !important;
}

.step-title {
  font-size: 17px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 4px;
}

.wizard-nav {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ─── Template cards ─────────────────────────────── */
.template-card {
  border: 2px solid #e5e7eb !important;
  border-radius: 12px !important;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
  background: #fff !important;
}

.template-card:hover {
  border-color: #2563eb !important;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1) !important;
  transform: translateY(-1px);
}

.template-card.selected {
  border-color: #2563eb !important;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.15) !important;
  background: #eff6ff !important;
}

.template-icon {
  font-size: 22px;
  flex-shrink: 0;
}

.template-label {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
}

.template-desc {
  font-size: 12px;
  line-height: 1.4;
}

.template-type-badge {
  font-size: 10px !important;
  border: 1px solid #e5e7eb !important;
}

/* ─── Player cards ───────────────────────────────── */
.player-card {
  border: 1px solid #e5e7eb !important;
  border-radius: 12px !important;
  background: #fff !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06) !important;
}

/* ─── Utilities ──────────────────────────────────── */
.badge { font-weight: 500 !important; }

/* ── Step form ────────────────────────────────────────────────────────────── */
.form-check-label { font-size: 14px; }
.form-check-input:checked { background-color: #2563eb; border-color: #2563eb; }
.input-group-text { background: #f8f9fa; color: #6b7280; font-size: 14px; }
.form-control, .form-select { font-size: 14px; }
.form-control:focus, .form-select:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}
#s2-aud-preview .alert { font-size: 14px; border-radius: 8px; }

/* ── Step 4 cards ─────────────────────────────────────────────────────────── */
.step-card {
  border: 1px solid #e5e7eb !important;
  border-radius: 10px !important;
  background: #fafafa !important;
}

/* ── Preview step ──────────────────────────────────────────────────────────── */
.preview-step {
  border-left: 3px solid #2563eb;
  padding-left: 12px;
}

/* ── Template card (html.Div) ────────────────────────────────────────────── */
.template-card {
  padding: 16px !important;
}

/* ── Context banner ─────────────────────────────────────────────────────── */
.context-banner {
  background: #f8f9fa !important;
  border-color: #dee2e6 !important;
  font-size: 13px;
}

/* ── Step sections (condizione / premio) ─────────────────────────────────── */
.step-section {
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.step-section-cond {
  background: #f0f5ff;
  border-left: 3px solid #2563eb;
}
.step-section-reward {
  background: #fffbeb;
  border-left: 3px solid #f59e0b;
}
.step-section-title {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}
.step-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: #6b7280;
}

/* ── Mission step card header ────────────────────────────────────────────── */
.mission-step-card {
  border: 1px solid #e5e7eb !important;
  border-radius: 10px !important;
  overflow: hidden;
}
.step-card-header {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}
.step-num-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}
.step-title-input {
  border: none !important;
  background: transparent !important;
  font-weight: 600 !important;
  font-size: 14px !important;
  padding: 0 8px !important;
  box-shadow: none !important;
}
.step-title-input:focus {
  background: #fff !important;
  border-bottom: 1px solid #2563eb !important;
  border-radius: 0 !important;
}
.btn-icon {
  width: 28px;
  height: 28px;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px !important;
}
.form-label-sm {
  font-size: 12px;
  font-weight: 600;
  color: #4b5563;
  margin-bottom: 4px;
}

/* ── Journey tree mini-map ───────────────────────────────────────────────── */
.tree-minimap {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 8px;
  min-height: 60px;
}
.tree-minimap-empty {
  background: #f9fafb;
  border: 1px dashed #d1d5db;
  border-radius: 10px;
  padding: 12px;
  text-align: center;
}
/* Pannello tree wizard */
.tree-panel-left {
  border-right: 1px solid #e5e7eb;
  padding-right: 16px;
  min-height: 300px;
}
.tree-panel-right {
  padding-left: 16px;
}
.tree-node-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.tree-no-node-selected {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: #9ca3af;
  font-size: 14px;
  text-align: center;
}

/* ── Action slots ────────────────────────────────────────────────────────── */
/* Neutri: il colore è riservato ai rami SÌ/NO e alla selezione (vedi mappa). */
.action-slot {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-left: 3px solid #e5e7eb;
}
.step-section-actions {
  background: #f9fafb;
  border-left: 3px solid #e5e7eb;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 12px;
}

/* ── Nuovo modello nodo (state machine) ───────────────────────────────────── */
.step-section-actions-arrival {
  background: #f9fafb;
  border-left: 3px solid #e5e7eb;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.step-section-yes-cond {
  background: #f9fafb;
  border-left: 3px solid #e5e7eb;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
/* Edge label hint */
.edge-condition-hint {
  font-size: 10px;
  color: #6b7280;
  font-family: monospace;
}

/* ── Template use-case cards (step 1) ───────────────────────────────────── */
.template-card-horizontal {
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  padding: 18px 20px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .12s, transform .1s;
  margin-bottom: 12px;
}
.template-card-horizontal:hover {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
  transform: translateY(-1px);
}
.template-card-horizontal.selected {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
  background: #eff6ff;
}
.template-use-icon  { font-size: 2rem; }
.template-highlights { color: #6b7280; font-size: 12px; margin-top: 4px; }
.template-select-indicator .bi { font-size: 1.5rem; opacity: .3; transition: opacity .15s; }
.template-card-horizontal.selected .template-select-indicator .bi { opacity: 1; }
.template-card-horizontal:hover .template-select-indicator .bi { opacity: .7; }
.template-icon-circle {
  width: 52px; height: 52px;
  background: #f3f4f6;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
/* Badge "modifiche non salvate" nel form nodo (step 4) */
.s4n-unsaved-badge {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  color: #b45309;
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: 4px 10px;
}

/* Titolo sezione step 1 */
.step1-section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #6b7280;
  margin-bottom: 14px;
}

/* Bottone journey personalizzato — coerente con le card (bordo dashed = "da zero") */
.template-custom-btn {
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  background: #fff;
  padding: 18px 20px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
  transition: border-color .15s, box-shadow .12s, transform .1s, background .12s;
}
.template-custom-btn:hover {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
  transform: translateY(-1px);
}
.template-custom-btn.selected {
  border: 2px solid #2563eb;
  background: #eff6ff;
}
.template-custom-btn.selected .template-select-indicator .bi { opacity: 1; }
.template-custom-btn:hover .template-select-indicator .bi { opacity: .7; }

/* ── Preview node cards ──────────────────────────────────────────────────── */
.preview-node-card {
  border: 1px solid #e5e7eb !important;
  border-radius: 8px !important;
  border-left: 3px solid #2563eb !important;
  font-size: 13px;
}
.preview-node-card .card-header {
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  font-size: 13px;
}
.preview-node-card .card-body {
  font-size: 12px;
}
