
/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,300&display=swap');


/* ════════════════════════════════════════════════
   1. DESIGN TOKENS
   ════════════════════════════════════════════════ */
:root {
  /* Superficies */
  --bg:          #0b0f1a;
  --surface:     #111827;
  --surface-2:   #1a2235;
  --border:      rgba(255, 255, 255, 0.07);

  /* Acento */
  --accent:      #e8b86d;
  --accent-dim:  rgba(232, 184, 109, 0.15);
  --accent-glow: rgba(232, 184, 109, 0.35);

  /* Semánticos */
  --green:       #4ade80;
  --red:         #f87171;

  /* Texto */
  --text-1:      #f0f4ff;
  --text-2:      #8b9ab5;
  --text-3:      #4a5568;

  /* Forma */
  --radius:      14px;
  --radius-sm:   8px;
  --shadow:      0 4px 32px rgba(0, 0, 0, 0.45);

  /* Tipografía */
  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body:    'DM Sans', system-ui, sans-serif;
}


/* ════════════════════════════════════════════════
   2. BASE
   ════════════════════════════════════════════════ */
body {
  background:  var(--bg);
  color:       var(--text-1);
  font-family: var(--font-body);
  font-size:   14px;
  min-height:  100vh;
}

/* Textura de grilla sutil */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
}

.dash-wrapper {
  position: relative;
  z-index: 1;
  padding: 2.5rem 0 4rem;
}

.heatmap-container {
  width: 100%;
  margin-top: 24px;
}
.heatmap-controls {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
.hm-sort-btn {
  background: transparent;
  border: 1px solid #1e2229;
  border-radius: 3px;
  color: #7a8494;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .08em;
  padding: 3px 10px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.hm-sort-btn:hover  { border-color: #7a8494; color: #c8d0dc; }
.hm-sort-btn.active { background: #1e2229;   color: #c8d0dc; }

/* Variables del heatmap */
#heatmap_merval {
  --hm-border:    #1e2229;
  --hm-text-dim:  #4a5260;
  --hm-text-muted:#7a8494;
  --hm-text-main: #c8d0dc;
  font-family: 'IBM Plex Mono', monospace;
}

/* Sticky label del sector necesita un bg explícito sin --bg */
#heatmap_merval .hm-group-label {
  background: rgba(13, 17, 23, 0.92);
  backdrop-filter: blur(4px);
}

.card-heatmap {
  background:   var(--surface);        /* fondo de la card */
  border:       1px solid var(--border) !important;
  border-radius: var(--radius);
  box-shadow:   var(--shadow);
}

/* Si querés un gradiente en lugar de color sólido */
.card-heatmap {
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
}

/* Si querés efecto glassmorphism */
.card-heatmap {
  background:        rgba(17, 24, 39, 0.6);
  backdrop-filter:   blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border:            1px solid rgba(255,255,255,0.07) !important;
}

/* Panel de controles */
.hm-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;  /* botones izq, search der */
  gap: 1rem;
  margin-bottom: 0.75rem;
}
/* Barra de busqueda */
.hm-search-input {
  -webkit-appearance: none;
  appearance: none;
  background: transparent !important;
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: rgba(255,255,255,0.75);
  border-radius: 6px;
  padding: 0.4rem 0.75rem;
  outline: none;
  transition: border-color 0.2s ease, color 0.2s ease;
  box-shadow: 0 0 0 1000px transparent inset;
}

.hm-search-input:focus {
  border-color: rgba(255, 255, 255, 0.85);
  color: #ffffff;
}

.hm-search-input::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

/* Fix autofill */
.hm-search-input:-webkit-autofill,
.hm-search-input:-webkit-autofill:hover,
.hm-search-input:-webkit-autofill:focus {
  -webkit-text-fill-color: #ffffff;
  transition: background-color 9999s ease-in-out 0s;
}

.hm-sort-btns {
  display: flex;
  gap: 0.5rem;
}
/* SEARCH: Tile resaltado: borde llamativo */
.hm-highlight {
  outline: 2px solid #fff;
  outline-offset: -2px;
  z-index: 1;
  position: relative;
}

/* Tile atenuado */
.hm-dimmed {
  transition: opacity 0.2s ease;
}

/* ════════════════════════════════════════════════
   3. ANIMACIONES
   ════════════════════════════════════════════════ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.8); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.fade-up { animation: fadeUp 0.4s ease both; }


/* ════════════════════════════════════════════════
   4. PAGE HEADER
   ════════════════════════════════════════════════ */
.page-header {
  display:         flex;
  align-items:     flex-end;
  justify-content: space-between;
  margin-bottom:   2.5rem;
  padding-bottom:  1.5rem;
  border-bottom:   1px solid var(--border);
}

.page-header__eyebrow {
  font-size:      10px;
  font-weight:    600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color:          var(--accent);
  margin-bottom:  0.4rem;
}

.page-header__title {
  font-family: var(--font-display);
  font-size:   clamp(1.8rem, 4vw, 2.8rem);
  line-height: 1.1;
  color:       var(--text-1);
  margin:      0;
}

.page-header__title em {
  font-style: italic;
  color:      var(--accent);
}

.page-header__meta {
  text-align:  right;
  font-size:   12px;
  color:       var(--text-2);
  line-height: 1.7;
}

/* Badge "En vivo" */
.live-badge {
  display:        inline-flex;
  align-items:    center;
  gap:            6px;
  font-size:      10px;
  font-weight:    600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color:          var(--green);
  background:     rgba(74, 222, 128, 0.1);
  border:         1px solid rgba(74, 222, 128, 0.25);
  padding:        4px 10px;
  border-radius:  100px;
}

.live-badge::before {
  content:       '';
  width:         6px;
  height:        6px;
  border-radius: 50%;
  background:    var(--green);
  animation:     pulse 2s infinite;
}


/* ════════════════════════════════════════════════
   5. KPI CARDS
   ════════════════════════════════════════════════ */
.kpi-grid {
  display:               grid;
  grid-template-columns: repeat(4, 1fr);
  gap:                   1rem;
  margin-bottom:         1.5rem;
}

/* Entrada escalonada */
.kpi-grid > *              { animation: fadeUp 0.4s ease both; }
.kpi-grid > *:nth-child(1) { animation-delay: 0.05s; }
.kpi-grid > *:nth-child(2) { animation-delay: 0.12s; }
.kpi-grid > *:nth-child(3) { animation-delay: 0.19s; }
.kpi-grid > *:nth-child(4) { animation-delay: 0.26s; }

@media (max-width: 992px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 576px) { .kpi-grid { grid-template-columns: 1fr; } }

.kpi-card {
  background:    var(--surface);
  border:        1px solid var(--border);
  border-radius: var(--radius);
  padding:       1.4rem 1.5rem;
  position:      relative;
  overflow:      hidden;
  transition:    border-color 0.2s, transform 0.2s;
}

/* resaltar fondo */
.kpi-card--highlight {
  background: #292901;   /* verde oscuro, por ejemplo */
}

/* Línea superior en hover */
.kpi-card::after {
  content:    '';
  position:   absolute;
  top: 0; left: 0; right: 0;
  height:     2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity:    0;
  transition: opacity 0.3s;
}

.kpi-card:hover              { border-color: rgba(232, 184, 109, 0.3); transform: translateY(-2px); }
.kpi-card:hover::after       { opacity: 1; }

.kpi-card__label {
  font-size:      10px;
  font-weight:    600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color:          var(--text-2);
  margin-bottom:  0.6rem;
}

.kpi-card__value {
  font-family:   var(--font-display);
  font-size:     2rem;
  line-height:   1;
  color:         var(--text-1);
  margin-bottom: 0.5rem;
}

.kpi-card__delta {
  font-size:   11px;
  font-weight: 500;
  display:     inline-flex;
  align-items: center;
  gap:         3px;
}

.kpi-card__delta--up   { color: var(--green); }
.kpi-card__delta--down { color: var(--red); }

.kpi-card__icon {
  position:  absolute;
  bottom:    1rem;
  right:     1.2rem;
  font-size: 2.5rem;
  opacity:   0.07;
}


/* ════════════════════════════════════════════════
   6. SECTION LABEL
   ════════════════════════════════════════════════ */
.section-label {
  font-size:      10px;
  font-weight:    600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color:          var(--text-3);
  margin:         2rem 0 1rem;
  display:        flex;
  align-items:    center;
  gap:            10px;
}

.section-label::after {
  content:    '';
  flex:       1;
  height:     1px;
  background: var(--border);
}


/* ════════════════════════════════════════════════
   7. CHART PANELS
   ════════════════════════════════════════════════ */
.chart-panel {
  background:    var(--surface);
  border:        1px solid var(--border);
  border-radius: var(--radius);
  padding:       1.5rem;
  height:        100%;
}

.chart-panel__header {
  display:         flex;
  align-items:     flex-start;
  justify-content: space-between;
  margin-bottom:   1.25rem;
}

.chart-panel__title {
  font-family:   var(--font-display);
  font-size:     1.1rem;
  color:         var(--text-1);
  margin:        0 0 2px;
}

.chart-panel__subtitle {
  font-size: 11px;
  color:     var(--text-2);
}

.chart-panel__badge {
  font-size:      10px;
  font-weight:    600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background:     var(--accent-dim);
  color:          var(--accent);
  border:         1px solid rgba(232, 184, 109, 0.2);
  padding:        3px 9px;
  border-radius:  100px;
  white-space:    nowrap;
}


/* ════════════════════════════════════════════════
   8. FX PANEL (Tipo de cambio)
   ════════════════════════════════════════════════ */
.fx-panel {
  background:    var(--surface);
  border:        1px solid var(--border);
  border-radius: var(--radius);
  padding:       1.5rem;
  margin-bottom: 1.5rem;
}

.fx-panel__header {
  display:       flex;
  align-items:   center;
  gap:           10px;
  margin-bottom: 1.25rem;
}

.fx-panel__icon {
  width:          32px;
  height:         32px;
  border-radius:  var(--radius-sm);
  background:     var(--accent-dim);
  border:         1px solid rgba(232, 184, 109, 0.2);
  display:        flex;
  align-items:    center;
  justify-content:center;
  font-size:      15px;
}

.fx-panel__title {
  font-family: var(--font-display);
  font-size:   1.05rem;
  margin:      0;
  color:       var(--text-1);
}


/* ════════════════════════════════════════════════
   9. FORM CONTROLS
   ════════════════════════════════════════════════ */
.form-label-float {
  display:        flex;
  flex-direction: column;
  gap:            5px;
}

.form-label-float label {
  font-size:      10px;
  font-weight:    600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color:          var(--text-2);
}

.form-input {
  background:    var(--surface-2);
  border:        1px solid var(--border);
  border-radius: var(--radius-sm);
  color:         var(--text-1);
  font-family:   var(--font-body);
  font-size:     13px;
  padding:       0.55rem 0.85rem;
  width:         100%;
  transition:    border-color 0.2s, box-shadow 0.2s;
  outline:       none;
}

.form-input:focus {
  border-color: rgba(232, 184, 109, 0.5);
  box-shadow:   0 0 0 3px var(--accent-dim);
}

/* Icono del date picker al tono del diseño */
input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.6) sepia(1) saturate(2) hue-rotate(10deg);
  cursor: pointer;
}


/* ════════════════════════════════════════════════
   10. BOTÓN PRIMARIO
   ════════════════════════════════════════════════ */
.btn-primary-dash {
  background:      var(--accent);
  color:           #0b0f1a;
  border:          none;
  border-radius:   var(--radius-sm);
  font-family:     var(--font-body);
  font-size:       12px;
  font-weight:     600;
  letter-spacing:  0.08em;
  text-transform:  uppercase;
  padding:         0.6rem 1.4rem;
  cursor:          pointer;
  width:           100%;
  height:          100%;
  transition:      background 0.2s, box-shadow 0.2s, transform 0.15s;
  display:         flex;
  align-items:     center;
  justify-content: center;
  gap:             7px;
}

.btn-primary-dash:hover {
  background:  #f5ca8a;
  box-shadow:  0 0 20px var(--accent-glow);
  transform:   translateY(-1px);
}

.btn-primary-dash:active { transform: translateY(0); }


/* ════════════════════════════════════════════════
   11. HTMX — LOADING INDICATORS
   ════════════════════════════════════════════════ */
.htmx-indicator {
  display:         none;   /* oculto por defecto */
  align-items:     center;
  justify-content: center;
  padding:         3rem;
  color:           var(--text-2);
  gap:             10px;
  font-size:       13px;
}

/* HTMX agrega .htmx-request al elemento que dispara el request */
.htmx-request .htmx-indicator { display: flex; }
.htmx-request.htmx-indicator  { display: flex; }

.spinner {
  width:         18px;
  height:        18px;
  border:        2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation:     spin 0.7s linear infinite;
}


/* ════════════════════════════════════════════════
   12. CONTENEDOR RESULTADO FX
   ════════════════════════════════════════════════ */
#grafico-tc {
  min-height: 0;
  transition: min-height 0.3s;
}

/* Una vez que HTMX inyecta contenido */
#grafico-tc:not(:empty) {
  background:    var(--surface);
  border:        1px solid var(--border);
  border-radius: var(--radius);
  padding:       1.5rem;
  margin-top:    1rem;
  min-height:    320px;
}
