* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg0: #0b0b12;
    --bg1: #ff2d55;
    --bg2: #ff8a00;
    --bg3: #7c3aed;

    --surface: rgba(255, 255, 255, 0.92);
    --surface-strong: #ffffff;
    --text: #101223;
    --text-muted: rgba(16, 18, 35, 0.7);
    --border: rgba(16, 18, 35, 0.12);

    --primary: #ff2d55;
    --primary-2: #7c3aed;

    --radius-sm: 10px;
    --radius-md: 14px;
    --shadow-sm: 0 10px 30px rgba(0, 0, 0, 0.18);
    --shadow-md: 0 18px 60px rgba(0, 0, 0, 0.28);

    --page-max: 1100px;
    --header-h: 64px;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    color: var(--text);
    background:
        radial-gradient(1200px 700px at 20% 0%, rgba(255, 45, 85, 0.45), transparent 60%),
        radial-gradient(900px 700px at 80% 15%, rgba(255, 138, 0, 0.45), transparent 55%),
        radial-gradient(1100px 900px at 50% 95%, rgba(124, 58, 237, 0.55), transparent 65%),
        linear-gradient(180deg, var(--bg0), #0a0a10 40%, #0b0b12 100%);
}

.container {
    background: var(--surface-strong);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 40px;
    max-width: 600px;
    width: 100%;

    margin: 0 auto;
}

h1 {
    color: var(--text);
    margin-bottom: 10px;
    text-align: center;
}

.subtitle {
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: var(--text);
    font-weight: 500;
}

input[type="text"],
input[type="email"],
textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    background: rgba(255, 255, 255, 0.95);
}

input[type="text"]:focus,
input[type="email"]:focus,
textarea:focus {
    outline: none;
    border-color: rgba(255, 45, 85, 0.55);
    box-shadow: 0 0 0 4px rgba(255, 45, 85, 0.18);
}

textarea {
    resize: vertical;
    min-height: 120px;
}

button {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(255, 45, 85, 0.35);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.message {
    padding: 15px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    display: none;
    text-align: center;
    font-weight: 600;
}

.message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.message.show {
    display: block;
}

.page {
    max-width: var(--page-max);
    margin: 0 auto;
    padding: calc(var(--header-h) + 28px) 20px 48px;
}

.card {
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.card-inner {
    padding: 18px;
}

.topnav {
    position: fixed; /* sticks to top */
    top: 0;
    left: 0;
    width: 100%; /* full width */
    height: var(--header-h);
    background: rgba(255, 255, 255, 0.82);
    border-bottom: 1px solid rgba(16, 18, 35, 0.10);
    display: flex; /* modern layout */
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding-right: 6px;
}

.topnav a {
    float: left;
    color: rgba(16, 18, 35, 0.86);
    text-align: center;
    padding: 10px 14px;
    text-decoration: none;
    font-size: 15px;
    font-weight: 650;
    border-radius: 999px;
    margin-left: 8px;
}

.topnav a:first-child {
    margin-left: 14px;
}

.topnav a:hover {
    background: rgba(255, 45, 85, 0.12);
    color: rgba(16, 18, 35, 0.95);
}

.topnav a.active {
    background: linear-gradient(135deg, rgba(255, 45, 85, 0.95), rgba(124, 58, 237, 0.95));
    color: white;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: transparent;
    overflow: hidden;
}

#candidateTable {
    width: 100%;
}

#candidateTable th,
#candidateTable td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
    color: var(--text);
}

#candidateTable th {
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(16, 18, 35, 0.72);
    z-index: 1;
}

#candidateTable tr:nth-child(even) td {
    background: rgba(255, 255, 255, 0.40);
}

#candidateTable tr:hover td {
    background: rgba(255, 45, 85, 0.08);
}

#candidateTable a {
  color: var(--primary);
  font-weight: 650;
  text-decoration: none;
}

#candidateTable a:hover {
  text-decoration: underline;
}

.table-wrap {
overflow: auto;
border-radius: var(--radius-md);
}

fieldset {
border: 1px solid var(--border);
border-radius: var(--radius-md);
padding: 12px 14px 14px;
background: rgba(255, 255, 255, 0.82);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
box-shadow: var(--shadow-sm);
}

fieldset legend {
padding: 0 8px;
font-weight: 750;
color: var(--text);
}

.party-toggle {
display: flex;
gap: 10px;
flex-wrap: wrap;
margin-top: 10px;
}

.party-toggle input[type="radio"] {
position: absolute;
opacity: 0;
pointer-events: none;
}

.party-toggle label {
margin: 0;
display: inline-flex;
align-items: center;
justify-content: center;
padding: 10px 12px;
border-radius: 999px;
border: 1px solid var(--border);
background: rgba(255, 255, 255, 0.92);
color: var(--text);
cursor: pointer;
transition: transform 0.15s, background 0.15s, border-color 0.15s;
}

.party-toggle input[type="radio"]:checked + label {
background: linear-gradient(135deg, rgba(255, 45, 85, 0.95), rgba(124, 58, 237, 0.95));
border-color: rgba(255, 255, 255, 0.35);
color: white;
}

.party-toggle label:hover {
transform: translateY(-1px);
}

#chart-container {
    background: var(--surface-strong);
    border-radius: var(--radius-md);
    padding: 40px;
    max-width: 520px;
    margin: 100px auto 0;
    box-shadow: var(--shadow-md);
}

#pie-chart {
    width: 250px;
    height: 250px;
    border-radius: 50%;
    margin: 0 auto 20px;
}

#legend {
    text-align: center;
}

.legend-item {
    margin: 10px 0;
    font-size: 16px;
}

.color-box {
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-right: 10px;
    vertical-align: middle;
}

.mini-pie {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-block;
}

.search-container {
    position: relative;
    margin-left: auto;
    padding: 8px 16px;
}

#candidateSearch {
    padding: 10px 12px;
    border: 1px solid rgba(16, 18, 35, 0.14);
    border-radius: 999px;
    font-size: 14px;
    width: 250px;
    outline: none;
    background: rgba(255, 255, 255, 0.92);
}

#candidateSearch:focus {
    border-color: rgba(255, 45, 85, 0.55);
    box-shadow: 0 0 0 4px rgba(255, 45, 85, 0.16);
}

.search-results {
    display: none;
    position: absolute;
    top: 100%;
    right: 16px;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1001;
    min-width: 300px;
}

.search-results.show {
    display: block;
}

.search-result-item {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    color: #333;
}

.search-result-item:hover {
    background: #f0f0f0;
}

.search-result-item .candidate-name {
    font-weight: 600;
}

.search-result-item .candidate-info {
    font-size: 12px;
    color: #666;
}

#modal {
    background: var(--surface-strong);
    margin: 10% auto;
    padding: 24px;
    width: min(440px, calc(100vw - 32px));
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#modal-scroll-panel {
    overflow-y: auto;
    flex: 1;
    max-height: 60vh;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.modal-item {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
}

.modal-item:hover {
    background: #f5f5f5;
}

#modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

#app {
  height: calc(100vh - var(--header-h));
  display: flex;
  margin-top: var(--header-h);
}

#map {
  flex: 1;
}

#sidebar {
  width: 360px;
  background: rgba(255, 255, 255, 0.88);
  border-left: 1px solid rgba(16, 18, 35, 0.10);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

#protest-list {
  overflow-y: auto;
  flex: 1;
  padding-right: 6px;
}

.protest-card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(16, 18, 35, 0.08);
  cursor: pointer;
}

.protest-card:hover {
  background: rgba(255, 45, 85, 0.06);
}

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.6);
}

.modal.show {
  display: block;
}

.modal-content {
  background: var(--surface-strong);
  margin: 10% auto;
  padding: 24px;
  width: min(440px, calc(100vw - 32px));
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

@media (max-width: 900px) {
  #app {
    flex-direction: column;
  }

  #sidebar {
    width: 100%;
    border-left: none;
    border-top: 1px solid rgba(16, 18, 35, 0.10);
  }
}