/* ==========================================================================
   CONSTRUCTION EQUIPMENT MARKET PREDICTOR — SPAIN
   Estilo premium B2B Market Intelligence (Bloomberg / McKinsey / Power BI)
   ========================================================================== */

:root {
  --bg-0: #0A0E1A;
  --bg-1: #0F1526;
  --bg-2: #131A2B;
  --bg-3: #182035;
  --card: #121A2D;
  --card-border: rgba(255,255,255,0.07);
  --text-primary: #EDF1F7;
  --text-secondary: #8B93A7;
  --text-muted: #5C6580;
  --accent-blue: #2E86FF;
  --accent-teal: #1FB6A8;
  --accent-purple: #7A5CFA;
  --accent-amber: #F2B134;
  --accent-red: #E4572E;
  --accent-green: #4CAF50;
  --sidebar-width: 264px;
  --radius: 14px;
  --shadow-card: 0 4px 24px rgba(0,0,0,0.35);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: radial-gradient(circle at 15% 0%, #101a30 0%, var(--bg-0) 45%);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #263049; border-radius: 8px; }

a { color: inherit; text-decoration: none; }

/* ---------------- LAYOUT ---------------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #0D1220 0%, #0A0E1A 100%);
  border-right: 1px solid var(--card-border);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.brand {
  padding: 24px 22px 18px;
  border-bottom: 1px solid var(--card-border);
}
.brand-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.brand-logo i { color: var(--accent-teal); font-size: 22px; }
.brand-title { font-size: 14.5px; font-weight: 800; letter-spacing: 0.3px; line-height: 1.25; }
.brand-title span { color: var(--accent-teal); }
.brand-subtitle { font-size: 10.5px; color: var(--text-secondary); margin-top: 6px; letter-spacing: 0.4px; text-transform: uppercase; }

.nav-menu { flex: 1; overflow-y: auto; padding: 14px 12px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 10px; margin-bottom: 3px;
  color: var(--text-secondary); font-size: 13.2px; font-weight: 500;
  cursor: pointer; transition: all .15s ease;
  border: 1px solid transparent;
}
.nav-item i { width: 18px; text-align: center; font-size: 14px; }
.nav-item:hover { background: rgba(255,255,255,0.04); color: var(--text-primary); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(46,134,255,0.16), rgba(31,182,168,0.06));
  color: #fff; border-color: rgba(46,134,255,0.25);
}
.nav-item.active i { color: var(--accent-blue); }
.nav-section-label { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); padding: 14px 14px 6px; }

.sidebar-footer { padding: 14px 18px; border-top: 1px solid var(--card-border); font-size: 10.5px; color: var(--text-muted); }

.main-content { margin-left: var(--sidebar-width); flex: 1; padding: 26px 34px 60px; max-width: 100%; }

.topbar { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 22px; flex-wrap: wrap; gap: 12px; }
.topbar h1 { font-size: 22px; font-weight: 800; }
.topbar p { color: var(--text-secondary); font-size: 13px; margin-top: 4px; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 20px; font-size: 11px; font-weight: 600;
  border: 1px solid var(--card-border);
}
.badge-real { background: rgba(46,134,255,0.12); color: #6FB0FF; }
.badge-estimated { background: rgba(242,177,52,0.12); color: #F2B134; }
.badge-forecast { background: rgba(31,182,168,0.12); color: #4FDFCF; }
.badge-synthetic { background: rgba(122,92,250,0.14); color: #A78BFA; }

/* ---------------- SECTIONS ---------------- */
.view-section { display: none; animation: fadeIn .25s ease; }
.view-section.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.grid { display: grid; gap: 18px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-6 { grid-template-columns: repeat(6, 1fr); }
@media (max-width: 1200px) { .grid-4, .grid-6 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 720px) { .grid-4, .grid-3, .grid-2, .grid-6 { grid-template-columns: 1fr; } .main-content { padding: 20px 16px 50px; } .sidebar { display: none; } .main-content { margin-left: 0; } }

.card {
  background: linear-gradient(155deg, var(--card) 0%, #0F1626 100%);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-card);
  position: relative;
}
.card-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-secondary); font-weight: 700; margin-bottom: 10px; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.card-header h3 { font-size: 14.5px; font-weight: 700; }

/* KPI cards */
.kpi-card { display: flex; flex-direction: column; gap: 6px; }
.kpi-value { font-size: 32px; font-weight: 800; letter-spacing: -0.5px; }
.kpi-delta { font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 5px; }
.kpi-delta.up { color: var(--accent-green); }
.kpi-delta.down { color: var(--accent-red); }
.kpi-delta.flat { color: var(--accent-amber); }
.kpi-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.kpi-spark { height: 34px; margin-top: 8px; }

/* Gauge card */
.gauge-wrap { position: relative; height: 150px; display: flex; align-items: center; justify-content: center; }
.gauge-center { position: absolute; text-align: center; }
.gauge-value { font-size: 30px; font-weight: 800; }
.gauge-label { font-size: 10.5px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.6px; margin-top: 2px; }
.zone-pill { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 11px; font-weight: 700; margin-top: 10px; }

/* Pulse cockpit */
.pulse-item { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-radius: 12px; background: rgba(255,255,255,0.02); border: 1px solid var(--card-border); }
.pulse-left { display: flex; align-items: center; gap: 12px; }
.pulse-icon { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.pulse-name { font-size: 12.5px; font-weight: 600; color: var(--text-primary); }
.pulse-value { font-size: 11px; color: var(--text-secondary); }
.pulse-spark { width: 70px; height: 30px; }
.arrow-up { color: var(--accent-green); } .arrow-down { color: var(--accent-red); } .arrow-flat { color: var(--accent-amber); }

/* Traffic light dot */
.tl-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.tl-green { background: var(--accent-green); box-shadow: 0 0 8px var(--accent-green); }
.tl-amber { background: var(--accent-amber); box-shadow: 0 0 8px var(--accent-amber); }
.tl-red { background: var(--accent-red); box-shadow: 0 0 8px var(--accent-red); }

/* Chart container helper */
.chart-box { position: relative; width: 100%; }
.chart-box.h-260 { height: 260px; } .chart-box.h-300 { height: 300px; } .chart-box.h-220 { height: 220px; } .chart-box.h-180 { height: 180px; } .chart-box.h-360 { height: 360px; }

/* Data quality legend */
.quality-legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 11px; color: var(--text-secondary); margin-top: 8px; }
.quality-legend span { display: flex; align-items: center; gap: 6px; }
.legend-line { width: 22px; height: 0; border-top: 3px solid; display: inline-block; }
.legend-line.solid { border-style: solid; border-color: var(--accent-blue); }
.legend-line.dashed { border-style: dashed; border-color: var(--accent-amber); }
.legend-line.dotted { border-style: dotted; border-color: var(--accent-teal); }

/* Cycle timeline */
.cycle-timeline { display: flex; width: 100%; border-radius: 10px; overflow: hidden; height: 56px; margin-top: 12px; }
.cycle-block { display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #fff; text-align: center; padding: 4px; }

/* Leading indicators table */
.li-row { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 10px; background: rgba(255,255,255,0.02); margin-bottom: 8px; border: 1px solid var(--card-border); }
.li-bar-track { height: 8px; border-radius: 6px; background: rgba(255,255,255,0.06); overflow: hidden; }
.li-bar-fill { height: 100%; border-radius: 6px; }

/* Sliders (What-If) */
.slider-group { margin-bottom: 20px; }
.slider-label { display: flex; justify-content: space-between; font-size: 12.5px; font-weight: 600; margin-bottom: 8px; }
.slider-label span.val { color: var(--accent-teal); font-weight: 700; }
input[type="range"] {
  width: 100%; height: 6px; border-radius: 4px; background: #1E2740;
  outline: none; -webkit-appearance: none; cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent-teal); border: 3px solid #071019; cursor: pointer;
  box-shadow: 0 0 0 4px rgba(31,182,168,0.15);
}
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px;
  border-radius: 10px; font-size: 12.5px; font-weight: 700; cursor: pointer;
  border: 1px solid var(--card-border); background: rgba(255,255,255,0.03); color: var(--text-primary);
  transition: all .15s;
}
.btn:hover { background: rgba(255,255,255,0.08); }
.btn-primary { background: linear-gradient(90deg, var(--accent-blue), var(--accent-teal)); border: none; color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }

/* Comparison box (base vs simulated) */
.compare-box { display: flex; justify-content: space-between; align-items: center; padding: 18px; border-radius: 12px; background: rgba(255,255,255,0.02); border: 1px solid var(--card-border); }
.compare-metric { text-align: center; flex: 1; }
.compare-metric .lbl { font-size: 11px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }
.compare-metric .num { font-size: 26px; font-weight: 800; margin-top: 6px; }
.compare-arrow { font-size: 22px; color: var(--text-muted); padding: 0 10px; }

/* Alerts */
.alert-card { display: flex; gap: 14px; padding: 16px; border-radius: 12px; border: 1px solid var(--card-border); margin-bottom: 12px; background: rgba(255,255,255,0.02); }
.alert-card.positive { border-left: 4px solid var(--accent-green); }
.alert-card.warning { border-left: 4px solid var(--accent-amber); }
.alert-icon { font-size: 20px; padding-top: 2px; }
.alert-card.positive .alert-icon { color: var(--accent-green); }
.alert-card.warning .alert-icon { color: var(--accent-amber); }
.alert-title { font-weight: 700; font-size: 13.5px; margin-bottom: 4px; }
.alert-detail { font-size: 12.5px; color: var(--text-secondary); line-height: 1.5; }
.alert-meta { display: flex; gap: 14px; margin-top: 8px; font-size: 11px; color: var(--text-muted); }

/* Risk table */
.risk-row { display: grid; grid-template-columns: 2fr 1fr 1fr 0.6fr; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 10px; background: rgba(255,255,255,0.02); margin-bottom: 8px; }
.risk-bar-track { height: 8px; border-radius: 6px; background: rgba(255,255,255,0.06); overflow: hidden; }
.risk-bar-fill { height: 100%; border-radius: 6px; background: var(--accent-red); }

/* Explainability box */
.explain-box { background: linear-gradient(135deg, rgba(46,134,255,0.08), rgba(31,182,168,0.05)); border: 1px solid rgba(46,134,255,0.2); border-radius: 12px; padding: 18px 20px; font-size: 13.5px; line-height: 1.7; color: var(--text-primary); }
.driver-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 20px; font-size: 11.5px; font-weight: 600; margin: 4px 4px 0 0; }
.driver-pill.pos { background: rgba(76,175,80,0.15); color: #7CD68A; }
.driver-pill.neg { background: rgba(228,87,46,0.15); color: #F08A6B; }

/* Table generic */
table.data-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.data-table th { text-align: left; color: var(--text-secondary); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--card-border); font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; }
table.data-table td { padding: 9px 10px; border-bottom: 1px solid rgba(255,255,255,0.03); }

.tag { padding: 3px 9px; border-radius: 6px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; }
.tag-real { background: rgba(46,134,255,0.15); color: #6FB0FF; }
.tag-estimated { background: rgba(242,177,52,0.15); color: #F2B134; }
.tag-synthetic { background: rgba(122,92,250,0.18); color: #A78BFA; }
.tag-forecast { background: rgba(31,182,168,0.15); color: #4FDFCF; }

.footnote { font-size: 11px; color: var(--text-muted); margin-top: 10px; line-height: 1.5; }
.section-intro { color: var(--text-secondary); font-size: 13px; margin-bottom: 20px; max-width: 900px; line-height: 1.6; }

.so-what-card { text-align: center; padding: 28px 20px; }
.so-what-card i { font-size: 26px; margin-bottom: 12px; display: block; }
.action-box { background: linear-gradient(135deg, rgba(122,92,250,0.12), rgba(46,134,255,0.08)); border: 1px solid rgba(122,92,250,0.25); border-radius: 12px; padding: 20px 24px; margin-top: 20px; }

.model-compare-row { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 10px; margin-bottom: 8px; background: rgba(255,255,255,0.02); border: 1px solid var(--card-border); }
.model-compare-row.best { border-color: rgba(31,182,168,0.4); background: rgba(31,182,168,0.06); }

.source-chip { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 10px; background: rgba(255,255,255,0.03); border: 1px solid var(--card-border); font-size: 12px; margin: 4px; }

.category-card { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-radius: 12px; background: rgba(255,255,255,0.02); border: 1px solid var(--card-border); margin-bottom: 10px; }

@media (max-width: 720px) {
  .li-row, .risk-row, .model-compare-row { grid-template-columns: 1fr; text-align: left; }
}
