/* ============================================================================
   Hemicycle Voting Visualization Styles
   ========================================================================== */

/* Vote Detail Layout */
.vote-detail--header {
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--colour-border);
}

.vote-detail--title {
  font-size: clamp(1.4rem, 1.05rem + 1.6vw, 2rem);
  line-height: var(--leading-tight);
  letter-spacing: -0.015em;
  margin-bottom: var(--space-2);
  color: var(--colour-text);
}

.vote-detail--date {
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  color: var(--colour-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 0;
}

.vote-detail--description {
  margin-top: var(--space-4);
}

.vote-detail--description p {
  font-size: var(--text-lg);
  line-height: var(--leading-normal);
  color: var(--colour-text);
  max-width: 70ch;
  margin: 0;
}

/* Section heading above the table/hemicycle split */
.members-table--header {
  font-size: var(--text-xl);
  margin: var(--space-5) 0 var(--space-4);
}

/* Two Column Layout */
.vote-detail--layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
  align-items: start;
}

@media (max-width: 1024px) {
  .vote-detail--layout {
    grid-template-columns: 1fr;
    gap: var(--space-5);
  }
}

/* ============================================================================
   Hemicycle Container
   ========================================================================== */

.hemicycle-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  position: sticky;
  top: var(--space-4);
}

@media (max-width: 1024px) {
  .hemicycle-container {
    position: static;
  }
}

.hemicycle-svg-wrapper {
  width: 100%;
  margin: 0 auto;
  padding: var(--space-4);
  background: var(--colour-bg-subtle);
  border: 1px solid var(--colour-border);
  border-radius: var(--radius-lg);
}

.hemicycle-svg {
  width: 100%;
  height: auto;
  display: block;
}

/* SVG Seat Styles (loaded via CSS in hemicycle.html) */
svg a.seat-link {
  cursor: pointer;
  text-decoration: none;
}

svg circle.seat {
  stroke: #f0f0f0;
  stroke-width: 1px;
  cursor: pointer;
  transition: all 0.3s ease;
}

svg circle.seat:hover {
  filter: brightness(1.2);
  stroke-width: 2px;
  stroke: #333;
}

svg a.seat-link:hover circle.seat {
  filter: brightness(1.2);
  stroke-width: 2px;
  stroke: #333;
}

svg circle.seat.highlighted {
  filter: drop-shadow(0 0 6px rgba(0, 0, 0, 0.5));
  stroke-width: 2px;
  stroke: #333;
}

/* Decision Colors */
svg circle.group-green {
  fill: #008000;
}

/* YES */
svg circle.group-yellow {
  fill: #FFD700;
}

/* NO */
svg circle.group-pink {
  fill: #FF8888;
}

/* SPOILT */
svg circle.group-grey {
  fill: #A9A9A9;
}

/* ABSENT */

/* ============================================================================
   Vote Statistics Legend
   ========================================================================== */
.vote-statistics-list {
  flex: 0 1 100%;
  display: flex;
  justify-content: center;
  gap: var(--space-4) var(--space-5);
  padding: var(--space-4) 0;
  flex-wrap: wrap;
}


.vote-statistics-legend {
  display: flex;
  justify-content: center;
  gap: var(--space-3) var(--space-5);
  padding: var(--space-4) var(--space-5);
  flex-wrap: wrap;
  background: var(--colour-bg-subtle);
  border: 1px solid var(--colour-border);
  border-radius: var(--radius-lg);
}

.legend-list {
  display: inline-block;
  width: 32px;
  height: 16px;
  border-radius: var(--radius-sm);
  background-color: var(--colour-lighter);
}



.legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  color: var(--colour-text);
}

.legend-color {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid hsl(0 0% 0% / 0.12);
  flex: none;
}

.legend-item.yes .legend-color {
  background-color: #4CAF50;
}

.legend-item.no .legend-color {
  background-color: #F44336;
}

.legend-item.spoilt .legend-color {
  background-color: #FF9800;
}

.legend-item.abstained .legend-color {
  background-color: #7346d7;
}

.legend-item.absent .legend-color {
  background-color: #9E9E9E;
}

.legend-label {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.legend-label strong {
  color: var(--colour-text);
  font-weight: var(--fw-bold);
  font-variant-numeric: tabular-nums;
}

.list-label {
  color: var(--colour-text);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
}

/* Total tally line under the legend (vote_detail.html) */
.legend-total {
  flex: 1 1 100%;
  text-align: center;
  font-size: var(--text-sm);
  color: var(--colour-text-muted);
  padding-top: var(--space-2);
  border-top: 1px solid var(--colour-border);
  font-variant-numeric: tabular-nums;
}

/* ============================================================================
   Vote Filter Buttons
   ========================================================================== */
.vote-filter-title {
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  color: var(--colour-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  align-self: center;
}

.vote-filter-buttons {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
  padding: var(--space-3);
  background: var(--colour-bg-subtle);
  border: 1px solid var(--colour-border);
  border-radius: var(--radius-lg);
  justify-content: flex-start;
  align-items: center;
}

.filter-btn {
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--colour-border-strong);
  background: var(--colour-bg);
  color: var(--colour-text);
  border-radius: var(--radius-pill);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  cursor: pointer;
  transition: background var(--motion-fast) var(--ease-standard),
    color var(--motion-fast) var(--ease-standard),
    border-color var(--motion-fast) var(--ease-standard);
  white-space: nowrap;
}

.filter-btn:hover {
  border-color: var(--colour-secondary);
  color: var(--colour-secondary-dark);
}

.filter-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--colour-secondary-alpha-20);
}

.filter-btn.active {
  background: var(--colour-secondary);
  color: #fff;
  border-color: var(--colour-secondary);
}

.filter-btn.active:hover {
  background: var(--colour-secondary-dark);
  color: #fff;
  border-color: var(--colour-secondary-dark);
}

/* ============================================================================
   Members Vote Table
   ========================================================================== */

.members-table-container {
  overflow: auto;
  max-height: min(70vh, 48rem);
  margin-bottom: var(--space-6);
  border: 1px solid var(--colour-border);
  border-radius: var(--radius-lg);
  background: var(--colour-bg);
  -webkit-overflow-scrolling: touch;
}

.members-table--header {
  flex: 1 1 100%;
}

.members-vote-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--colour-bg);
  font-size: var(--text-sm);
}

.members-vote-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--colour-bg-subtle);
  border-bottom: 2px solid var(--colour-border-strong);
}

.members-vote-table th {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-weight: var(--fw-bold);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--colour-text-muted);
  white-space: nowrap;
}

.members-vote-table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--colour-border);
  vertical-align: middle;
}

/* Column Widths */
.col-header {
  background-color: var(--colour-bg-subtle);
  color: var(--colour-text-muted);
}

.col-name {
  width: 30%;
  min-width: 150px;
}

.col-vote {
  width: 15%;
  min-width: 100px;
}

.col-party {
  width: 15%;
  min-width: 100px;
}

.col-constituency {
  width: 20%;
  min-width: 120px;
}

.col-county {
  width: 20%;
  min-width: 100px;
}

/* Member Name Link */
a.member-name {
  color: var(--colour-secondary-dark);
  text-decoration: none;
  font-weight: var(--fw-semibold);
  cursor: pointer;
  transition: color var(--motion-fast) var(--ease-standard);
}

span.member-name {
  font-weight: var(--fw-medium);
  color: var(--colour-text);
}

a.member-name:hover {
  color: var(--colour-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

a.member-name:focus-visible {
  outline: 2px solid var(--colour-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Vote Row Styling */
.vote-row {
  transition: background-color var(--motion-fast) var(--ease-standard);
}

.vote-row:hover {
  background-color: var(--colour-bg-subtle);
}

.vote-row.highlighted {
  background-color: var(--colour-secondary-alpha-10) !important;
  animation: highlightFade 2s ease-out;
}

@keyframes highlightFade {
  0% {
    background-color: var(--colour-secondary-alpha-20);
  }

  100% {
    background-color: transparent;
  }
}

/* Vote Decision Color Coding */
.vote-row--yes {}

.vote-row--no {}

.vote-row--spoilt {}

.vote-row--absent {}

/* Alternating row colors (zebra) */
.vote-row:nth-child(even) {
  background-color: var(--colour-bg-subtle);
}

.vote-row:nth-child(even):hover {
  background-color: var(--colour-lighter);
}

/* ============================================================================
   Decision Badges
   ========================================================================== */

.decision-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: var(--fw-bold);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
  text-align: center;
}

.decision-badge--yes {
  background-color: var(--colour-success-bg);
  color: var(--colour-success);
}

.decision-badge--no {
  background-color: var(--colour-danger-bg);
  color: var(--colour-danger);
}

.decision-badge--spoilt {
  background-color: var(--colour-warning-bg);
  color: var(--colour-warning);
}

.decision-badge--abstained {
  background-color: #E9DCFF;
  color: #4A2B8E;
}

.decision-badge--absent {
  background-color: var(--colour-lighter);
  color: var(--colour-text-muted);
}

/* ============================================================================
   Vote List Links - Active State
   ========================================================================== */

.vote-link {
  display: block;
  padding: var(--space-3);
  border-radius: var(--radius-md);
  transition: background var(--motion-fast) var(--ease-standard),
    color var(--motion-fast) var(--ease-standard);
}

.vote-link.active {
  background-color: var(--colour-primary);
  color: #fff !important;
}

.vote-link.active .vote-date {
  color: rgba(255, 255, 255, 0.85);
}

/* ============================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 1024px) {
  .vote-detail--layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .hemicycle-svg-wrapper {
    max-width: 100%;
  }

  /* Collapse table columns on smaller screens */
  .col-county {
    display: none;
  }
}

@media (max-width: 768px) {
  .vote-detail--header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
  }

  .vote-detail--title {
    font-size: 1.5rem;
  }

  .vote-statistics-legend {
    flex-direction: column;
    gap: 0.75rem;
  }

  .legend-item {
    justify-content: space-between;
  }

  /* Hide county and constituency on mobile */
  .col-county,
  .col-constituency {
    display: none;
  }

  /* Stack table columns */
  .col-party {
    display: none;
  }

  .members-vote-table th,
  .members-vote-table td {
    padding: 0.625rem 0.5rem;
    font-size: 0.85rem;
  }

  .col-name {
    width: 50%;
  }

  .col-vote {
    width: 50%;
  }
}

@media (max-width: 480px) {
  .vote-detail--layout {
    gap: 1rem;
  }

  .vote-detail--title {
    font-size: 1.25rem;
  }

  .vote-detail--date {
    font-size: 0.85rem;
  }

  .vote-statistics-legend {
    padding: 0.75rem;
    gap: 0.5rem;
  }

  .legend-color {
    width: 16px;
    height: 16px;
  }

  .legend-label {
    font-size: 0.8rem;
  }

  .members-vote-table {
    font-size: 0.8rem;
  }

  .members-vote-table th,
  .members-vote-table td {
    padding: 0.5rem 0.25rem;
  }

  .col-name {
    width: 60%;
  }

  .col-vote {
    width: 40%;
  }

  .decision-badge {
    padding: 0.3rem 0.5rem;
    font-size: 0.75rem;
  }
}

/* ============================================================================
   Empty State
   ========================================================================== */

.no-votes--message {
  padding: var(--space-7) var(--space-5);
  text-align: center;
  color: var(--colour-text-muted);
  background: var(--colour-bg-subtle);
  border: 1px dashed var(--colour-border-strong);
  border-radius: var(--radius-lg);
}

.no-votes--message p {
  margin: 0;
  font-size: var(--text-base);
}

/* Empty table row */
.members-vote-table td.no-data {
  padding: var(--space-6) var(--space-4);
  text-align: center;
  color: var(--colour-text-muted);
  font-style: italic;
}

/* On-demand SVG generation placeholder */
.svg-loading {
  display: grid;
  place-items: center;
  min-height: 18rem;
  color: var(--colour-text-muted);
  font-weight: var(--fw-medium);
}

.svg-loading p {
  margin: 0;
}
