/* Voting Kiosk (Urna Eletrônica RPPS) Styling */
:root {
  --urna-bg: #0f172a;
  --urna-card-bg: #1e293b;
  --urna-card-hover: #334155;
  --urna-card-selected: #0284c7;
  --urna-text: #f8fafc;
  --urna-text-muted: #94a3b8;
  --urna-confirm: #16a34a;
  --urna-confirm-hover: #15803d;
  --urna-correct: #ea580c;
  --urna-correct-hover: #c2410c;
  --urna-null: #475569;
  --urna-accent: #38bdf8;
}

body.urna-body {
  background-color: var(--urna-bg);
  color: var(--urna-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
}

/* Header */
.urna-header {
  background: rgba(15, 23, 42, 0.95);
  border-bottom: 2px solid #334155;
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.urna-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 12px;
}

.terminal-badge {
  background: #334155;
  color: #38bdf8;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
}

/* Waiting State */
.waiting-screen {
  min-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
}

.waiting-pulse {
  width: 140px;
  height: 140px;
  background: rgba(56, 189, 248, 0.15);
  border: 4px solid #38bdf8;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 32px;
  animation: pulse 2.5s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.7); }
  70% { transform: scale(1.05); box-shadow: 0 0 0 30px rgba(56, 189, 248, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(56, 189, 248, 0); }
}

.waiting-title {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 12px;
  color: #ffffff;
}

.waiting-desc {
  font-size: 18px;
  color: var(--urna-text-muted);
  max-width: 500px;
  line-height: 1.5;
}

/* Active Ballot Flow */
.ballot-container {
  max-width: 1360px;
  width: 100%;
  margin: 0 auto;
  padding: 14px 24px 30px 24px;
  box-sizing: border-box;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.council-step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.step-pill {
  background: #1e293b;
  border: 2px solid #334155;
  color: var(--urna-text-muted);
  padding: 6px 20px;
  border-radius: 24px;
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.step-pill.active {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.2);
  color: #ffffff;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.3);
}

.step-pill.done {
  border-color: #16a34a;
  background: rgba(22, 163, 74, 0.2);
  color: #4ade80;
}

.council-banner {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border: 2px solid #334155;
  border-radius: 12px;
  padding: 12px 20px;
  margin-bottom: 18px;
  text-align: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.council-banner h2 {
  font-size: 22px;
  font-weight: 800;
  margin: 0 0 2px 0;
  color: #38bdf8;
  letter-spacing: 0.04em;
}

.council-banner p {
  font-size: 14px;
  color: var(--urna-text-muted);
  margin: 0;
}

/* Candidate Grid - Fully Responsive & Non-overflowing */
.candidate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
  width: 100%;
  box-sizing: border-box;
}

.candidate-card {
  background: var(--urna-card-bg);
  border: 3px solid #334155;
  border-radius: 14px;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
  min-height: 270px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.candidate-card:hover {
  border-color: #38bdf8;
  transform: translateY(-4px);
  background: var(--urna-card-hover);
  box-shadow: 0 10px 25px rgba(56, 189, 248, 0.25);
}

.candidate-card.selected {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.2);
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.4);
}

.candidate-photo-wrapper {
  width: 130px;
  height: 130px;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 10px;
  background: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(56, 189, 248, 0.25);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  flex-shrink: 0;
}

.candidate-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}

.candidate-number {
  background: #0284c7;
  color: #ffffff;
  font-size: 24px;
  font-weight: 900;
  padding: 2px 18px;
  border-radius: 6px;
  margin-bottom: 8px;
  letter-spacing: 0.05em;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

.candidate-name {
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  color: #ffffff;
  margin-bottom: 4px;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 2.5em;
  max-height: 2.5em;
  width: 100%;
  word-break: break-word;
}

.candidate-vinculo {
  font-size: 11px;
  text-transform: uppercase;
  color: #94a3b8;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

/* Voto em Branco Card */
.candidate-card.branco-card {
  border-color: #cbd5e1;
  background: linear-gradient(180deg, #1e293b, #0f172a);
}

.candidate-card.branco-card:hover {
  border-color: #f8fafc;
  box-shadow: 0 10px 25px rgba(255, 255, 255, 0.2);
}

.candidate-card.branco-card .candidate-photo-wrapper {
  background: #334155;
  border-color: #94a3b8;
}

.candidate-card.branco-card .candidate-number {
  background: #f8fafc;
  color: #0f172a;
  font-weight: 900;
}

/* Voto Nulo Card */
.candidate-card.nulo-card {
  border-color: #64748b;
  background: linear-gradient(180deg, #1e293b, #0f172a);
}

.candidate-card.nulo-card:hover {
  border-color: #94a3b8;
  box-shadow: 0 10px 25px rgba(100, 116, 139, 0.3);
}

.candidate-card.nulo-card .candidate-photo-wrapper {
  background: #1e293b;
  border-color: #475569;
}

.candidate-card.nulo-card .candidate-number {
  background: #475569;
  color: #ffffff;
  font-weight: 900;
}

/* Responsive Scaling for Laptops and Smaller Screens */
@media (max-height: 820px) {
  .urna-header {
    padding: 10px 20px;
  }
  .ballot-container {
    padding: 10px 16px 20px 16px;
  }
  .council-step-indicator {
    margin-bottom: 10px;
  }
  .step-pill {
    padding: 4px 14px;
    font-size: 13px;
  }
  .council-banner {
    padding: 8px 16px;
    margin-bottom: 12px;
  }
  .council-banner h2 {
    font-size: 19px;
  }
  .council-banner p {
    font-size: 13px;
  }
  .candidate-grid {
    gap: 12px;
    margin-bottom: 16px;
  }
  .candidate-card {
    padding: 10px 8px;
    min-height: 235px;
    border-radius: 10px;
  }
  .candidate-photo-wrapper {
    width: 105px;
    height: 105px;
    margin-bottom: 6px;
  }
  .candidate-number {
    font-size: 20px;
    padding: 2px 14px;
    margin-bottom: 5px;
  }
  .candidate-name {
    font-size: 13px;
    min-height: 2.3em;
    max-height: 2.3em;
    margin-bottom: 2px;
  }
  .candidate-vinculo {
    font-size: 10px;
  }
}

@media (max-width: 680px) {
  .candidate-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .candidate-photo-wrapper {
    width: 90px;
    height: 90px;
  }
  .candidate-number {
    font-size: 18px;
    padding: 2px 10px;
  }
}

/* Confirmation Dialog */
.confirmation-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.confirmation-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.confirm-box {
  background: #1e293b;
  border: 3px solid #38bdf8;
  border-radius: 16px;
  width: 90%;
  max-width: 580px;
  padding: 32px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  transform: scale(0.95);
  transition: transform 0.2s ease;
}

.confirmation-overlay.open .confirm-box {
  transform: scale(1);
}

.confirm-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--urna-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 20px;
}

.confirm-cand-display {
  background: #0f172a;
  border: 2px solid #334155;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 30px;
  display: flex;
  align-items: center;
  gap: 20px;
  text-align: left;
}

.confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.btn-urna {
  padding: 18px 24px;
  font-size: 20px;
  font-weight: 800;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.15s ease;
}

.btn-urna-correct {
  background: var(--urna-correct);
  color: #ffffff;
}
.btn-urna-correct:hover {
  background: var(--urna-correct-hover);
}

.btn-urna-confirm {
  background: var(--urna-confirm);
  color: #ffffff;
}
.btn-urna-confirm:hover {
  background: var(--urna-confirm-hover);
}

.btn-urna-print {
  background: #0ea5e9 !important;
  color: #ffffff !important;
  border: 1px solid #38bdf8;
}
.btn-urna-print:hover {
  background: #0284c7 !important;
}

.btn-urna-whatsapp {
  background: #25D366 !important;
  color: #ffffff !important;
  border: 1px solid #25D366;
}
.btn-urna-whatsapp:hover {
  background: #20bd5a !important;
}

.btn-urna-email {
  background: #EA4335 !important;
  color: #ffffff !important;
  border: 1px solid #EA4335;
}
.btn-urna-email:hover {
  background: #d93025 !important;
}

/* Completion Screen */
.completed-screen {
  min-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
}

.success-badge-icon {
  width: 100px;
  height: 100px;
  background: #16a34a;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  color: #ffffff;
  margin-bottom: 24px;
  box-shadow: 0 0 30px rgba(22, 163, 74, 0.4);
}

.protocol-box {
  background: #1e293b;
  border: 2px solid #334155;
  border-radius: 12px;
  padding: 20px 32px;
  margin: 24px 0;
  display: inline-block;
}

.protocol-val {
  font-size: 32px;
  font-weight: 900;
  color: #38bdf8;
  letter-spacing: 0.05em;
  font-family: monospace;
}

/* Reset countdown bar */
.countdown-bar-container {
  width: 320px;
  height: 8px;
  background: #334155;
  border-radius: 4px;
  overflow: hidden;
  margin: 20px auto;
}

.countdown-bar {
  height: 100%;
  background: #38bdf8;
  width: 100%;
  transition: width 1s linear;
}
