@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@500;600;700;800&family=Space+Grotesk:wght@600;700&display=swap');

:root {
  --ink: #101828;
  --muted: #5e6b7d;
  --border: #d8dee8;
  --surface: #f6f8fb;
  --card: #ffffff;
  --primary: #b3121b;
  --primary-dark: #861017;
  --accent: #0f7a45;
  --gold: #c79b2b;
  --ok: #0f7a45;
  --ok-bg: #e7f6ee;
  --pending-bg: #fff4d9;
  --pending: #7f5a00;
  --focus: rgba(179, 18, 27, 0.25);
  --shadow-soft: 0 10px 30px rgba(15, 23, 42, 0.08);
  --shadow-card: 0 18px 36px rgba(15, 23, 42, 0.06);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: 'Manrope', 'Segoe UI', sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 100% -10%, rgba(199, 155, 43, 0.15), transparent 60%),
    radial-gradient(900px 500px at -5% 25%, rgba(15, 122, 69, 0.1), transparent 60%),
    linear-gradient(180deg, #fefefe 0%, var(--surface) 55%, #eef2f8 100%);
}

.topbar {
  position: relative;
  color: #fff;
  border-bottom: 4px solid var(--gold);
  background: linear-gradient(125deg, #0a2463 0%, #1d4ed8 45%, #3b82f6 100%);
  overflow: hidden;
}

.topbar::before,
.topbar::after {
  content: '';
  position: absolute;
  border-radius: 999px;
  filter: blur(4px);
  opacity: 0.38;
}

.topbar::before {
  width: 260px;
  height: 260px;
  background: rgba(255, 255, 255, 0.18);
  right: -70px;
  top: -90px;
}

.topbar::after {
  width: 200px;
  height: 200px;
  background: rgba(15, 122, 69, 0.4);
  right: 140px;
  top: -120px;
}

.topbar-inner {
  position: relative;
  max-width: 980px;
  margin: 0 auto;
  padding: 34px 22px 26px;
  animation: slideFade 0.55s ease-out both;
}

.topbar h1 {
  margin: 0 0 6px;
  font-family: 'Space Grotesk', 'Manrope', sans-serif;
  font-size: clamp(1.35rem, 1.05rem + 1.15vw, 2.05rem);
  letter-spacing: 0.01em;
  font-weight: 700;
}

.topbar p {
  margin: 0;
  max-width: 760px;
  font-size: clamp(0.9rem, 0.85rem + 0.2vw, 1rem);
  opacity: 0.95;
}

.wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: 26px 22px 74px;
}

.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), #ffffff 40%);
  border: 1px solid rgba(16, 24, 40, 0.08);
  border-radius: 16px;
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-card);
  animation: slideFade 0.45s ease both;
}

.selectors {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) minmax(210px, 1fr) auto;
  gap: 16px;
  align-items: end;
}

.field label {
  display: block;
  margin-bottom: 7px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #5f6b7b;
}

select,
input[type='text'] {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 0.93rem;
  line-height: 1.2;
  color: var(--ink);
  background: #fff;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 42px;
  background-image:
    linear-gradient(45deg, transparent 50%, #64748b 50%),
    linear-gradient(135deg, #64748b 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 3px),
    calc(100% - 12px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

select:hover,
input[type='text']:hover {
  border-color: #c7cfdb;
}

select:disabled {
  background: #eef1f5;
  color: #7d8897;
}

select:focus,
input[type='text']:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--focus);
  transform: translateY(-1px);
}

.add-constituency-field {
  display: flex;
  align-items: center;
}

.btn-link {
  appearance: none;
  border: 1px dashed rgba(179, 18, 27, 0.45);
  background: rgba(179, 18, 27, 0.06);
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  cursor: pointer;
  padding: 10px 12px;
  border-radius: 10px;
  white-space: nowrap;
  transition: all 0.18s ease;
}

.btn-link:hover {
  background: rgba(179, 18, 27, 0.1);
  border-color: rgba(179, 18, 27, 0.6);
}

.btn-link:disabled {
  color: #7c8795;
  border-color: #cad1dc;
  background: #f0f3f8;
  cursor: not-allowed;
}

.add-box {
  display: flex;
  gap: 12px;
  align-items: end;
}

.add-box .field {
  flex: 1;
}

.add-box-actions {
  display: flex;
  gap: 8px;
}

.hidden {
  display: none !important;
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}

.results-header h2 {
  margin: 0;
  font-family: 'Space Grotesk', 'Manrope', sans-serif;
  font-size: clamp(1.02rem, 0.95rem + 0.4vw, 1.3rem);
  letter-spacing: 0.01em;
}

.status-badge {
  font-size: 0.74rem;
  font-weight: 800;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.status-badge.complete {
  background: var(--ok-bg);
  color: var(--ok);
  border-color: #bfe4cf;
}

.status-badge.pending {
  background: var(--pending-bg);
  color: var(--pending);
  border-color: #f0dfa5;
}

.positions-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.position-row {
  display: grid;
  grid-template-columns: minmax(170px, 240px) 1fr minmax(140px, 180px);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid #dfe4ec;
  border-radius: 12px;
  background: linear-gradient(180deg, #fbfcfe 0%, #f7f9fc 100%);
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.position-row:hover {
  border-color: #cdd5e1;
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

.position-row.filled {
  background: linear-gradient(180deg, #f3fbf6 0%, #ebf7f0 100%);
  border-color: #bfe1cd;
}

.position-name {
  font-size: 0.86rem;
  font-weight: 800;
  color: #1a2431;
  line-height: 1.25;
}

.form-actions {
  margin-top: 22px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.btn-primary,
.btn-secondary {
  border: none;
  padding: 11px 20px;
  border-radius: 11px;
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

.btn-primary {
  background: linear-gradient(180deg, #cc1a24 0%, var(--primary) 100%);
  color: #fff;
  box-shadow: 0 10px 16px rgba(179, 18, 27, 0.22);
}

.btn-primary:hover {
  transform: translateY(-1px);
  background: linear-gradient(180deg, #bd1a23 0%, var(--primary-dark) 100%);
}

.btn-primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: #f5f7fb;
  color: #2b3647;
  border: 1px solid #d2d9e4;
}

.btn-secondary:hover {
  transform: translateY(-1px);
  background: #edf1f7;
}

.save-message {
  font-size: 0.83rem;
  font-weight: 700;
}

.save-message.ok {
  color: var(--ok);
}

.save-message.err {
  color: var(--primary);
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 48px 20px;
  font-size: 0.95rem;
  background: rgba(255, 255, 255, 0.62);
  border: 1px dashed #cdd5e0;
  border-radius: 14px;
}

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

  .add-box {
    flex-direction: column;
    align-items: stretch;
  }

  .add-box-actions {
    justify-content: flex-end;
  }

  .results-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .position-row {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

@keyframes slideFade {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
