/* ============================================================
   Voter Lookup Modal — opens from anywhere on the single-page app.
   All component rules are scoped under `.vl-modal` to avoid leaks.
   ============================================================ */

.vl-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(6px) saturate(140%);
  -webkit-backdrop-filter: blur(6px) saturate(140%);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 5vh 16px 24px;
  overflow-y: auto;
  animation: vlFadeIn 180ms ease-out;
}
.vl-modal-overlay.is-open { display: flex; }

@keyframes vlFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.vl-modal {
  position: relative;
  width: 100%;
  max-width: 1200px;
  background: var(--bg-1, #f7f8fb);
  border-radius: 22px;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.28);
  padding: 28px 28px 32px;
  animation: vlSlideUp 220ms cubic-bezier(.2, .8, .2, 1);
}
@keyframes vlSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.vl-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px; height: 36px;
  border-radius: 999px;
  border: 1px solid var(--border, rgba(15,23,42,0.08));
  background: var(--surface, #fff);
  color: var(--text-dim, #475569);
  font-size: 18px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: 180ms cubic-bezier(.2,.6,.2,1);
  z-index: 2;
}
.vl-modal-close:hover {
  background: var(--surface-strong, #f5f7fb);
  color: var(--text, #0f172a);
  transform: rotate(90deg);
}

.vl-modal-header {
  padding-right: 56px; /* leave space for close button */
  margin-bottom: 18px;
}
.vl-modal-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--accent, #2563eb);
  background: rgba(37, 99, 235, 0.08);
  padding: 5px 11px; border-radius: 999px;
}
.vl-modal-title {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 10px 0 8px;
  color: var(--text, #0f172a);
}
.vl-modal-lede {
  color: var(--text-dim, #475569);
  font-size: 14px;
  line-height: 1.55;
  max-width: 640px;
  margin: 0;
}

.vl-modal-grid {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
@media (max-width: 900px) {
  .vl-modal { padding: 22px 18px 26px; border-radius: 18px; }
  .vl-modal-grid { grid-template-columns: 1fr; gap: 16px; }
  .vl-modal-overlay { padding: 2vh 10px 16px; }
}

/* ---- Component rules (scoped to the modal) ---- */

.vl-modal .card {
  background: var(--surface, #fff);
  border: 1px solid var(--border, rgba(15,23,42,0.08));
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(15,23,42,0.06), 0 2px 6px rgba(15,23,42,0.03);
  padding: 22px;
}
.vl-modal .card h2 {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 16px; margin: 0 0 4px; letter-spacing: -0.01em;
  color: var(--text, #0f172a);
}
.vl-modal .card .hint {
  font-size: 12.5px; color: var(--text-mute, #64748b); margin: 0 0 16px;
}

.vl-modal .tabs {
  display: flex; gap: 6px; padding: 4px;
  background: var(--surface-strong, #f5f7fb); border-radius: 12px;
  margin-bottom: 16px;
}
.vl-modal .tab {
  flex: 1; padding: 9px 12px; border: 0; background: transparent;
  border-radius: 9px; font-size: 13px; font-weight: 600;
  color: var(--text-dim, #475569); cursor: pointer;
  transition: 180ms cubic-bezier(.2,.6,.2,1);
  font-family: inherit;
}
.vl-modal .tab.active {
  background: var(--surface, #fff); color: var(--text, #0f172a);
  box-shadow: 0 1px 2px rgba(15,23,42,0.06);
}

.vl-modal .field { margin-bottom: 13px; }
.vl-modal .field label {
  display: block; font-size: 11px; font-weight: 700;
  color: var(--text-dim, #475569); margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.vl-modal .field input {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border-strong, rgba(15,23,42,0.16));
  border-radius: 10px;
  font: inherit; font-size: 14px; color: var(--text, #0f172a);
  background: var(--surface, #fff);
  transition: 180ms cubic-bezier(.2,.6,.2,1);
}
.vl-modal .field input:focus {
  outline: none; border-color: var(--accent, #2563eb);
  box-shadow: 0 0 0 4px var(--accent-glow, rgba(37,99,235,0.25));
}
.vl-modal .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.vl-modal .btn {
  width: 100%; padding: 11px 16px; border: 0; border-radius: 11px;
  font-size: 14px; font-weight: 700; cursor: pointer;
  background: linear-gradient(135deg, var(--accent, #2563eb), var(--accent-2, #7c3aed));
  color: #fff;
  box-shadow: 0 8px 20px var(--accent-glow, rgba(37,99,235,0.25));
  transition: transform 180ms, box-shadow 180ms;
  font-family: inherit;
}
.vl-modal .btn:hover { transform: translateY(-1px); box-shadow: 0 12px 26px var(--accent-glow, rgba(37,99,235,0.25)); }
.vl-modal .btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.vl-modal .btn.ghost {
  background: var(--surface-strong, #f5f7fb); color: var(--text-dim, #475569);
  box-shadow: none; margin-top: 8px;
}

.vl-modal .alert {
  margin-top: 14px; padding: 10px 13px; border-radius: 11px;
  font-size: 13px; line-height: 1.5;
  border: 1px solid var(--border, rgba(15,23,42,0.08));
}
.vl-modal .alert.error { background: rgba(220,38,38,0.06); border-color: rgba(220,38,38,0.25); color: #991b1b; }
.vl-modal .alert.info  { background: rgba(37,99,235,0.06); border-color: rgba(37,99,235,0.2); color: #1e3a8a; }

.vl-modal .results-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; gap: 12px; flex-wrap: wrap;
}
.vl-modal .results-count { font-size: 13px; color: var(--text-mute, #64748b); }
.vl-modal .results-count strong { color: var(--text, #0f172a); }

.vl-modal .table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border, rgba(15,23,42,0.08));
  border-radius: 14px;
  background: var(--surface, #fff);
  max-height: 55vh;
  overflow-y: auto;
}
.vl-modal table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 760px; }
.vl-modal thead th {
  text-align: left; padding: 11px 13px;
  font-weight: 700; font-size: 11px; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--text-mute, #64748b);
  background: var(--surface-strong, #f5f7fb);
  border-bottom: 1px solid var(--border, rgba(15,23,42,0.08));
  position: sticky; top: 0;
}
.vl-modal tbody td {
  padding: 11px 13px; border-bottom: 1px solid var(--border, rgba(15,23,42,0.08));
  color: var(--text, #0f172a); vertical-align: top;
}
.vl-modal tbody tr:last-child td { border-bottom: 0; }
.vl-modal tbody tr:hover { background: rgba(37,99,235,0.03); }
.vl-modal .mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }
.vl-modal .pill {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.02em;
  background: rgba(37,99,235,0.1); color: var(--accent, #2563eb);
}

.vl-modal .skeleton {
  display: grid; place-items: center; padding: 50px 20px;
  color: var(--text-mute, #64748b); font-size: 14px;
}
.vl-modal .spinner {
  width: 30px; height: 30px; border-radius: 50%;
  border: 3px solid var(--border-strong, rgba(15,23,42,0.16));
  border-top-color: var(--accent, #2563eb);
  animation: vlSpin 0.8s linear infinite; margin-bottom: 10px;
}
@keyframes vlSpin { to { transform: rotate(360deg); } }

.vl-modal .empty-state {
  display: grid; place-items: center; padding: 50px 20px;
  text-align: center; color: var(--text-mute, #64748b);
}
.vl-modal .empty-state .icon { font-size: 38px; margin-bottom: 8px; opacity: 0.55; }
.vl-modal .empty-state h3 {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  margin: 0 0 6px; font-size: 15px; color: var(--text, #0f172a);
}
.vl-modal .empty-state p { margin: 0; font-size: 13px; max-width: 360px; }

.vl-modal .privacy-note {
  margin-top: 16px; font-size: 11px; color: var(--text-mute, #64748b);
  line-height: 1.5; padding: 11px 13px;
  background: var(--surface-strong, #f5f7fb); border-radius: 10px;
}

/* Polling-station block */
.vl-modal .station-block {
  margin-top: 4px; padding: 9px 11px;
  background: linear-gradient(135deg, rgba(37,99,235,0.06), rgba(124,58,237,0.04));
  border: 1px solid rgba(37,99,235,0.15);
  border-radius: 10px;
  font-size: 12.5px; line-height: 1.45;
}
.vl-modal .station-block .station-label {
  display: block; font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent, #2563eb); margin-bottom: 3px;
}
.vl-modal .station-block .station-name { color: var(--text, #0f172a); font-weight: 700; }
.vl-modal .station-block .station-meta { color: var(--text-mute, #64748b); font-size: 11.5px; margin-top: 2px; }

/* Mobile card view */
.vl-modal .voter-cards { display: grid; gap: 12px; }
.vl-modal .voter-cards .voter-card {
  background: var(--surface, #fff);
  border: 1px solid var(--border, rgba(15,23,42,0.08));
  border-radius: 14px;
  padding: 13px;
  box-shadow: 0 1px 2px rgba(15,23,42,0.06);
}
.vl-modal .voter-cards .voter-card .vc-name { font-weight: 700; font-size: 15px; color: var(--text, #0f172a); margin-bottom: 2px; }
.vl-modal .voter-cards .voter-card .vc-sub { font-size: 12px; color: var(--text-mute, #64748b); margin-bottom: 10px; }
.vl-modal .voter-cards .voter-card .vc-row {
  display: grid; grid-template-columns: auto 1fr; gap: 6px 14px;
  font-size: 13px; margin-bottom: 6px;
}
.vl-modal .voter-cards .voter-card .vc-row dt {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-mute, #64748b); align-self: center;
}
.vl-modal .voter-cards .voter-card .vc-row dd { margin: 0; color: var(--text, #0f172a); }
.vl-modal .voter-cards .voter-card .vc-pill {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 700;
  background: rgba(37,99,235,0.1); color: var(--accent, #2563eb);
  margin-right: 6px;
}

/* Desktop hides cards; mobile hides table, shows cards. */
.vl-modal .voter-cards { display: none; }
@media (max-width: 760px) {
  .vl-modal .table-wrap { display: none; }
  .vl-modal .voter-cards { display: grid; }
}

/* Disable body scroll while modal open */
body.vl-modal-open { overflow: hidden; }

/* ============================================================
   Voter Dossier — rich result card
   ============================================================ */
.vl-modal .voter-dossiers {
  display: grid;
  gap: 16px;
}
.vl-modal .voter-dossier {
  position: relative;
  background: var(--surface, #fff);
  border: 1px solid var(--border, rgba(15,23,42,0.08));
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(15,23,42,0.05);
}

/* Header bar */
.vl-modal .vd-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background:
    radial-gradient(80% 100% at 0% 0%, rgba(37,99,235,0.07), transparent 70%),
    linear-gradient(135deg, rgba(37,99,235,0.04), rgba(124,58,237,0.03));
  border-bottom: 1px solid var(--border, rgba(15,23,42,0.08));
}
.vl-modal .vd-avatar {
  flex: 0 0 auto;
  width: 48px; height: 48px;
  border-radius: 14px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent, #2563eb), var(--accent-2, #7c3aed));
  color: #fff;
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-weight: 700; font-size: 17px;
  letter-spacing: 0.02em;
  box-shadow: 0 6px 16px rgba(37,99,235,0.25);
}
.vl-modal .vd-name-wrap { flex: 1; min-width: 0; }
.vl-modal .vd-name {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 17px; font-weight: 700;
  color: var(--text, #0f172a);
  margin: 0 0 4px;
  letter-spacing: -0.01em;
  line-height: 1.25;
  word-break: break-word;
}
.vl-modal .vd-meta {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 6px 8px;
  font-size: 12.5px; color: var(--text-mute, #64748b);
}
.vl-modal .vd-meta-item {
  display: inline-flex; align-items: baseline; gap: 6px;
}
.vl-modal .vd-meta-label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-mute, #64748b);
}
.vl-modal .vd-meta-value { color: var(--text, #0f172a); font-weight: 600; }
.vl-modal .vd-meta-value .vd-age {
  font-weight: 500; color: var(--text-mute, #64748b);
}
.vl-modal .vd-meta-sep { color: rgba(15,23,42,0.2); }

.vl-modal .vd-status {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.03em;
  background: rgba(22,163,74,0.1);
  color: #166534;
  border: 1px solid rgba(22,163,74,0.25);
}
.vl-modal .vd-status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34,197,94,0.2);
}

/* Body grid */
.vl-modal .vd-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: 0;
}
.vl-modal .vd-section {
  padding: 16px 18px;
  border-right: 1px solid var(--border, rgba(15,23,42,0.08));
  min-width: 0;
}
.vl-modal .vd-section:last-child { border-right: 0; }
.vl-modal .vd-section-label {
  font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-mute, #64748b);
  margin-bottom: 10px;
}
.vl-modal .vd-section-primary {
  background: linear-gradient(180deg, rgba(37,99,235,0.04), transparent);
}

.vl-modal .vd-constituency { margin-bottom: 12px; }
.vl-modal .vd-pill {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px; font-weight: 700;
  background: rgba(37,99,235,0.12);
  color: var(--accent, #2563eb);
  letter-spacing: -0.005em;
}

.vl-modal .vd-station {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(37,99,235,0.06), rgba(124,58,237,0.04));
  border: 1px solid rgba(37,99,235,0.15);
}
.vl-modal .vd-station-icon {
  flex: 0 0 auto;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: #fff;
  font-size: 16px;
  box-shadow: 0 2px 6px rgba(37,99,235,0.15);
}
.vl-modal .vd-station-body { flex: 1; min-width: 0; }
.vl-modal .vd-station-label {
  font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--accent, #2563eb);
  margin-bottom: 3px;
}
.vl-modal .vd-station-name {
  font-size: 13.5px; font-weight: 700;
  color: var(--text, #0f172a);
  line-height: 1.35;
  word-break: break-word;
}

.vl-modal .vd-line {
  font-size: 13.5px;
  color: var(--text, #0f172a);
  line-height: 1.5;
  word-break: break-word;
}
.vl-modal .vd-line-mute {
  font-size: 12px;
  color: var(--text-mute, #64748b);
  margin-top: 4px;
}

.vl-modal .vd-footer {
  padding: 11px 18px;
  font-size: 11.5px;
  color: var(--text-mute, #64748b);
  background: var(--surface-strong, #f5f7fb);
  border-top: 1px solid var(--border, rgba(15,23,42,0.08));
  line-height: 1.45;
}

/* Responsive: collapse to a stacked layout on narrow screens */
@media (max-width: 820px) {
  .vl-modal .vd-grid {
    grid-template-columns: 1fr;
  }
  .vl-modal .vd-section {
    border-right: 0;
    border-bottom: 1px solid var(--border, rgba(15,23,42,0.08));
  }
  .vl-modal .vd-section:last-child { border-bottom: 0; }
  .vl-modal .vd-head { flex-wrap: wrap; }
  .vl-modal .vd-status { order: 3; }
}
@media (max-width: 480px) {
  .vl-modal .vd-head { padding: 14px; gap: 12px; }
  .vl-modal .vd-avatar { width: 42px; height: 42px; border-radius: 12px; font-size: 15px; }
  .vl-modal .vd-name { font-size: 16px; }
  .vl-modal .vd-section { padding: 14px; }
}

