/* =============================================================
   EXPLORER — Search panel, Constituency card, Leaflet map,
               SVG region map, Turnout bar
   ============================================================= */

/* Search Panel */
.search-panel {
  background: #fff;
  border: none;
  border-top: 4px solid var(--ink-red);
  border-bottom: 1px solid var(--paper-border);
  padding: 14px 16px;
  margin-bottom: 18px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.search-title { font-size: 13px; font-weight: 900; text-transform: uppercase; color: var(--ink-red); margin-bottom: 10px; letter-spacing: 1.5px; text-align: center; }
.search-inputs { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.input-group { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 200px; position: relative; }
.input-group label { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px; color: var(--ink-gray); }

/* Constituency Results Card */
.constituency-card {
  border: none;
  border-left: 4px solid var(--ink-red);
  border-top: 1px solid var(--paper-border);
  border-right: 1px solid var(--paper-border);
  border-bottom: 1px solid var(--paper-border);
  padding: 20px;
  background: #fff;
  box-shadow: 0 2px 12px rgba(0,0,0,0.07);
}
.card-header-vintage {
  border-bottom: 2px solid var(--ink-red);
  padding-bottom: 10px;
  margin-bottom: 15px;
  text-align: center;
  background: linear-gradient(to bottom, rgba(192,0,26,0.04), transparent);
  padding-top: 8px;
}
.ac-number-badge {
  font-family: 'Courier Prime', monospace;
  font-size: 9.5px;
  font-weight: 700;
  background: var(--ink-red);
  color: #fff;
  padding: 2px 10px;
  text-transform: uppercase;
  display: inline-block;
  margin-bottom: 6px;
  letter-spacing: 1.5px;
}
.ac-title { font-size: 26px; font-weight: 900; color: var(--ink-charcoal); line-height: 1.1; }
.ac-meta { font-family: 'Courier Prime', monospace; font-size: 11px; margin-top: 5px; color: var(--ink-gray); text-transform: uppercase; }

/* Alert Box */
.alert-vintage { border: 1px dashed var(--ink-red); background: rgba(128,29,29,0.05); padding: 12px 15px; margin-bottom: 15px; position: relative; }
.alert-vintage-title { font-size: 12px; font-weight: 900; color: var(--ink-red); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.alert-vintage-body { font-size: 11px; line-height: 1.5; }

/* Turnout Progress Bar */
.turnout-bar-container { margin: 10px 0; }
.turnout-bar-label { display: flex; justify-content: space-between; font-size: 11px; font-weight: 700; margin-bottom: 4px; }
.turnout-bar-track { height: 14px; background: var(--paper-bg-darker); border: 1px solid var(--ink-charcoal); position: relative; }
.turnout-bar-fill { height: 100%; background: var(--ink-red); width: 0; transition: width 0.8s cubic-bezier(0.1, 0.8, 0.25, 1); }
.turnout-bar-mark { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--ink-charcoal); z-index: 2; }
.turnout-bar-mark-label { position: absolute; top: -14px; font-family: 'Courier Prime', monospace; font-size: 8px; transform: translateX(-50%); }

/* Leaflet Map Container */
.map-box { border: 1px solid var(--paper-border); height: 380px; background: var(--paper-bg-warm); position: relative; margin-bottom: 15px; border-radius: 2px; overflow: hidden; }
#leafletMap { width: 100%; height: 100%; filter: saturate(0.7) brightness(1.0); z-index: 1; }

/* SVG Region Map */
.svg-map-wrapper { width: 100%; text-align: center; padding: 10px; }
.svg-map { max-width: 100%; height: auto; display: inline-block; filter: drop-shadow(0 2px 8px rgba(0,0,0,0.1)); }
.region-path { fill: #fdfaf5; stroke: var(--paper-border); stroke-width: 1.5px; transition: all 0.25s ease; cursor: pointer; }
.region-path:hover { fill: rgba(192, 0, 26, 0.08); stroke: var(--ink-red); }
.region-path.active { fill: rgba(192, 0, 26, 0.15) !important; stroke: var(--ink-red) !important; stroke-width: 2.5px; }
.region-label { font-family: 'Playfair Display', Georgia, serif; font-size: 14px; font-weight: 700; fill: var(--ink-charcoal); pointer-events: none; }

/* Card Content / Fields */
.card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-top: 15px; }
.card-section { border-top: 1px solid var(--paper-border); padding-top: 10px; }
.card-section-title { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px; color: var(--ink-red); margin-bottom: 6px; }
.card-value { font-size: 20px; font-weight: 900; color: var(--ink-charcoal); line-height: 1.1; }
.card-label { font-size: 10px; color: var(--ink-light); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.5px; }
.card-value.highlight-red { color: var(--ink-red); }
.card-value.highlight-green { color: var(--ink-green); }

.detail-row { display: flex; justify-content: space-between; border-bottom: 1px dotted var(--paper-bg-darker); padding: 5px 0; font-size: 12px; }
.detail-row:last-child { border-bottom: none; }
.detail-label { color: var(--ink-light); }
.detail-value { font-weight: 700; color: var(--ink-charcoal); }

@media (max-width: 500px) {
  .card-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════
   EXPLORER EXTRA PANELS (History, Profile, NTK, Chart)
   ═══════════════════════════════════════════════ */

.explorer-panel {
  margin-top: 22px;
  border: 1px solid var(--paper-border);
  border-left: 3px solid var(--ink-red);
  background: #fff;
  padding: 16px 18px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.05);
  position: relative;
}
.explorer-panel + .explorer-panel { margin-top: 16px; }

.explorer-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--paper-border);
}
.explorer-panel-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--ink-charcoal);
  display: flex;
  align-items: center;
  gap: 7px;
}
.explorer-panel-title i {
  color: var(--ink-red);
  font-size: 12px;
}

/* Loyalty / Minister badge */
.loyalty-badge {
  font-family: 'Courier Prime', monospace;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #fff;
  padding: 3px 10px;
  border-radius: 2px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

/* Panel table overrides */
.panel-table { font-size: 11.5px !important; }
.panel-table th { font-size: 9.5px !important; }

/* Party pill in history table */
.panel-party-pill {
  display: inline-block;
  font-family: 'Courier Prime', monospace;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  padding: 2px 9px;
  border-radius: 2px;
  letter-spacing: 0.5px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.12);
}

/* ── PANEL 2: Winner Profile Grid ── */
.profile-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.profile-item {
  text-align: center;
  padding: 12px 6px;
  background: linear-gradient(to bottom, rgba(253,250,245,1), rgba(247,242,235,0.6));
  border: 1px solid var(--paper-border);
  border-radius: 2px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.profile-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 3px 10px rgba(0,0,0,0.08);
}
.profile-icon {
  font-size: 18px;
  color: var(--ink-red);
  margin-bottom: 6px;
}
.profile-label {
  font-family: 'Courier Prime', monospace;
  font-size: 8.5px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--ink-gray);
  margin-bottom: 3px;
}
.profile-value {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 16px;
  font-weight: 900;
  color: var(--ink-charcoal);
}

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


/* ── PANEL 3: Chart Container ── */
.margin-chart-container {
  position: relative;
  height: 200px;
  padding: 4px 0;
}
