/* styles.css — GavelPro Shared Styles */

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

:root {
  --navy: #1f3a8a;
  --navy-dark: #1f3a8a;
  --navy-light: #EBF0FA;
  --gold: #F0A500;
  --gold-light: rgba(240,165,0,0.15);
  --green: #27500A;
  --green-light: #EAF3DE;
  --green-border: #C0DD97;
  --red: #791F1F;
  --red-light: #FCEBEB;
  --red-border: #F09595;
  --yellow: #633806;
  --yellow-light: #FAEEDA;
  --yellow-border: #FAC775;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
}

body {
  font-family: var(--font);
  background: #FFFAF0;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ── */
.screen { display: none; }
.screen.active { display: flex; flex-direction: column; }

/* ── Header ── */
.app-header {
  background: var(--navy);
  padding: 14px 18px 18px;
  text-align: center;
  flex-shrink: 0;
}
.app-header .org-name {
  color: rgba(255,255,255,0.7);
  font-size: 11px;
  letter-spacing: 0.06em;
  margin-bottom: 3px;
}
.app-header .event-name {
  color: #fff;
  font-size: 17px;
  font-weight: 500;
}
.app-header .session-badge {
  display: inline-block;
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  margin-top: 6px;
}
.app-header .session-badge.open {
  background: rgba(74,222,128,0.25);
}

/* ── Body ── */
.app-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 13px;
  flex: 1;
  overflow-y: auto;
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
}

/* ── Form fields ── */
.field-group { display: flex; flex-direction: column; gap: 4px; }
.field-label { font-size: 12px; color: #555; font-weight: 500; }
.field-input {
  width: 100%;
  padding: 10px 12px;
  border: 0.5px solid #ccc;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-family: var(--font);
  background: #fff;
  color: #111;
  -webkit-appearance: none;
}
.field-input:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 2px rgba(26,58,92,0.15); }
.pw-wrap { position: relative; }
.pw-wrap .field-input { padding-right: 40px; }
.pw-toggle {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; color: #888; font-size: 18px; padding: 4px;
}

/* ── Buttons ── */
.btn {
  width: 100%; padding: 13px; border: none; border-radius: var(--radius-md);
  font-size: 15px; font-weight: 500; cursor: pointer; font-family: var(--font);
  transition: opacity 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; }
.btn-navy { background: var(--navy); color: #fff; }
.btn-navy:hover:not(:disabled) { opacity: 0.88; }
.btn-secondary { background: #FFFAF0; color: #2C3E50; border: 0.5px solid #ddd; }
.btn-secondary:hover:not(:disabled) { background: #e4e6e9; }

/* ── Error message ── */
.error-msg {
  background: #FEF2F2; border: 0.5px solid #FCA5A5;
  border-radius: var(--radius-md); padding: 10px 12px;
  font-size: 13px; color: #B91C1C; display: none;
}

/* ── Cards ── */
.card {
  background: #fff; border: 0.5px solid #e5e7eb;
  border-radius: var(--radius-lg); padding: 14px;
}
.card-label {
  font-size: 11px; font-weight: 500; color: #666;
  text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 10px;
}

/* ── Ballot meta ── */
.ballot-meta { background: #f8f9fa; border-radius: var(--radius-md); padding: 12px 14px; }
.ballot-meta-label { font-size: 11px; color: #888; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 2px; }
.ballot-meta-name { font-size: 15px; font-weight: 500; color: #111; }
.ballot-meta-type { font-size: 12px; color: #666; margin-top: 2px; }

/* ── Candidate grid ── */
.candidate-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.candidate-card {
  border: 1.5px solid #e5e7eb; border-radius: var(--radius-lg);
  padding: 12px 10px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  text-align: center; transition: all 0.15s; background: #fff;
  -webkit-tap-highlight-color: transparent;
}
.candidate-card:hover { border-color: #aaa; background: #f8f9fa; }
.candidate-card.selected { border-color: var(--navy); background: var(--navy-light); }
.candidate-photo {
  width: 68px; height: 68px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 500;
  border: 2px solid #e5e7eb; flex-shrink: 0; overflow: hidden;
}
.candidate-photo img { width: 100%; height: 100%; object-fit: cover; }
.candidate-card.selected .candidate-photo { border-color: var(--navy); }
.candidate-name { font-size: 12px; font-weight: 500; color: #111; line-height: 1.3; }
.candidate-card.selected .candidate-name { color: #1f3a8a; }
.candidate-lodge { font-size: 10px; color: #888; line-height: 1.3; }
.candidate-radio {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid #ccc; display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.candidate-card.selected .candidate-radio { border-color: var(--navy); background: var(--navy); }
.radio-dot { width: 8px; height: 8px; border-radius: 50%; background: #fff; display: none; }
.candidate-card.selected .radio-dot { display: block; }

/* ── Yes/No motion ── */
.motion-list { display: flex; flex-direction: column; gap: 10px; }
.motion-choice {
  border: 1.5px solid #e5e7eb; border-radius: var(--radius-lg);
  padding: 16px; cursor: pointer;
  display: flex; align-items: center; gap: 12px;
  transition: all 0.15s; background: #fff;
  -webkit-tap-highlight-color: transparent;
}
.motion-choice.aye { border-color: var(--green-border); background: var(--green-light); }
.motion-choice.nay { border-color: var(--red-border); background: var(--red-light); }
.motion-icon { width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.motion-icon.aye-icon { background: var(--green-light); color: var(--green); }
.motion-choice.aye .motion-icon.aye-icon { background: var(--green); color: #fff; }
.motion-icon.nay-icon { background: var(--red-light); color: var(--red); }
.motion-choice.nay .motion-icon.nay-icon { background: var(--red); color: #fff; }
.motion-text { font-size: 15px; font-weight: 500; color: #111; }

/* ── Secure badge ── */
.secure-badge {
  display: flex; align-items: center; justify-content: center;
  gap: 5px; font-size: 11px; color: #888; padding: 4px 0;
}

/* ── Waiting screen ── */
.wait-card {
  background: #f8f9fa; border: 0.5px solid #e5e7eb;
  border-radius: var(--radius-lg); padding: 20px;
  display: flex; flex-direction: column; align-items: center;
  gap: 12px; text-align: center;
}
.wait-icon {
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--navy-light); display: flex; align-items: center;
  justify-content: center; color: var(--navy); font-size: 26px;
}
.wait-title { font-size: 16px; font-weight: 500; color: #111; }
.wait-sub { font-size: 13px; color: #555; line-height: 1.6; }
.wait-ballot {
  background: #fff; border: 0.5px solid #ddd;
  border-radius: var(--radius-md); padding: 10px 14px;
  width: 100%; text-align: left;
}
.wait-ballot-label { font-size: 10px; color: #888; text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 3px; }
.wait-ballot-name { font-size: 14px; font-weight: 500; color: #111; }
.dot-pulse { display: flex; gap: 6px; justify-content: center; margin-top: 4px; }
.dot-pulse span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--navy); opacity: 0.25;
  animation: dp 1.2s infinite;
}
.dot-pulse span:nth-child(2) { animation-delay: 0.2s; }
.dot-pulse span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dp { 0%,80%,100% { opacity: 0.25; } 40% { opacity: 1; } }

/* ── Ballot closed screen ── */
.closed-card {
  background: #F1EFE8; border: 0.5px solid #D3D1C7;
  border-radius: var(--radius-lg); padding: 20px;
  display: flex; flex-direction: column; align-items: center;
  gap: 12px; text-align: center;
}
.closed-icon {
  width: 60px; height: 60px; border-radius: 50%;
  background: #D3D1C7; display: flex; align-items: center;
  justify-content: center; color: #444; font-size: 26px;
}
.closed-title { font-size: 15px; font-weight: 500; color: #2C2C2A; }
.closed-body { font-size: 13px; color: #5F5E5A; line-height: 1.7; }
.closed-divider { border: none; border-top: 0.5px solid #B4B2A9; width: 100%; }
.closed-next { font-size: 12px; color: #5F5E5A; line-height: 1.6; font-style: italic; }

/* ── Already voted ── */
.voted-card {
  background: var(--green-light); border: 0.5px solid var(--green-border);
  border-radius: var(--radius-lg); padding: 20px;
  display: flex; flex-direction: column; align-items: center;
  gap: 12px; text-align: center;
}
.voted-icon {
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--green-border); display: flex; align-items: center;
  justify-content: center; color: var(--green); font-size: 26px;
}
.voted-title { font-size: 15px; font-weight: 500; color: var(--green); }
.voted-sub { font-size: 13px; color: #3B6D11; line-height: 1.6; }

/* ── Confirmation ── */
.confirm-icon {
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--navy-light); display: flex; align-items: center;
  justify-content: center; color: var(--navy); font-size: 28px;
  margin: 4px auto;
}
.confirm-title { font-size: 20px; font-weight: 500; text-align: center; color: #111; }
.confirm-sub { font-size: 14px; color: #555; text-align: center; line-height: 1.6; }
.receipt { background: #f8f9fa; border-radius: var(--radius-lg); padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.receipt-row { display: flex; justify-content: space-between; font-size: 13px; }
.receipt-label { color: #666; }
.receipt-value { color: #111; font-weight: 500; text-align: right; max-width: 60%; word-break: break-all; }
.receipt-divider { border: none; border-top: 0.5px solid #ddd; }
.anon-notice {
  display: flex; align-items: flex-start; gap: 8px;
  background: #EFF6FF; border-radius: var(--radius-md);
  padding: 10px 12px; font-size: 12px; color: #1D4ED8; line-height: 1.5;
}

/* ── Voter identity bar ── */
.voter-bar { display: flex; justify-content: space-between; align-items: center; font-size: 12px; }
.voter-bar-label { color: #888; }
.voter-bar-value { font-weight: 500; color: #111; }

/* ── Responsive ── */
@media (max-width: 400px) {
  .candidate-photo { width: 56px; height: 56px; font-size: 17px; }
  .candidate-name { font-size: 11px; }
}
