/* ============================================================
   Divisas Zócalo — Ticker bar + Slide-up panel
   ============================================================ */

/* ── Variables ────────────────────────────────────────────── */
:root {
  --dz-bg:        #0e0e0e;
  --dz-text:      #f0f0f0;
  --dz-muted:     #8a8a8a;
  --dz-green:     #28c76f;
  --dz-red:       #ea5455;
  --dz-border:    #2a2a2a;
  --dz-panel-bg:  #161616;
  --dz-accent:    #d4a017;     /* dorado Zócalo */
  --dz-radius:    10px;
  --dz-speed:     35s;
}

/* ── Wrapper ──────────────────────────────────────────────── */
.dz-ticker-wrap {
  position: relative;
  width: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
  line-height: 1;
  z-index: 100;
}

/* ── Ticker bar ───────────────────────────────────────────── */
.dz-ticker {
  background: var(--dz-bg);
  color: var(--dz-text);
  overflow: hidden;
  white-space: nowrap;
  height: 108px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--dz-border);
  user-select: none;
}

/* ── Scrolling inner track ────────────────────────────────── */
.dz-ticker-inner {
  display: inline-flex;
  align-items: stretch;
  gap: 0;
  height: 108px;
  animation: dz-scroll var(--dz-speed) linear infinite;
  will-change: transform;
}
.dz-ticker-inner:hover {
  animation-play-state: paused;
}

@keyframes dz-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ── Loading state ────────────────────────────────────────── */
.dz-loading {
  padding: 0 16px;
  color: var(--dz-muted);
  font-size: 12px;
  animation: none;
  align-self: center;
}

/* ── Individual ticker item (card) ───────────────────────── */
.dz-item {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: 8px 16px;
  min-width: 148px;
  cursor: pointer;
  border-right: 1px solid var(--dz-border);
  transition: background 0.15s;
  box-sizing: border-box;
  vertical-align: top;
}
.dz-item:hover {
  background: rgba(255,255,255,0.05);
}

/* Card header: icon + short label */
.dz-card-header {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 1px;
}
.dz-item-icon {
  font-size: 13px;
  line-height: 1;
  flex-shrink: 0;
}
.dz-item-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--dz-muted);
}

/* Full name */
.dz-item-full {
  font-size: 10px;
  color: var(--dz-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 132px;
  line-height: 1.1;
}

/* Price row */
.dz-item-price-line {
  display: flex;
  align-items: baseline;
  gap: 3px;
  margin-top: 1px;
}
.dz-item-price {
  font-size: 15px;
  font-weight: 800;
  color: var(--dz-text);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.dz-item-unit {
  font-size: 9px;
  font-weight: 600;
  color: var(--dz-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  vertical-align: super;
}

/* Change row: badge + absolute */
.dz-item-change-row {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}
.dz-item-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 1px 5px;
  border-radius: 3px;
  line-height: 1.4;
}
.dz-item-badge.dz-up   { background: rgba(40,199,111,0.18); color: var(--dz-green); }
.dz-item-badge.dz-down { background: rgba(234,84,85,0.18);  color: var(--dz-red);   }
.dz-item-badge.dz-flat { background: rgba(138,138,138,0.14);color: var(--dz-muted); }
.dz-item-abs {
  font-size: 10px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* Day range bar */
.dz-range {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  width: 100%;
}
.dz-range-val {
  font-size: 8px;
  font-variant-numeric: tabular-nums;
  color: var(--dz-muted);
  flex-shrink: 0;
  line-height: 1;
}
.dz-range-track {
  flex: 1;
  height: 3px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  position: relative;
}
.dz-range-dot {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--dz-accent);
  top: -2px;
  transform: translateX(-50%);
  box-shadow: 0 0 4px rgba(212,160,23,0.6);
}

.dz-up   { color: var(--dz-green); }
.dz-down { color: var(--dz-red);   }
.dz-flat { color: var(--dz-muted); }

/* ── Age label ────────────────────────────────────────────── */
.dz-age-label {
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  color: var(--dz-muted);
  font-size: 10px;
  gap: 4px;
  flex-shrink: 0;
  align-self: center;
}

/* ── Overlay ──────────────────────────────────────────────── */
.dz-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 9998;
  backdrop-filter: blur(2px);
}
.dz-overlay.active { display: block; }

/* ── Slide-up panel ───────────────────────────────────────── */
.dz-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 680px;
  margin: 0 auto;
  background: var(--dz-panel-bg);
  color: var(--dz-text);
  border-radius: var(--dz-radius) var(--dz-radius) 0 0;
  border: 1px solid var(--dz-border);
  border-bottom: none;
  z-index: 9999;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  padding: 0 0 env(safe-area-inset-bottom);
  max-height: 90vh;
  overflow-y: auto;
}
.dz-panel.open {
  transform: translateY(0);
}

/* Panel header */
.dz-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 20px 12px;
  gap: 12px;
}
.dz-panel-title {
  flex: 1;
}
.dz-panel-title strong {
  display: block;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 2px;
}
.dz-panel-title span {
  font-size: 12px;
  color: var(--dz-muted);
}
.dz-panel-price {
  text-align: right;
  flex-shrink: 0;
}
.dz-panel-price .dz-big-price {
  font-size: 24px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  display: block;
}
.dz-panel-price .dz-big-change {
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.dz-panel-close {
  background: transparent;
  border: none;
  color: var(--dz-muted);
  font-size: 22px;
  cursor: pointer;
  padding: 0 0 0 8px;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.15s;
}
.dz-panel-close:hover { color: var(--dz-text); }

/* Panel meta (unit, source) */
.dz-panel-meta {
  padding: 0 20px 12px;
  font-size: 11px;
  color: var(--dz-muted);
}

/* Period tabs */
.dz-period-tabs {
  display: flex;
  gap: 4px;
  padding: 0 20px 12px;
}
.dz-period-btn {
  background: transparent;
  border: 1px solid var(--dz-border);
  color: var(--dz-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}
.dz-period-btn:hover,
.dz-period-btn.active {
  background: var(--dz-accent);
  border-color: var(--dz-accent);
  color: #000;
}

/* Chart area — TradingView widget */
.dz-chart-wrap {
  padding: 0 20px;
  position: relative;
  min-height: 220px;
}
/* Asegurar que el iframe de TradingView llene el contenedor */
.dz-chart-wrap .tradingview-widget-container,
.dz-chart-wrap .tradingview-widget-container__widget {
  height: 220px;
  width: 100%;
}
.dz-chart-wrap.dz-hidden,
.dz-period-tabs.dz-hidden {
  display: none !important;
}
.dz-chart-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--dz-muted);
  font-size: 13px;
}

/* Stats row */
.dz-panel-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--dz-border);
  margin-top: 8px;
}
.dz-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dz-stat-label {
  font-size: 10px;
  color: var(--dz-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.dz-stat-value {
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Source footer */
.dz-panel-source {
  padding: 8px 20px 16px;
  font-size: 10px;
  color: var(--dz-muted);
  border-top: 1px solid var(--dz-border);
}

/* ── Error state ──────────────────────────────────────────── */
.dz-error-msg {
  padding: 0 16px;
  color: var(--dz-red);
  font-size: 12px;
}

/* ── Responsive: panel full-width on mobile ───────────────── */
@media (max-width: 720px) {
  .dz-panel {
    max-width: 100%;
    border-radius: var(--dz-radius) var(--dz-radius) 0 0;
  }
  .dz-panel-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}
