/* Flip by Stepping Stone Systems — shared styles */

:root {
  --navy: #0C447C;
  --navy-dark: #083562;
  --crimson: #185FA5;
  --crimson-dark: #0C447C;
  --green: #2F855A;
  --green-light: #E6F4ED;
  --red: #C53030;
  --red-light: #FDE8E8;
  --amber: #D69E2E;
  --amber-light: #FEFCE8;
  --blue: #3182CE;
  --blue-light: #EBF4FF;
  --purple: #6B46C1;
  --purple-light: #F3EDFF;
  --gray: #718096;
  --gray-light: #F7FAFC;
  --bg: #F4F6F9;
  --white: #FFFFFF;
  --text: #2A2A2A;
  --muted: #6B7585;
  --border: #E2E8F0;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px; line-height: 1.5; color: var(--text); background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
h1, h2, h3 { color: var(--navy); line-height: 1.3; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
a { color: var(--navy); text-decoration: none; }

/* Header bar */
.header {
  background: var(--navy); color: white; padding: 10px 20px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15); position: sticky; top: 0; z-index: 100;
  text-align: center;
}
.header-brand { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 4px; }
.header-brand img { height: 28px; }
.header-brand span { font-weight: 800; font-size: 1.4rem; color: white; letter-spacing: 0.03em; }
.header h1 { color: white; font-size: 1rem; font-weight: 600; }
.header .subtitle { color: #B8C4DC; font-size: 0.8rem; margin-top: 2px; }

/* Cards */
.card {
  background: var(--white); border-radius: 8px; padding: 20px;
  box-shadow: var(--shadow); border: 1px solid var(--border); margin-bottom: 12px;
}

/* Status badges */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 12px;
  font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em;
}
.badge-available { background: var(--gray-light); color: var(--gray); }
.badge-claimed { background: var(--blue-light); color: var(--blue); }
.badge-inprogress { background: var(--amber-light); color: var(--amber); }
.badge-complete { background: var(--green-light); color: var(--green); }

/* Buttons */
.btn {
  display: inline-block; padding: 12px 24px; border-radius: 6px;
  font-size: 1rem; font-weight: 600; border: none; cursor: pointer;
  text-align: center; text-decoration: none; transition: all 0.15s;
}
.btn-crimson { background: var(--crimson); color: white; }
.btn-crimson:hover { background: var(--crimson-dark); }
.btn-navy { background: var(--navy); color: white; }
.btn-navy:hover { background: var(--navy-dark); }
.btn-green { background: var(--green); color: white; }
.btn-green:hover { background: #276749; }
.btn-outline {
  background: white; color: var(--navy); border: 2px solid var(--navy);
}
.btn-outline:hover { background: var(--gray-light); }
.btn-full { display: block; width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Progress bar */
.progress-bar {
  width: 100%; height: 8px; background: var(--border); border-radius: 4px;
  overflow: hidden; margin: 8px 0;
}
.progress-fill {
  height: 100%; background: var(--green); border-radius: 4px;
  transition: width 0.3s ease;
}

/* Form inputs */
.input-group { margin-bottom: 14px; }
.input-group label { display: block; font-weight: 600; font-size: 0.85rem; margin-bottom: 4px; color: var(--text); }
.input-group input, .input-group textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 1rem; font-family: inherit;
}
.input-group input:focus, .input-group textarea:focus {
  outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(27,47,94,0.15);
}

/* Outcome buttons grid */
.outcome-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0;
}
.outcome-btn {
  padding: 14px 8px; border-radius: 8px; border: 2px solid transparent;
  font-size: 0.85rem; font-weight: 600; cursor: pointer; text-align: center;
  transition: all 0.15s; background: var(--gray-light); color: var(--text);
}
.outcome-btn:hover { transform: scale(1.02); }
.outcome-btn.selected { color: white; border-color: transparent; }
.outcome-btn[data-outcome="PositiveContact"] { border-color: var(--green); color: var(--green); }
.outcome-btn[data-outcome="PositiveContact"].selected { background: var(--green); color: white; }
.outcome-btn[data-outcome="NegativeContact"] { border-color: var(--red); color: var(--red); }
.outcome-btn[data-outcome="NegativeContact"].selected { background: var(--red); color: white; }
.outcome-btn[data-outcome="Undecided"] { border-color: var(--amber); color: #92700C; }
.outcome-btn[data-outcome="Undecided"].selected { background: var(--amber); color: white; }
.outcome-btn[data-outcome="NotHome"] { border-color: var(--gray); color: var(--gray); }
.outcome-btn[data-outcome="NotHome"].selected { background: var(--gray); color: white; }
.outcome-btn[data-outcome="LeftLit"] { border-color: var(--blue); color: var(--blue); }
.outcome-btn[data-outcome="LeftLit"].selected { background: var(--blue); color: white; }
.outcome-btn[data-outcome="Refused"] { border-color: #9B2C2C; color: #9B2C2C; }
.outcome-btn[data-outcome="Refused"].selected { background: #9B2C2C; color: white; }
.outcome-btn[data-outcome="Moved"] { border-color: var(--purple); color: var(--purple); }
.outcome-btn[data-outcome="Moved"].selected { background: var(--purple); color: white; }

/* Stop list */
.stop-list { list-style: none; margin: 12px 0; }
.stop-item {
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  transition: background 0.1s;
}
.stop-item:hover { background: var(--gray-light); }
.stop-item.current { background: var(--blue-light); border-left: 3px solid var(--navy); }
.stop-item.done { opacity: 0.7; }
.stop-num {
  width: 28px; height: 28px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; font-size: 0.8rem; font-weight: 700;
  background: var(--gray-light); color: var(--gray); flex-shrink: 0;
}
.stop-item.done .stop-num { background: var(--green); color: white; }
.stop-item.current .stop-num { background: var(--navy); color: white; }
.stop-addr { flex: 1; }
.stop-addr .street { font-weight: 600; font-size: 0.9rem; }
.stop-addr .detail { font-size: 0.8rem; color: var(--muted); }
.stop-outcome-tag {
  font-size: 0.7rem; font-weight: 600; padding: 2px 8px;
  border-radius: 10px; white-space: nowrap;
}

/* Nav buttons at bottom */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: white; border-top: 1px solid var(--border);
  padding: 10px 16px; display: flex; gap: 10px;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.05); z-index: 90;
}
.bottom-nav .btn { flex: 1; padding: 14px; font-size: 0.95rem; }

/* Coordinator route cards */
.route-card { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.route-info { flex: 1; min-width: 200px; }
.route-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.route-actions .btn { padding: 8px 14px; font-size: 0.8rem; }

/* Stats bar */
.stats-bar {
  display: flex; gap: 12px; flex-wrap: wrap; margin: 16px 0;
}
.stat {
  background: white; padding: 12px 16px; border-radius: 8px;
  border: 1px solid var(--border); text-align: center; flex: 1; min-width: 80px;
}
.stat .num { font-size: 1.5rem; font-weight: 700; color: var(--navy); }
.stat .label { font-size: 0.7rem; text-transform: uppercase; color: var(--muted); letter-spacing: 0.03em; }

/* ---------- Voter list on stop page ---------- */
.voter-list {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.voter-list-header {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 8px;
}
.voter-card {
  background: var(--gray-light);
  border-radius: 6px;
  margin-bottom: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.voter-header {
  padding: 10px 12px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.voter-main {
  flex: 1;
  min-width: 0;
}
.voter-name {
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--text);
  line-height: 1.3;
}
.voter-line {
  color: var(--text);
  font-size: 0.85rem;
  line-height: 1.35;
  margin-top: 1px;
}
.voter-freq {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 2px;
  letter-spacing: 0.01em;
}
.voter-freq .freq-num {
  color: var(--text);
  font-weight: 600;
}
.voter-demo {
  color: var(--muted);
  font-size: 0.82rem;
}
.voter-expand {
  color: var(--muted);
  font-size: 0.75rem;
  transition: transform 0.15s;
  flex-shrink: 0;
  padding-top: 2px;
}
.voter-card.expanded .voter-expand { transform: rotate(180deg); }
.voter-details {
  display: none;
  padding: 8px 12px 12px;
  font-size: 0.85rem;
  color: var(--text);
  background: white;
  border-top: 1px solid var(--border);
}
.voter-card.expanded .voter-details { display: block; }
.voter-details .row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 3px 0;
}
.voter-details .row .label {
  color: var(--muted);
  font-size: 0.8rem;
}
.voter-details .row .value {
  font-weight: 500;
  text-align: right;
}

/* Party badges */
.party-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.75rem;
  color: white;
  flex-shrink: 0;
}
.party-R { background: #C53030; }
.party-D { background: #2C5282; }
.party-U { background: #718096; }

.party-modeled {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.party-modeled-rep { background: #FED7D7; color: #9B2C2C; }
.party-modeled-dem { background: #BEE3F8; color: #2A4365; }
.party-modeled-swing { background: #FEFCE8; color: #92700C; border: 1px solid #ECC94B; }
.party-modeled-other { background: var(--gray-light); color: var(--muted); }

/* Voting frequency stars */
.vote-stars {
  display: inline-flex;
  gap: 2px;
}
.vote-stars span {
  color: #D69E2E;
  font-size: 0.85rem;
  line-height: 1;
}
.vote-stars span.off { color: #E2E8F0; }

/* Utilities */
.container { max-width: 640px; margin: 0 auto; padding: 16px; }
.container-wide { max-width: 900px; margin: 0 auto; padding: 16px; }
.text-center { text-align: center; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.hidden { display: none !important; }

/* Loading spinner */
.spinner {
  display: inline-block; width: 24px; height: 24px;
  border: 3px solid var(--border); border-top-color: var(--navy);
  border-radius: 50%; animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast notification */
.toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: var(--navy); color: white; padding: 10px 20px; border-radius: 8px;
  font-size: 0.9rem; font-weight: 500; box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  z-index: 200; opacity: 0; transition: opacity 0.3s;
}
.toast.show { opacity: 1; }

/* Modal overlay */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 150;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: white; border-radius: 12px; padding: 28px;
  max-width: 400px; width: 100%; box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.modal h2 { margin-bottom: 16px; }

/* Responsive */
@media (max-width: 480px) {
  .stats-bar { gap: 8px; }
  .stat { padding: 8px 10px; }
  .stat .num { font-size: 1.2rem; }
  .route-card { flex-direction: column; align-items: flex-start; }
  .route-actions { width: 100%; }
  .route-actions .btn { flex: 1; }
}

/* Body padding for fixed bottom nav */
body.has-bottom-nav { padding-bottom: 80px; }
