/* premium.css — UX Premium institucional
   Estilo: Banco Mundial / BID / Observatorios Nacionales
*/

:root {
  --premium-blue: #1e3a5f;
  --premium-blue-light: #2c5282;
  --premium-gold: #c9a961;
  --premium-red: #c1272d;
  --premium-green: #2e7d32;
  --premium-gray-50: #f8fafc;
  --premium-gray-100: #f1f5f9;
  --premium-gray-200: #e2e8f0;
  --premium-gray-300: #cbd5e1;
  --premium-gray-500: #64748b;
  --premium-gray-700: #334155;
  --premium-gray-900: #0f172a;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12);
  --radius-sm: 4px;
  --radius: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

/* ── Executive cards ───────────────────────────────── */
.exec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}
.exec-card {
  background: linear-gradient(135deg, #ffffff 0%, var(--premium-gray-50) 100%);
  border-radius: var(--radius-lg);
  border: 1px solid var(--premium-gray-200);
  padding: 1.3rem 1.4rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  opacity: 0;
  transform: translateY(10px);
  animation: fadeUp 0.5s ease forwards;
}
.exec-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.exec-card::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--premium-blue);
}
.exec-card.danger::before { background: var(--premium-red); }
.exec-card.warning::before { background: #c25e00; }
.exec-card.success::before { background: var(--premium-green); }
.exec-card.gold::before   { background: var(--premium-gold); }
.exec-card.purple::before { background: #6a1b9a; }

.exec-card .exec-icon {
  font-size: 1.6rem;
  line-height: 1;
  margin-bottom: 0.5rem;
}
.exec-card .exec-label {
  font-size: 0.78rem;
  color: var(--premium-gray-500);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  margin-bottom: 0.3rem;
}
.exec-card .exec-value {
  font-size: 2.1rem;
  font-weight: 700;
  color: var(--premium-gray-900);
  line-height: 1;
  margin-bottom: 0.2rem;
  font-feature-settings: "tnum";
}
.exec-card .exec-trend {
  font-size: 0.78rem;
  color: var(--premium-gray-500);
  font-weight: 500;
}
.exec-card .exec-trend.up { color: var(--premium-red); }
.exec-card .exec-trend.down { color: var(--premium-green); }

.exec-card.accent {
  background: linear-gradient(135deg, var(--premium-blue), var(--premium-blue-light));
  color: white;
  border-color: transparent;
}
.exec-card.accent .exec-label,
.exec-card.accent .exec-trend { color: rgba(255,255,255,0.85); }
.exec-card.accent .exec-value { color: white; }

/* Stagger animations */
.exec-card:nth-child(1) { animation-delay: 0.05s; }
.exec-card:nth-child(2) { animation-delay: 0.10s; }
.exec-card:nth-child(3) { animation-delay: 0.15s; }
.exec-card:nth-child(4) { animation-delay: 0.20s; }
.exec-card:nth-child(5) { animation-delay: 0.25s; }
.exec-card:nth-child(6) { animation-delay: 0.30s; }
.exec-card:nth-child(7) { animation-delay: 0.35s; }
.exec-card:nth-child(8) { animation-delay: 0.40s; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Premium panels ───────────────────────────────── */
.panel-premium {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--premium-gray-200);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow 0.25s ease;
}
.panel-premium:hover {
  box-shadow: var(--shadow-md);
}
.panel-premium .panel-head {
  padding: 1rem 1.3rem;
  border-bottom: 1px solid var(--premium-gray-200);
  background: linear-gradient(180deg, #ffffff 0%, var(--premium-gray-50) 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.panel-premium .panel-head h2 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--premium-gray-900);
  font-family: var(--font-sans, system-ui);
}
.panel-premium .panel-head .panel-tag {
  font-size: 0.72rem;
  background: var(--premium-gray-100);
  color: var(--premium-gray-700);
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.panel-premium .panel-body { padding: 1.2rem 1.3rem; }

/* ── Heatmap (territorial concentration) ─────── */
.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.5rem;
}
.heatmap-cell {
  padding: 0.7rem 0.8rem;
  border-radius: var(--radius);
  background: var(--premium-gray-50);
  border: 1px solid var(--premium-gray-200);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  transition: transform 0.15s ease;
}
.heatmap-cell:hover { transform: scale(1.02); }
.heatmap-cell .cell-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--premium-gray-900);
}
.heatmap-cell .cell-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--premium-gray-900);
  line-height: 1;
}

/* ── Section header (premium) ─────────────────────── */
.section-head {
  margin: 2rem 0 0.8rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--premium-blue);
}
.section-head h2 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--premium-blue);
  letter-spacing: -0.01em;
  font-family: var(--font-serif, Georgia);
}
.section-head .section-meta {
  font-size: 0.82rem;
  color: var(--premium-gray-500);
  font-weight: 500;
}

/* ── Tier / chips ─────────────────────────── */
.chip {
  display: inline-block;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--premium-gray-100);
  color: var(--premium-gray-700);
}
.chip.success { background: #d1fae5; color: #065f46; }
.chip.warn    { background: #fef3c7; color: #92400e; }
.chip.danger  { background: #fee2e2; color: #991b1b; }
.chip.info    { background: #dbeafe; color: #1e40af; }

/* ── Territory ranking ─────────────────────── */
.rank-row-premium {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid var(--premium-gray-100);
  font-size: 0.88rem;
  transition: background 0.15s ease;
}
.rank-row-premium:hover {
  background: var(--premium-gray-50);
}
.rank-row-premium:last-child { border-bottom: 0; }
.rank-num-premium {
  font-size: 0.78rem;
  color: var(--premium-gray-500);
  font-weight: 600;
  min-width: 1.6rem;
  font-feature-settings: "tnum";
}
.rank-name-premium {
  flex: 1;
  font-weight: 500;
  color: var(--premium-gray-900);
}
.rank-bar-premium {
  flex: 1.2;
  height: 6px;
  background: var(--premium-gray-100);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}
.rank-bar-premium .fill {
  height: 100%;
  background: linear-gradient(90deg, var(--premium-blue), var(--premium-blue-light));
  border-radius: 3px;
  transition: width 0.5s ease;
}
.rank-val-premium {
  font-weight: 700;
  color: var(--premium-gray-900);
  min-width: 2.2rem;
  text-align: right;
  font-feature-settings: "tnum";
}

/* ── Calendar (temporal) ────────────── */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  margin-top: 0.6rem;
}
.calendar-cell {
  aspect-ratio: 1;
  border-radius: 4px;
  background: var(--premium-gray-100);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  position: relative;
  transition: transform 0.15s ease;
}
.calendar-cell:hover { transform: scale(1.06); z-index: 2; }
.calendar-cell .day { font-weight: 700; color: var(--premium-gray-700); }
.calendar-cell .evt {
  font-size: 0.95rem;
  font-weight: 800;
  color: white;
  margin-top: 0.1rem;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}
.calendar-cell.lvl-0 { background: var(--premium-gray-200); }
.calendar-cell.lvl-1 { background: #fed7aa; }
.calendar-cell.lvl-2 { background: #fb923c; }
.calendar-cell.lvl-3 { background: #ea580c; }
.calendar-cell.lvl-4 { background: var(--premium-red); }
.calendar-cell.lvl-5 { background: #991b1b; }

/* ── Sparkline (temporal trend) ─────────────── */
.sparkline {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 50px;
  padding: 0.3rem 0;
}
.spark-bar {
  flex: 1;
  background: linear-gradient(180deg, var(--premium-blue-light), var(--premium-blue));
  border-radius: 2px 2px 0 0;
  min-height: 2px;
  transition: height 0.3s ease;
}

/* ── Map layers (premium GIS) ──────────────── */
.map-layer-control {
  background: white;
  border-radius: var(--radius);
  padding: 0.6rem 0.7rem;
  font-size: 0.82rem;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--premium-gray-200);
}
.map-layer-control h4 {
  margin: 0 0 0.4rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--premium-gray-700);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.map-layer-control label {
  display: block;
  padding: 0.2rem 0;
  cursor: pointer;
}
.map-layer-control input { margin-right: 0.4rem; vertical-align: middle; }

/* ── Modal premium ─────────────────────────── */
.modal-section-premium {
  background: var(--premium-gray-50);
  border: 1px solid var(--premium-gray-200);
  border-radius: var(--radius-md);
  padding: 0.9rem 1.1rem;
  margin-top: 1rem;
}
.modal-section-premium h4 {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--premium-blue);
}
.modal-section-premium .kv {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 0.3rem 0.7rem;
  font-size: 0.85rem;
}
.modal-section-premium .kv .k {
  color: var(--premium-gray-500);
  font-weight: 500;
}
.modal-section-premium .kv .v {
  color: var(--premium-gray-900);
  font-weight: 600;
}

/* ── Premium table ───────────────────────── */
.table-premium {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.table-premium thead {
  background: var(--premium-gray-50);
  border-top: 1px solid var(--premium-gray-200);
  border-bottom: 2px solid var(--premium-blue);
}
.table-premium th {
  padding: 0.7rem 0.8rem;
  text-align: left;
  font-weight: 700;
  color: var(--premium-blue);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.table-premium td {
  padding: 0.7rem 0.8rem;
  border-bottom: 1px solid var(--premium-gray-100);
}
.table-premium tbody tr {
  transition: background 0.15s ease;
}
.table-premium tbody tr:hover {
  background: var(--premium-gray-50);
}

/* ── Responsive ──────────────────────────── */
@media (max-width: 768px) {
  .exec-grid { grid-template-columns: 1fr 1fr; }
  .heatmap-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .calendar-grid { gap: 2px; }
  .calendar-cell { font-size: 0.65rem; }
}
@media (max-width: 480px) {
  .exec-grid { grid-template-columns: 1fr; }
  .section-head h2 { font-size: 1.1rem; }
}
