/* ---------------------------------------------------
   TOOLTIPS
--------------------------------------------------- */
[data-tooltip] {
    cursor: help; /* Indicate it's hoverable */
}

/* The global tooltip element (JS-managed) */
#global-tooltip {
    position: fixed;
    background: rgba(30, 30, 40, 0.95);
    color: #fff;
    padding: 10px 14px;
    border-radius: 6px;
    border: 1px solid rgba(75, 156, 211, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    font-size: 0.85rem;
    line-height: 1.4;
    z-index: 11000; /* Above modals */
    pointer-events: none; /* Let clicks pass through */
    max-width: 250px;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    transform: translateY(5px); /* Slide up effect */
    left: 0;
    top: 0;
}

#global-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ---------------------------------------------------
   DATA QUALITY INDICATORS
--------------------------------------------------- */
/* Focused page header: true center title; back + trailing spacer balance 1fr columns */
#trendsFocusedTrend .trend-header.trends-focused-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0;
  column-gap: 8px;
}

#trendsFocusedTrend .trends-focused-header-lead {
  justify-self: start;
  display: flex;
  align-items: center;
  min-width: 0;
}

#trendsFocusedTrend .trend-header-center {
  grid-column: 2;
  justify-self: center;
  max-width: 100%;
  min-width: 0;
  display: flex;
  justify-content: center;
  text-align: center;
}

#trendsFocusedTrend .trend-header-center h2 {
  max-width: 100%;
}

#trendsFocusedTrend .trends-focused-header-trail {
  justify-self: end;
  width: 40px;
  min-height: 1px;
  flex-shrink: 0;
  pointer-events: none;
}

.data-quality-badges-container:empty {
  display: none;
}

/* Header layout: structured panel for market-focused view */
.data-quality-panel {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  overflow: hidden;
  max-width: min(360px, calc(100vw - 48px));
}

.data-quality-panel-header {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: rgba(255, 255, 255, 0.6);
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.data-quality-header-range {
  font-weight: 500;
  letter-spacing: 0.8px;
  color: rgba(255, 255, 255, 0.45);
  text-transform: uppercase;
}

.data-quality-panel-body {
  padding: 10px 14px;
}

.data-quality-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 0;
  font-size: 0.82rem;
}

.data-quality-row:not(:last-child) {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.data-quality-label {
  color: rgba(255, 255, 255, 0.7);
  flex-shrink: 0;
}

.data-quality-value {
  font-weight: 500;
  text-align: right;
}

.data-quality-value.fallback { color: #e6a800; }
.data-quality-value.confidence-high { color: #4bd37b; }
.data-quality-value.confidence-mid { color: #ffc107; }
.data-quality-value.confidence-low { color: #ff6464; }
.data-quality-value.context { color: #4b9cd3; }
.data-quality-value.sector { color: #aaaaff; }
.data-quality-value.quantity { color: #94a3b8; }

.data-quality-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-top: 4px;
    font-size: 0.7rem;
}

.data-quality-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.data-quality-badge.fallback {
    background: rgba(255, 180, 0, 0.2);
    color: #e6a800;
    border: 1px solid rgba(255, 180, 0, 0.4);
}

.data-quality-badge.confidence-high {
    background: rgba(75, 211, 123, 0.15);
    color: #4bd37b;
}

.data-quality-badge.confidence-mid {
    background: rgba(255, 193, 7, 0.15);
    color: #ffc107;
}

.data-quality-badge.confidence-low {
    background: rgba(255, 100, 100, 0.15);
    color: #ff6464;
}

.data-quality-badge.context {
    background: rgba(75, 156, 211, 0.15);
    color: #4b9cd3;
}

.data-quality-badge.sector {
    background: rgba(150, 150, 200, 0.15);
    color: #aaaaff;
}

.metric-details .data-quality-badges {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* Responsive: trends focused header */
@media (max-width: 767.98px) {
  #trendsFocusedTrend .trend-header {
    margin-bottom: 10px;
  }

  #trendsFocusedTrend .trend-header.trends-focused-header {
    column-gap: 6px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    align-items: center;
  }

  #trendsFocusedTrend .trends-focused-header-lead {
    flex-shrink: 0;
  }

  #trendsFocusedTrend .trends-focused-header .back-button {
    min-width: 40px;
    min-height: 40px;
    padding: 8px 10px;
    box-sizing: border-box;
  }

  #trendsFocusedTrend .trend-header-center h2 {
    font-size: clamp(0.9rem, 4vw, 1.2rem);
    letter-spacing: 0.1em;
    line-height: 1.25;
  }

  #trendsFocusedTrend .trends-focused-header-trail {
    width: 32px;
    min-width: 32px;
  }
}
