/* ==========================================================================
   SANTINHO DIGITAL - TEMA BRASIL + BOOTSTRAP 5 + SKELETON + MODAL DE COMPARTILHAR
   ========================================================================== */

:root {
  /* Paleta Oficial Brasil */
  --br-green: #008744;
  --br-green-dark: #005a2e;
  --br-yellow: #ffcc00;
  --br-yellow-dark: #d99b00;
  --br-blue: #002776;
  --br-blue-dark: #001a4e;
  --br-white: #ffffff;

  --color-text-dark: #0f172a;
  --color-text-muted: #475569;
  --color-bg-page: #edf2f7;
  
  --font-heading: 'Montserrat', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
}

body.bg-page {
  font-family: var(--font-body);
  background-color: var(--color-bg-page);
  color: var(--color-text-dark);
  padding: max(16px, env(safe-area-inset-top, 16px)) 12px max(90px, env(safe-area-inset-bottom, 90px)) 12px;
}

/* Container do App */
.app-container {
  max-width: 420px;
}

/* ==========================================================================
   ESQUELETO DE CARREGAMENTO (SKELETON LOADER)
   ========================================================================== */
.skeleton-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: var(--color-bg-page);
  z-index: 9999;
  padding: 20px 12px;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.skeleton-overlay.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.skeleton-card {
  max-width: 420px;
  height: 610px;
  background: #ffffff;
  border-radius: 1.25rem;
  border: 3px solid #cbd5e1;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
}

.skeleton-shimmer {
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-header { height: 48px; }
.skeleton-photo { width: 200px; height: 200px; }
.skeleton-badge { width: 100px; height: 28px; }
.skeleton-title { height: 32px; }
.skeleton-subtitle { height: 18px; }
.skeleton-box { height: 75px; }
.skeleton-btn { height: 44px; }

/* ==========================================================================
   CONTAINER 3D FLIP - COMPATÍVEL COM IOS SAFARI, CHROME & ANDROID
   ========================================================================== */
.card-flip-container {
  width: 100%;
  min-height: 610px;
  -webkit-perspective: 1200px;
  perspective: 1200px;
  position: relative;
}

.santinho-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 610px;
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
  -webkit-transition: -webkit-transform 0.55s cubic-bezier(0.4, 0, 0.2, 1);
  transition: transform 0.55s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ESTRUTURA DAS FACES (FRENTE E VERSO) */
.card-face {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--br-white);
  border-radius: 1.25rem;
  box-shadow: 0 12px 32px rgba(0, 39, 118, 0.15);
  border: 3px solid var(--br-green);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
  overflow: hidden;
}

/* FACE FRENTE */
.card-front {
  z-index: 2;
  -webkit-transform: rotateY(0deg);
  transform: rotateY(0deg);
}

/* FACE VERSO */
.card-back {
  z-index: 1;
  -webkit-transform: rotateY(180deg);
  transform: rotateY(180deg);
}

/* ESTADO GIRADO (FLIPPED) */
.santinho-card-inner.flipped {
  -webkit-transform: rotateY(180deg);
  transform: rotateY(180deg);
}

/* FAIXA DA BANDEIRA: SOMENTE AMARELA E VERDE */
.brasil-ribbon {
  display: flex;
  height: 6px;
  width: 100%;
}

.ribbon-yellow {
  background-color: var(--br-yellow);
  flex: 1;
}

.ribbon-green {
  background-color: var(--br-green);
  flex: 1;
}

/* Header do Card */
.card-header-br {
  background: linear-gradient(135deg, var(--br-blue-dark) 0%, var(--br-blue) 100%);
  color: var(--br-white);
  border-bottom: 4px solid var(--br-yellow);
}

.eleicoes-tag {
  font-family: var(--font-heading);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--br-yellow);
}

.cargo-title {
  font-family: var(--font-heading);
  font-size: 1.18rem;
  font-weight: 900;
  letter-spacing: 0.5px;
  color: var(--br-white);
}

/* Corpo do Card */
.card-body-br {
  height: calc(100% - 64px);
}

/* Foto do Candidato */
.photo-wrapper {
  width: 100%;
  max-width: 220px;
}

.photo-frame {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  overflow: hidden;
  border: 4px solid var(--br-green);
  box-shadow: 0 6px 16px rgba(0, 135, 68, 0.2);
}

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

/* Badge PL */
.pl-badge {
  bottom: -10px;
  background: var(--br-yellow);
  border: 2px solid var(--br-green);
  padding: 3px 14px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.pl-sigla {
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 0.92rem;
  color: var(--br-blue-dark);
}

.pl-num {
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 0.92rem;
  color: var(--br-green-dark);
}

/* Nome e Número */
.nome-sub {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--br-green-dark);
}

.candidate-name {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 900;
  color: var(--br-blue-dark);
  line-height: 1.05;
}

.highlight-surname {
  color: var(--br-green);
}

/* Bloco do Número 22 */
.number-block {
  background: linear-gradient(180deg, #f8fafc 0%, #e6f4ea 100%);
  border: 2px solid var(--br-green);
  border-radius: 12px;
  padding: 8px 14px;
  max-width: 280px;
}

.number-label {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--br-green-dark);
}

.digit {
  background: var(--br-white);
  border: 4px solid var(--br-blue-dark);
  color: var(--br-blue-dark);
  font-family: var(--font-heading);
  font-size: 2.8rem;
  font-weight: 900;
  width: 60px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  box-shadow: 0 4px 0 var(--br-green);
}

.confirma-badge {
  background: var(--br-green);
  color: var(--br-white);
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
}

.confirma-badge strong {
  color: var(--br-yellow);
  font-weight: 900;
}

.slogan-text {
  font-size: 0.76rem;
  font-style: italic;
  font-weight: 700;
  color: var(--br-blue-dark);
}

/* Botão Flip */
.btn-flip {
  background: linear-gradient(135deg, #f0fdf4 0%, #e6f4ea 100%);
  border: 2px solid var(--br-green);
  border-radius: 12px;
  padding: 10px 12px;
  font-family: var(--font-heading);
  font-size: 0.84rem;
  font-weight: 800;
  color: var(--br-green-dark);
  box-shadow: 0 2px 6px rgba(0, 135, 68, 0.12);
  touch-action: manipulation;
}

.btn-flip-back {
  background: linear-gradient(135deg, #f8fafc 0%, #edf2f7 100%);
  border-color: var(--br-blue);
  color: var(--br-blue-dark);
}

.flip-icon {
  width: 18px;
  height: 18px;
}

/* Verso: Compromissos */
.compromisso-item {
  background: #f8fafc;
  border-radius: 8px;
  border-left: 4px solid var(--br-green);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.compromisso-icon {
  font-size: 1.15rem;
}

.compromisso-text strong {
  display: block;
  font-size: 0.82rem;
  color: var(--br-blue-dark);
  font-weight: 800;
}

.compromisso-text p {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  line-height: 1.3;
}

.back-vote-reminder {
  background: linear-gradient(135deg, var(--br-blue-dark) 0%, var(--br-blue) 100%);
  color: var(--br-white);
  border: 1px solid var(--br-yellow);
}

.mini-tag-pl {
  background: var(--br-yellow);
  color: var(--br-blue-dark);
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 0.82rem;
  padding: 2px 6px;
  border-radius: 4px;
}

.mini-vote-text {
  font-size: 0.74rem;
}

.mini-vote-text strong {
  color: var(--br-yellow);
}

/* Botões de Ação */
.btn-whatsapp {
  background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
  color: #ffffff;
  border-radius: 14px;
}

.btn-download {
  background: linear-gradient(135deg, var(--br-blue) 0%, var(--br-blue-dark) 100%);
  color: #ffffff;
  border: 2px solid var(--br-yellow);
  border-radius: 14px;
}

.btn-icon {
  width: 22px;
  height: 22px;
}

/* ==========================================================================
   REDES SOCIAIS OFICIAIS (GRID UNIFORME COM ALTURA E LARGURA PADRONIZADAS)
   ========================================================================== */
.social-section {
  background: var(--br-white);
  border: 2px solid #e2e8f0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.social-heading {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--color-text-muted);
}

.social-uniform-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  width: 100%;
}

.social-box {
  height: 44px;
  padding: 0 8px;
  border-radius: 8px;
  font-size: 0.76rem;
  font-weight: 700;
  text-decoration: none;
  color: #ffffff !important;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
  transition: transform 0.15s ease, opacity 0.15s ease;
  touch-action: manipulation;
}

.social-box:active {
  transform: scale(0.97);
}

.social-box-full {
  grid-column: span 2;
}

.social-svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.social-box.instagram { background: linear-gradient(135deg, #833ab4, #fd1d1d, #fcb045); }
.social-box.x-twitter { background: #000000; }
.social-box.youtube { background: #ff0000; }
.social-box.facebook { background: #1877f2; }
.social-box.telegram { background: #0088cc; }

/* ==========================================================================
   BARRA FIXA NO RODAPÉ (ESTILO YOUTUBE / COMPARTILHAR)
   ========================================================================== */
.fixed-bottom-bar {
  z-index: 1050;
  pointer-events: none;
}

.fixed-bar-content {
  pointer-events: auto;
  background: rgba(10, 25, 47, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 204, 0, 0.4);
  width: 100%;
  max-width: 400px;
}

.badge-num-mini {
  background: var(--br-yellow);
  color: var(--br-blue-dark);
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 0.85rem;
  padding: 3px 8px;
  border-radius: 6px;
}

.fixed-bar-name {
  color: #ffffff;
  font-weight: 700;
  font-size: 0.84rem;
}

/* Botão Estilo YouTube */
.btn-share-round {
  background: #1e293b;
  border: 1px solid #334155;
  color: #34d399; /* emerald-400 */
  padding: 6px 14px;
  border-radius: 30px;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease;
  touch-action: manipulation;
}

.btn-share-round:active {
  transform: scale(0.95);
}

.btn-share-round:hover {
  background: #334155;
  color: #6ee7b7;
}

/* ==========================================================================
   MODAL DE COMPARTILHAMENTO (ESTILO YOUTUBE)
   ========================================================================== */
.share-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 25, 47, 0.75);
  backdrop-filter: blur(6px);
  z-index: 2000;
  padding: 16px;
  transition: opacity 0.3s ease;
}

.share-modal-overlay.d-none {
  display: none !important;
}

.share-modal-overlay.opacity-0 {
  opacity: 0;
}

.share-modal-card {
  background: #ffffff;
  max-width: 390px;
  border: 2px solid var(--br-green);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.title-modal {
  color: var(--br-blue-dark);
}

.btn-close-custom {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: #64748b;
  cursor: pointer;
}

.btn-whatsapp-modal {
  background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
}

.share-input {
  font-size: 0.85rem;
  background-color: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #334155;
}

.btn-copy-link {
  background: var(--br-blue-dark);
  color: #ffffff;
  border: none;
}

.btn-copy-link:hover {
  background: var(--br-blue);
  color: #ffffff;
}

.copy-feedback-text {
  transition: opacity 0.3s ease;
}

/* Toast */
.toast-feedback {
  bottom: 80px;
  background: var(--br-blue-dark);
  color: #ffffff;
  border: 2px solid var(--br-yellow);
  padding: 8px 16px;
  border-radius: 30px;
  font-size: 0.82rem;
  font-weight: 700;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 3000;
  max-width: 90vw;
  text-align: center;
}

.toast-feedback.show {
  opacity: 1;
}

/* Ajustes Telas Muito Pequenas */
@media (max-width: 360px) {
  .card-flip-container,
  .santinho-card-inner {
    min-height: 580px;
  }
  
  .candidate-name {
    font-size: 1.55rem;
  }
  
  .digit {
    width: 52px;
    height: 64px;
    font-size: 2.4rem;
  }
}
