/* ==========================================================================
   DASHBOARD PROGETTI EMANUELE — SISTEMA ESECUTIVO BOOTSTRAP 5
   Standard Direttivi Antigravity & Codex:
   - Accessibilità Monoculare: NESSUN testo inferiore a 15-16px (!important)
   - Alto Contrasto: Zero grigi sbiaditi, leggibilità netta (WCAG AAA)
   - Nativamente silenziosa (Zero audio)
   - Componenti modulari, Drag & Drop nativo HTML5 e persistenza locale
   ========================================================================== */

:root {
  --bs-body-font-size: 16px;
  --bs-body-bg: #f8fafc;
  --bs-body-color: #0f172a;
  --font-kpi: 44px;
}

html, body {
  font-size: 16px !important;
  background-color: var(--bs-body-bg) !important;
  color: var(--bs-body-color) !important;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   REGOLA FERREA ACCESSIBILITÀ: BANDO ASSOLUTO AL TESTO MICROSCOPICO (< 15px)
   ========================================================================== */
*, *::before, *::after {
  font-size-adjust: none;
}

small, .small, 
code, kbd, samp, 
.badge, 
.btn, .btn-sm, 
.form-control, .form-control-sm, 
.form-text, 
.alert, 
.tooltip, 
.popover, 
.toast-body, 
.progress-bar,
.nav-link {
  font-size: 15px !important;
}

/* Override Contrasto Elevato: banditi grigi chiari e finti attenuati */
.text-muted {
  color: #475569 !important; /* Slate 600 ad alto contrasto */
  font-weight: 600;
}

.text-secondary {
  color: #334155 !important; /* Slate 700 */
  font-weight: 600;
}

/* ==========================================================================
   COMPONENTI CARD & STRUTTURA BOOTSTRAP 5
   ========================================================================== */
.card {
  border: 1.5px solid #cbd5e1 !important;
  border-radius: 12px !important;
  background-color: #ffffff !important;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04) !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
  border-color: #64748b !important;
}

.card-header {
  background-color: #ffffff !important;
  border-bottom: 1.5px solid #e2e8f0 !important;
  padding: 14px 18px !important;
}

.card-title {
  font-size: 18px !important;
  font-weight: 800 !important;
  color: #0f172a !important;
  margin-bottom: 0 !important;
  letter-spacing: -0.01em;
}

.badge {
  font-weight: 800 !important;
  padding: 0.4em 0.75em !important;
  border-radius: 6px !important;
  letter-spacing: 0.01em;
}

.btn {
  font-weight: 800 !important;
  border-radius: 8px !important;
  padding: 8px 16px;
  transition: all 0.15s ease;
}

.btn-sm {
  padding: 5px 12px !important;
}

/* Nav Pills Esecutive */
.nav-pills .nav-link {
  font-size: 16px !important;
  font-weight: 800 !important;
  color: #334155 !important;
  border-radius: 8px !important;
  padding: 8px 18px !important;
  transition: all 0.15s ease-in-out;
}

.nav-pills .nav-link:hover {
  background-color: #e2e8f0 !important;
  color: #0f172a !important;
}

.nav-pills .nav-link.active {
  background-color: #0f172a !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.25) !important;
}

/* Tab Views */
.tab-view {
  display: none;
}

.tab-view.active {
  display: block;
}

/* Pill Stato Sincronizzazione */
.sync-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 15px !important;
  font-weight: 800;
  color: #0f172a;
}

.pulse-dot {
  width: 10px;
  height: 10px;
  background-color: #059669;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px #059669;
}

/* ==========================================================================
   CANVAS DRAG & DROP ESECUTIVO
   ========================================================================== */
.widget-slot {
  cursor: default;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.widget-slot.dragging {
  opacity: 0.4;
  border: 2px dashed #0284c7 !important;
  transform: scale(0.99);
}

.widget-slot.drag-over {
  border: 2.5px solid #0284c7 !important;
  box-shadow: 0 0 16px rgba(2, 132, 199, 0.25) !important;
}

.widget-drag-handle {
  cursor: grab;
  font-size: 20px !important;
  color: #64748b;
  padding: 4px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.widget-drag-handle:hover {
  color: #0f172a;
  background-color: #e2e8f0;
}

.widget-drag-handle:active {
  cursor: grabbing;
}

/* ==========================================================================
   INDICATORI ESECUTIVI (KPI CHIP CARDS)
   ========================================================================== */
.kpi-chip-card {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  transition: all 0.15s ease;
}

.kpi-chip-card:hover {
  transform: translateY(-2px);
  border-color: #64748b;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
}

.kpi-chip-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 15px !important;
  font-weight: 800;
  color: #334155;
}

.kpi-chip-number {
  font-size: var(--font-kpi) !important;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.kpi-chip-footer {
  font-size: 15px !important;
  font-weight: 700;
  color: #475569;
  border-top: 1px solid #f1f5f9;
  padding-top: 8px;
}

/* ==========================================================================
   GRAFICO RITMO PUSH GITHUB (SVG/CSS ISTOGRAMMA)
   ========================================================================== */
.clean-histogram-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  height: 190px;
  padding: 18px 14px 10px 14px;
  background: #f8fafc;
  border-radius: 10px;
  border: 1.5px solid #cbd5e1;
  gap: 12px;
}

.clean-hist-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  gap: 8px;
}

.clean-hist-pill {
  font-size: 15px !important;
  font-weight: 800;
  color: #0369a1;
  background: #ffffff;
  padding: 2px 8px;
  border-radius: 9999px;
  border: 1.5px solid #cbd5e1;
}

.clean-hist-bar {
  width: 100%;
  max-width: 48px;
  background: linear-gradient(180deg, #0284c7 0%, #38bdf8 100%);
  border-radius: 6px 6px 0 0;
  transition: all 0.2s ease;
  cursor: pointer;
  min-height: 14px;
}

.clean-hist-bar:hover {
  background: #0369a1;
  transform: scaleY(1.05);
}

.clean-hist-date {
  font-size: 15px !important;
  font-weight: 800;
  color: #334155;
}

/* ==========================================================================
   GRAFICO DONUT STACK TECNOLOGICO
   ========================================================================== */
.clean-donut-layout {
  display: flex;
  align-items: center;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: 20px;
}

.clean-legend-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-width: 220px;
}

.clean-legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: #ffffff;
  border-radius: 8px;
  border: 1.5px solid #cbd5e1;
  font-size: 15px !important;
}

/* ==========================================================================
   MATRICE 17 PROGETTI AI LOCALI
   ========================================================================== */
.clean-matrix-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 4px;
}

.clean-matrix-chip {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  transition: all 0.15s ease;
}

.clean-matrix-chip.clean {
  border-left: 6px solid #059669 !important;
}

.clean-matrix-chip.dirty {
  border-left: 6px solid #dc2626 !important;
  background-color: #fff1f2;
}

.clean-matrix-chip:hover {
  transform: translateY(-2px);
  border-color: #64748b;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

/* ==========================================================================
   GRIGLIA REPOSITORY GITHUB
   ========================================================================== */
.clean-repo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.clean-repo-card {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  transition: all 0.15s ease;
}

.clean-repo-card:hover {
  border-color: #0284c7;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

.clean-repo-title {
  font-size: 17px !important;
  font-weight: 800 !important;
  color: #0f172a;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.clean-repo-title:hover {
  color: #0284c7;
}

/* ==========================================================================
   COMPOSITORE / PALETTE MODULI (OFFCANVAS BOOTSTRAP)
   ========================================================================== */
.offcanvas {
  width: 440px !important;
  border-left: 2px solid #cbd5e1 !important;
}

.palette-item {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  cursor: grab;
  transition: all 0.15s ease;
}

.palette-item:hover {
  border-color: #0284c7;
  transform: translateX(-3px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

.palette-item.active-on-canvas {
  background: #f8fafc;
  opacity: 0.9;
}
