/* ================================================
   VisorStat — Dark Theme
   Color system: verde <p75 | amarillo p75-90 | rojo >p90 | gris sin datos
   ================================================ */

:root {
  --bg:        #0D1117;
  --card:      #161B22;
  --card2:     #1C2128;
  --border:    #30363D;
  --text:      #E6EDF3;
  --muted:     #7D8590;
  --muted2:    #9DA8B5;   /* slightly brighter for subtitles */
  --gold:      #D4A017;

  --green:     #00C853;
  --yellow:    #FFD600;
  --red:       #FF1744;
  --gray:      #616161;

  --green-bg:  #00C85318;
  --yellow-bg: #FFD60018;
  --red-bg:    #FF174418;
  --gray-bg:   #61616118;

  --radius:    8px;
  --gap:       12px;
  --font:      'Courier New', Courier, monospace;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  overflow: hidden; /* no scroll en Capa 1 */
}

/* ---- HEADER ---- */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  background: var(--card2);
  border-bottom: 1px solid var(--border);
  height: 44px;
}

.logo {
  font-size: 15px;
  font-weight: bold;
  letter-spacing: 3px;
  color: var(--gold);
}

.tagline {
  margin-left: 16px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 1px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.pair-selector label {
  color: var(--muted);
  font-size: 11px;
  margin-right: 6px;
}

.pair-selector select {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: var(--font);
  font-size: 12px;
  cursor: pointer;
}

.clock {
  color: var(--muted);
  font-size: 12px;
  min-width: 80px;
  text-align: right;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gray);
  transition: background 0.4s;
}
.status-dot.live  { background: var(--green); }
.status-dot.error { background: var(--red); }

/* ---- DASHBOARD GRID ---- */
.dashboard {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  padding: var(--gap) 20px;
  height: calc(100vh - 44px - 32px);
}

.grid-row {
  display: grid;
  gap: var(--gap);
  flex: 1;
}

.row-4 { grid-template-columns: repeat(4, 1fr); }
.row-3 { grid-template-columns: repeat(3, 1fr); }

/* ---- WIDGET CARD ---- */
.widget {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px 14px;       /* +2px vs before — more breathing room */
  display: flex;
  flex-direction: column;
  gap: 7px;                       /* +1px — slight extra rhythm */
  position: relative;
  overflow: hidden;
  transition: border-color 0.3s;
}

/* Left accent bar — color driven by JS via --accent var */
.widget::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent, var(--gray));
  border-radius: var(--radius) 0 0 var(--radius);
  transition: background 0.4s;
}

.widget--pending {
  opacity: 0.4;
}

/* ---- HIERARCHY LEVEL 1: Widget label ---- */
.widget-label {
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--muted);
  text-transform: uppercase;
}

/* ---- HIERARCHY LEVEL 2: Main value ---- */
.widget-value {
  font-size: 28px;
  font-weight: bold;
  line-height: 1;
  color: var(--text);
  letter-spacing: 1px;
}

/* ---- HIERARCHY LEVEL 3: Subtitle ---- */
.widget-sub {
  font-size: 11.5px;              /* slightly larger than before (was 11px) */
  color: var(--muted2);           /* slightly brighter than pure muted */
  min-height: 15px;
  line-height: 1.4;
}

/* ---- HIERARCHY LEVEL 4: Status pill ---- */
.widget-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 1px;
}

.pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background 0.4s;
}

.pill-text {
  font-size: 10.5px;              /* was 10px */
  font-weight: bold;
  letter-spacing: 1.5px;
  transition: color 0.4s;
}

.pill-pct {
  font-size: 10px;
  color: var(--muted);
  margin-left: 2px;
}

/* ---- HIERARCHY LEVEL 5: Stats row ---- */
.widget-stats {
  display: flex;
  gap: 18px;                      /* was 16px — more space between stat cols */
  margin-top: auto;
  padding-top: 10px;              /* was 8px */
  border-top: 1px solid var(--border);
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;       /* equal distribution across stat columns in all 7 widgets */
  min-width: 0;  /* allow flex shrink so long values don't overflow */
}

.stat-label {
  font-size: 8.5px;               /* was 8px — just a touch more readable */
  letter-spacing: 1.5px;
  color: var(--muted);
  text-transform: uppercase;
}

.stat-value {
  font-size: 13px;
  font-weight: bold;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;  /* 'sin impulso' stays within column */
}

/* ---- FOOTER ---- */
.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 32px;
  padding: 0 20px;
  background: var(--card2);
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.5px;
}

.c3-alert {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 38vw;
  min-width: 0;
}

.c3-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
}

#c3Text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- W2: EVENT LIST ---- */
.widget-events {
  display: flex;
  flex-direction: column;
  gap: 6px;                       /* was 4px — more air between rows */
  margin-top: auto;
  padding-top: 10px;              /* was 8px */
  border-top: 1px solid var(--border);
}

.event-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  gap: 10px;           /* was 8px — more room between name and time */
  padding-right: 4px;  /* prevents time from touching the right edge */
}

.event-row-name {
  color: var(--muted2);           /* slightly brighter than pure muted */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.event-row-time {
  color: var(--text);
  font-weight: bold;
  white-space: nowrap;
}

.event-row-badge {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ---- W1: LIVE SPREAD ---- */
.widget-spread {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.5px;
}

.spread-value {
  font-weight: bold;
}

/* ---- W1: SESSION CLOSED ---- */
.session-closed-info {
  font-size: 11px;
  color: var(--muted2);
  margin-top: 2px;
  line-height: 1.65;   /* room for the two-line closed state */
}

/* ---- W7: COMPONENT GRID ---- */
.widget-components {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px 14px;
  margin-top: 12px;    /* 12px vs 16px — breakdown closer to main block */
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.comp-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10.5px;
  min-height: 18px;   /* prevent row collapse on short labels */
}

.comp-name {
  color: var(--muted);
  font-weight: bold;
  letter-spacing: 0.5px;
}

.comp-val {
  font-weight: bold;
  font-variant-numeric: tabular-nums;
}

/* .widget-click-hint — defined in capa2.css with opacity transition */

/* ---- LOADING PULSE ---- */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

.loading { animation: pulse 1.4s ease-in-out infinite; }

/* ---- SCROLLBAR (por si acaso en pantallas pequeñas) ---- */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
