/* ============================================
   Urna Eletrônica - Design baseado em
   github.com/alineinoue/urna-eletronica
   Responsivo para desktop e celular
   ============================================ */

@keyframes pisca {
  0% { opacity: 0.2; }
  50% { opacity: 1; }
  100% { opacity: 0.2; }
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  background: #2c3e50;
  overflow-x: hidden;
}

/* ============================================
   Container da Urna
   ============================================ */
.urna {
  background-color: #dbd5c9;
  padding: 20px;
  display: flex;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  max-width: 100%;
}

/* ============================================
   Tela
   ============================================ */
.tela {
  width: 500px;
  max-width: 100%;
  height: 320px;
  background: linear-gradient(to right, #e8e8e8, #c1c1c1);
  border: 2px solid #555;
  display: flex;
  flex-direction: column;
}

/* Conteúdo principal da tela */
.d-1 {
  flex: 1;
  display: flex;
  min-height: 0;
}

.d-1-left {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding-left: 15px;
  min-width: 0;
}

.d-1-1 {
  height: 45px;
  display: flex;
  align-items: center;
}

.d-1-1 span {
  font-size: 16px;
  font-weight: bold;
  color: #000;
}

.d-1-2 {
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.d-1-2 span {
  font-size: 20px;
  font-weight: bold;
  color: #000;
}

.d-1-3 {
  height: 50px;
  display: flex;
  align-items: center;
}

/* Caixas dos números */
.numero {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 42px;
  border: 1px solid #000;
  font-size: 24px;
  font-weight: bold;
  color: #000;
  background: rgba(255, 255, 255, 0.5);
  margin-right: 4px;
}

.pisca {
  animation-name: pisca;
  animation-duration: 1.2s;
  animation-iteration-count: infinite;
}

/* Informações do candidato */
.d-1-4 {
  flex: 1;
  line-height: 1.5;
  font-size: 14px;
  color: #000;
  overflow: hidden;
}

.d-1-4 .nome {
  font-size: 18px;
  font-weight: bold;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.d-1-4 .partido {
  font-size: 14px;
  color: #333;
}

/* Lado direito - foto do candidato */
.d-1-right {
  width: 100px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding: 10px 10px 10px 0;
}

.d-1-image {
  border: 1px solid #000;
  background-color: #FFF;
  text-align: center;
  font-size: 12px;
  width: 100%;
}

.d-1-image img {
  width: 100%;
  height: auto;
  display: block;
}

.d-1-image .photo-placeholder {
  width: 80px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #999;
  color: #666;
  font-size: 10px;
  font-weight: bold;
}

.d-1-image .photo-label {
  padding: 3px;
  background: #f0f0f0;
  font-size: 11px;
  border-top: 1px solid #000;
}

/* Instruções na parte de baixo */
.d-2 {
  min-height: 50px;
  font-size: 13px;
  border-top: 3px solid #000;
  padding: 5px 10px;
  display: flex;
  align-items: center;
  color: #000;
  line-height: 1.4;
}

/* Avisos (voto nulo, branco, etc) */
.aviso--grande {
  font-size: 32px;
  font-weight: bold;
  text-align: center;
  margin-top: 15px;
  color: #000;
}

.aviso--gigante {
  font-size: 60px;
  font-weight: bold;
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #000;
}

/* ============================================
   Teclado
   ============================================ */
.teclado {
  background-color: #403A3A;
  margin-left: 20px;
  padding: 10px;
}

.teclado--linha {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
}

.teclado--botao {
  min-width: 65px;
  height: 48px;
  background-color: #000;
  color: #FFF;
  font-size: 24px;
  font-weight: bold;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 8px;
  padding: 0 8px;
  box-shadow: 3px 3px 0px #555;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.1s ease;
  white-space: nowrap;
  overflow: hidden;
  box-sizing: border-box;
}

.teclado--botao:hover {
  background-color: #333;
}

.teclado--botao:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0px #555;
}

/* Botão BRANCO */
.botao--branco {
  background-color: #FFF;
  color: #000;
  font-size: 13px;
  min-width: 75px;
}

.botao--branco:hover {
  background-color: #f0f0f0;
}

/* Botão CORRIGE (laranja) */
.botao--corrige {
  background-color: #F09046;
  color: #000;
  font-size: 13px;
  min-width: 75px;
}

.botao--corrige:hover {
  background-color: #ff9a50;
}

/* Botão CONFIRMA (verde) */
.botao--confirma {
  background-color: #48C079;
  color: #000;
  font-size: 13px;
  min-width: 85px;
  height: 56px;
}

.botao--confirma:hover {
  background-color: #50d085;
}

/* ============================================
   Botões da Tela FIM
   ============================================ */
.fim-botoes {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.fim-btn {
  border: none;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  text-align: center;
}

.fim-btn--cola {
  background: #48C079;
  color: #000;
  font-size: 16px;
  padding: 12px 24px;
  width: 100%;
  max-width: 280px;
}

.fim-btn--cola:hover {
  background: #50d085;
}

.fim-btn--cola:active {
  transform: scale(0.97);
}

.fim-btn--reset {
  background: #dbd5c9;
  color: #333;
  font-size: 13px;
  padding: 8px 20px;
  border: 1px solid #999;
}

.fim-btn--reset:hover {
  background: #c9c0b3;
}

.fim-btn--reset:active {
  transform: scale(0.97);
}

/* ============================================
   Resumo da Cola (tela FIM)
   ============================================ */
.cola-resumo {
  padding: 8px 15px;
  font-size: 13px;
  line-height: 1.6;
  overflow-y: auto;
  max-height: 250px;
  color: #000;
}

.cola-titulo {
  font-weight: bold;
  font-size: 15px;
  margin-bottom: 6px;
  text-align: center;
}

.cola-voto {
  margin-bottom: 4px;
  padding: 3px 0;
  border-bottom: 1px solid #aaa;
}

.cola-cargo {
  font-weight: bold;
  color: #333;
}

.cola-numero {
  font-weight: bold;
}

.cola-partido {
  color: #555;
  font-size: 12px;
}

.cola-branco {
  color: #666;
  font-style: italic;
}

.cola-nulo {
  color: #c00;
  font-weight: bold;
}

.cola-footer {
  text-align: center;
  margin-top: 8px;
  font-size: 11px;
  color: #666;
}

/* ============================================
   Navegação
   ============================================ */

/* ============================================
   Tablet (≤ 768px)
   ============================================ */
@media (max-width: 768px) {
  body {
    padding: 8px;
  }

  .urna {
    flex-direction: column;
    padding: 15px;
    width: 100%;
  }

  .tela {
    width: 100%;
    height: 280px;
  }

  .teclado {
    margin-left: 0;
    margin-top: 15px;
    width: 100%;
  }

  .teclado--linha {
    justify-content: center;
    flex-wrap: wrap;
  }

  .teclado--botao {
    min-width: 70px;
    height: 52px;
    font-size: 26px;
    margin: 6px;
    padding: 0 10px;
  }

  .botao--branco,
  .botao--corrige {
    min-width: 85px;
    font-size: 14px;
  }

  .botao--confirma {
    min-width: 95px;
    height: 60px;
    font-size: 14px;
  }
}

/* ============================================
   Celular (≤ 480px)
   ============================================ */
@media (max-width: 480px) {
  .urna {
    padding: 10px;
    border-radius: 5px;
    width: 100%;
  }

  .tela {
    height: 260px;
    border-width: 1px;
  }

  .d-1-1 {
    height: 38px;
  }

  .d-1-1 span {
    font-size: 14px;
  }

  .d-1-2 {
    height: 38px;
  }

  .d-1-2 span {
    font-size: 17px;
  }

  .d-1-3 {
    height: 42px;
  }

  .numero {
    width: 28px;
    height: 36px;
    font-size: 20px;
    margin-right: 3px;
  }

  .d-1-left {
    padding-left: 10px;
  }

  .d-1-4 {
    font-size: 12px;
    line-height: 1.4;
  }

  .d-1-4 .nome {
    font-size: 15px;
  }

  .d-1-4 .partido {
    font-size: 12px;
  }

  .d-1-right {
    width: 75px;
    padding: 8px 8px 8px 0;
  }

  .d-1-image .photo-placeholder {
    width: 60px;
    height: 75px;
    font-size: 9px;
  }

  .d-1-image .photo-label {
    font-size: 10px;
    padding: 2px;
  }

  .d-2 {
    min-height: 45px;
    font-size: 11px;
    padding: 4px 8px;
  }

  .aviso--grande {
    font-size: 26px;
    margin-top: 10px;
  }

  .aviso--gigante {
    font-size: 48px;
  }

  .teclado {
    padding: 8px 5px;
  }

  .teclado--linha {
    flex-wrap: wrap;
  }

  .teclado--botao {
    min-width: 55px;
    height: 50px;
    font-size: 22px;
    margin: 5px;
    padding: 0 8px;
    box-shadow: 2px 2px 0px #555;
  }

  .botao--branco,
  .botao--corrige {
    font-size: 12px;
    min-width: 75px;
  }

  .botao--confirma {
    min-width: 85px;
    height: 56px;
    font-size: 13px;
  }

  .fim-btn--cola {
    font-size: 15px;
    padding: 14px 20px;
  }

  .fim-btn--reset {
    font-size: 12px;
    padding: 7px 16px;
  }

  .cola-resumo {
    font-size: 12px;
    padding: 6px 10px;
    max-height: 200px;
  }

  .cola-resumo .cola-titulo {
    font-size: 14px;
  }

  .cola-resumo .cola-voto {
    font-size: 11px;
    padding: 2px 0;
  }

  .cola-resumo .cola-footer {
    font-size: 10px;
  }
}

/* ============================================
   Celular pequeno (≤ 360px)
   ============================================ */
@media (max-width: 360px) {
  .tela {
    height: 240px;
  }

  .numero {
    width: 24px;
    height: 32px;
    font-size: 18px;
    margin-right: 2px;
  }

  .d-1-right {
    width: 65px;
  }

  .d-1-image .photo-placeholder {
    width: 50px;
    height: 65px;
  }

  .teclado--botao {
    min-width: 48px;
    height: 46px;
    font-size: 20px;
    margin: 4px;
    padding: 0 6px;
  }

  .botao--branco,
  .botao--corrige {
    font-size: 11px;
    min-width: 68px;
  }

  .botao--confirma {
    min-width: 75px;
    height: 52px;
    font-size: 12px;
  }
}
