/* Omni Analytics — Main CSS */

:root {
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --success: #16a34a;
  --error: #dc2626;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --radius: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

/* --- Navbar --- */
.navbar {
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1.5rem;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 4px rgba(0,0,0,.15);
}
.navbar-brand { font-weight: 700; font-size: 1.1rem; letter-spacing: -.3px; }
.navbar-tenant {
  position: absolute; left: 50%; transform: translateX(-50%);
  font-weight: 600; font-size: 1rem; color: rgba(255,255,255,.95);
  letter-spacing: .2px; pointer-events: none;
}
.navbar-links a {
  color: rgba(255,255,255,.85);
  text-decoration: none;
  margin-left: 1.5rem;
  font-size: .9rem;
}
.navbar-links a:hover { color: white; }

/* --- Container --- */
.container { max-width: 1400px; margin: 0 auto; padding: 1.5rem; }

/* --- Page header --- */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem; flex-wrap: wrap; gap: .75rem;
}
.page-header h2 { font-size: 1.4rem; font-weight: 700; }
.header-actions { display: flex; align-items: center; gap: .75rem; }

/* --- KPI Grid --- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.kpi-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
}
.kpi-label { font-size: .78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: .4rem; }
.kpi-value { font-size: 1.8rem; font-weight: 700; color: var(--primary); }
.kpi-value.small { font-size: 1rem; }

/* --- Card --- */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 1.5rem;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  background: #fafafa;
}

/* --- Chart --- */
.chart-container {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

/* --- Table --- */
.table-wrapper { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  background: #f1f5f9;
  padding: .5rem .75rem;
  text-align: left;
  font-weight: 600;
  font-size: .78rem;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: .5rem .75rem;
  border-bottom: 1px solid var(--border);
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f8fafc; }

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem 1rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: .875rem;
  font-weight: 500;
  text-decoration: none;
  transition: opacity .15s;
}
.btn:hover { opacity: .88; }
.btn-primary { background: var(--primary); color: white; }
.btn-outline { background: white; color: var(--text); border: 1px solid var(--border); }
.btn-sm { padding: .3rem .65rem; font-size: .8rem; }
.btn-full { width: 100%; justify-content: center; }

/* --- Forms --- */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 500; margin-bottom: .35rem; font-size: .875rem; }
.form-group input, .form-select {
  width: 100%;
  padding: .5rem .75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .875rem;
  background: white;
  color: var(--text);
  outline: none;
}
.form-group input:focus, .form-select:focus { border-color: var(--primary); }
.form-select { width: auto; min-width: 200px; cursor: pointer; }

/* --- Alerts --- */
.alert { padding: .75rem 1rem; border-radius: 6px; font-size: .875rem; margin-bottom: 1rem; }
.alert-error { background: #fef2f2; color: var(--error); border: 1px solid #fecaca; }

/* --- Empty state --- */
.empty-state { text-align: center; padding: 4rem 2rem; color: var(--text-muted); }
.empty-icon { font-size: 3rem; margin-bottom: 1rem; }

/* --- Login --- */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg); }
.login-box { background: white; border: 1px solid var(--border); border-radius: 12px; padding: 2.5rem; width: 100%; max-width: 380px; box-shadow: 0 4px 24px rgba(0,0,0,.08); }
.login-logo { font-size: 2.5rem; text-align: center; margin-bottom: .5rem; }
.login-box h1 { text-align: center; font-size: 1.5rem; margin-bottom: .25rem; }
.login-subtitle { text-align: center; color: var(--text-muted); margin-bottom: 2rem; font-size: .875rem; }

/* --- Utils --- */
.text-muted { color: var(--text-muted); }
.small { font-size: .8rem; }

/* --- Pivot: evidenza campi filtrati vs non filtrati --- */
.pvtUi .pvtAttr {
  padding: 2px 4px;
  border-radius: 4px;
  transition: background .15s, border-color .15s;
}
/* Campi SENZA filtro: sfondo neutro */
.pvtUi .pvtAxisContainer .pvtAttr {
  background: rgba(0,0,0,.04);
  border: 1px solid transparent;
}
/* Campi CON filtro attivo: evidenza visiva */
.pvtUi .pvtFilteredAttribute .pvtAttr {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  color: #92400e;
  font-weight: 600;
}
.pvtUi .pvtFilteredAttribute .pvtAttr::after {
  content: " [filtrato]";
  font-size: 0.7em;
  font-weight: 500;
  margin-left: 4px;
  opacity: 0.95;
}
/* Stesso stile per campi nelle aree righe/colonne (trascinati) */
.pvtUi .pvtRows .pvtFilteredAttribute .pvtAttr,
.pvtUi .pvtCols .pvtFilteredAttribute .pvtAttr {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  color: #92400e;
  font-weight: 600;
}
