/* LAYOUT DE LA URNA */
body:not(.admin-layout) {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 2rem 0 2rem;
  height: 100vh;
  overflow: hidden;
}

body:not(.admin-layout) .container {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow-y: auto;
  width: 100%;
  padding-bottom: 2rem;
  scrollbar-width: none;
}
body:not(.admin-layout) .container::-webkit-scrollbar {
  display: none;
}

/* ── TOP HEADER ── */
.urna-top-header {
  width: 100%;
  max-width: 1200px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.urna-header-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.urna-logo {
  width: 80px;
  height: auto;
  filter: drop-shadow(0 4px 12px rgba(57,169,0,0.2));
}

.urna-header-text {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.urna-main-title {
  color: var(--primary);
  font-size: 1.9rem;
  font-weight: 900;
  margin: 0;
  line-height: 1.1;
  letter-spacing: -0.5px;
}

.urna-subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  margin: 0;
  margin-top: 0.3rem;
  font-weight: 500;
}

/* ── BLOBS ── */
.blob {
  position: fixed;
  border-radius: 50%;
  z-index: -1;
  pointer-events: none;
}
.blob-1 {
  top: -20%; left: -10%;
  width: 50vw; height: 50vw;
  min-width: 500px; min-height: 500px;
  background: radial-gradient(circle, rgba(57, 169, 0, 0.1) 0%, transparent 70%);
}
.blob-2 {
  bottom: -20%; right: -10%;
  width: 60vw; height: 60vw;
  min-width: 600px; min-height: 600px;
  background: radial-gradient(circle, rgba(255, 108, 0, 0.07) 0%, transparent 70%);
}

/* ── JORNADA SELECTOR ── */
.jornada-selector {
  position: relative;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(12px);
  padding: 0.55rem 1.1rem;
  border-radius: 14px;
  border: 1.5px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 2px 8px -2px rgba(0,0,0,0.08);
  cursor: pointer;
  user-select: none;
  z-index: 50;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.jornada-selector:hover {
  border-color: rgba(57,169,0,0.4);
  box-shadow: 0 4px 12px -3px rgba(57,169,0,0.12);
}

.jornada-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.custom-select {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--text-main);
  font-weight: 700;
  font-size: 0.95rem;
}

.chevron-icon { transition: transform 0.2s ease; }
.jornada-selector.open .chevron-icon { transform: rotate(180deg); }

.custom-options {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0; right: 0;
  background: rgba(255,255,255,0.98);
  backdrop-filter: blur(16px);
  border: 1.5px solid var(--border-color);
  border-radius: 14px;
  box-shadow: 0 12px 32px -8px rgba(15,23,42,0.12), 0 2px 8px rgba(15,23,42,0.04);
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px) scale(0.98);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.jornada-selector.open .custom-options {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0) scale(1);
}

.custom-option {
  padding: 0.75rem 1.1rem;
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.95rem;
  transition: background 0.15s;
}
.custom-option:hover { background: #f8fafc; }
.custom-option.selected {
  color: var(--primary);
  background: rgba(57, 169, 0, 0.06);
  font-weight: 700;
}

/* ── GRID DE CANDIDATOS ── */
.candidatos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1.5rem;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  align-items: stretch;
}

/* ── CANDIDATO CARD ── */
.candidato-card {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1.5px solid rgba(255, 255, 255, 0.95);
  border-radius: 24px;
  padding: 0;
  text-align: center;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  position: relative;
  box-shadow: 0 2px 12px -4px rgba(15,23,42,0.08), 0 1px 2px rgba(15,23,42,0.04);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  will-change: transform;
}

.candidato-card:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: 0 20px 40px -12px rgba(15,23,42,0.12), 0 4px 8px -2px rgba(15,23,42,0.06);
}

.card-image-wrapper {
  position: relative;
  padding: 2.5rem 1.5rem 1.5rem;
  display: flex;
  justify-content: center;
  align-items: center;
}

.candidato-img {
  position: relative;
  z-index: 3;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  margin: 0;
  object-fit: cover;
  object-position: center;
  border: 4px solid #ffffff;
  background-color: white;
  transition: transform 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease;
  box-shadow: 0 8px 24px -6px rgba(15,23,42,0.14);
}

.candidato-card:hover .candidato-img {
  transform: scale(1.06);
  box-shadow: 0 16px 32px -8px rgba(15,23,42,0.18);
}

.candidato-info {
  padding: 0 1.25rem 1rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.candidato-badge {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.3rem 0.8rem;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.65rem;
}

.candidato-nombre {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0;
  line-height: 1.3;
  letter-spacing: -0.2px;
}

.card-action {
  padding: 1.1rem 1.5rem;
  background: rgba(248,250,252,0.6);
  border-top: 1.5px solid rgba(0,0,0,0.04);
  transition: all 0.35s ease;
}

.btn-vote-hover {
  display: block;
  font-weight: 700;
  color: var(--text-muted);
  font-size: 0.82rem;
  transition: all 0.35s ease;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.candidato-card:hover .card-action {
  background: var(--primary);
  border-color: var(--primary);
}

.candidato-card:hover .btn-vote-hover {
  color: #ffffff;
}

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(8px) saturate(180%);
  -webkit-backdrop-filter: blur(8px) saturate(180%);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 1000;
}
.modal-overlay.active { opacity: 1; pointer-events: all; }

.modal-content {
  background: rgba(255,255,255,0.97);
  border: 1.5px solid rgba(255,255,255,0.5);
  padding: 2.5rem 2rem;
  border-radius: 28px;
  text-align: center;
  max-width: 400px;
  width: 90%;
  transform: scale(0.92) translateY(10px);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.3) inset,
    0 32px 64px -16px rgba(15,23,42,0.25),
    0 8px 16px -4px rgba(15,23,42,0.08);
}
.modal-overlay.active .modal-content {
  transform: scale(1) translateY(0);
}

.modal-info { margin: 1.5rem 0; }
.modal-img {
  width: 110px; height: 110px;
  border-radius: 50%; object-fit: cover; object-position: center;
  border: 4px solid var(--primary);
  box-shadow: 0 8px 24px -6px rgba(57,169,0,0.3);
}
.modal-nombre {
  font-size: 1.4rem;
  margin-top: 1rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.3px;
}

.modal-buttons {
  display: flex; gap: 0.75rem; justify-content: center; margin-top: 1.75rem;
}

button {
  padding: 0.8rem 1.6rem;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  letter-spacing: 0.02em;
}

.btn-confirm {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white;
  box-shadow: 0 4px 14px -3px rgba(57,169,0,0.4);
}
.btn-confirm:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px -5px rgba(57,169,0,0.45);
}
.btn-cancel {
  background: #f1f5f9;
  color: var(--text-muted);
  border: 1.5px solid var(--border-color);
}
.btn-cancel:hover {
  background: #e2e8f0;
  color: var(--text-main);
}

/* ── SUCCESS SCREEN ── */
.success-screen {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 50%, #f0fdf4 100%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  z-index: 2000;
  opacity: 0; pointer-events: none;
  transition: opacity 0.5s ease;
}
.success-screen.active { opacity: 1; pointer-events: all; }
.success-icon {
  font-size: 6rem; color: var(--primary); margin-bottom: 1.5rem;
  animation: scaleIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  filter: drop-shadow(0 8px 24px rgba(57,169,0,0.3));
}
.success-screen h1 { color: var(--text-main); }
.success-text { font-size: 1.1rem; color: var(--text-muted); margin-top: 0.75rem; font-weight: 500; }
@keyframes scaleIn { from { transform: scale(0) rotate(-15deg); } to { transform: scale(1) rotate(0); } }

/* ═══════════════════════════════════════
   RESPONSIVE — Urna
   ─ 1024px  Tablet landscape
   ─  768px  Tablet portrait
   ─  480px  Mobile
   ─  360px  Small mobile
═══════════════════════════════════════ */

/* ── 1024px: tablet landscape ── */
@media (max-width: 1024px) {
  body:not(.admin-layout) {
    padding: 1.5rem 1.5rem 0 1.5rem;
  }

  .candidatos-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
  }

  .urna-main-title { font-size: 1.7rem; }
}

/* ── 768px: tablet portrait ── */
@media (max-width: 768px) {
  body:not(.admin-layout) {
    padding: 1.25rem 1rem 0 1rem;
    height: 100dvh; /* dynamic viewport on mobile browsers */
  }

  /* Header adaptado */
  .urna-top-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
  }
  .urna-header-left { gap: 0.85rem; }
  .urna-logo { width: 56px; }
  .urna-main-title { font-size: 1.35rem; letter-spacing: -0.3px; }
  .urna-subtitle { font-size: 0.85rem; }

  /* Grid 2 columnas */
  .candidatos-grid {
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }

  /* Cards más compactas */
  .card-image-wrapper { padding: 1.75rem 1rem 1rem; }
  .candidato-img { width: 90px; height: 90px; }
  .candidato-nombre { font-size: 1rem; }
  .candidato-badge { font-size: 0.65rem; }
  .card-action { padding: 0.9rem; }
  .btn-vote-hover { font-size: 0.75rem; }

  /* Modal */
  .modal-content { padding: 1.75rem 1.25rem; max-width: 95%; }
  .modal-img { width: 90px; height: 90px; }
  .modal-nombre { font-size: 1.25rem; }

  /* Selector jornada */
  .jornada-label { display: none; }
}

/* ── 480px: móvil ── */
@media (max-width: 480px) {
  body:not(.admin-layout) {
    padding: 1rem 0.75rem 0 0.75rem;
  }

  .urna-top-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    padding-bottom: 0.85rem;
    margin-bottom: 0.85rem;
  }
  .urna-header-left { flex-direction: row; align-items: center; }
  .urna-logo { width: 48px; }
  .urna-main-title { font-size: 1.15rem; }
  .urna-subtitle { display: none; } /* ocultar en pantallas muy pequeñas */

  /* 1 columna en móvil */
  .candidatos-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  /* Cards horizontales en 1 columna */
  .candidato-card {
    flex-direction: row;
    align-items: center;
    border-radius: 18px;
    text-align: left;
  }
  .card-image-wrapper {
    padding: 1rem;
    flex-shrink: 0;
    background: transparent !important;
  }
  .candidato-img { width: 72px; height: 72px; }
  .candidato-info {
    padding: 0.75rem 0.75rem 0.75rem 0;
    align-items: flex-start;
    flex-grow: 1;
  }
  .candidato-badge { margin-bottom: 0.4rem; }
  .candidato-nombre { font-size: 0.95rem; text-align: left; }
  .card-action {
    padding: 1rem;
    border-top: none;
    border-left: 1.5px solid rgba(0,0,0,0.04);
    flex-shrink: 0;
    display: flex;
    align-items: center;
  }
  .btn-vote-hover { writing-mode: vertical-lr; font-size: 0.68rem; letter-spacing: 0.12em; }
}

/* ── 360px: móvil pequeño ── */
@media (max-width: 360px) {
  .urna-main-title { font-size: 1rem; }
  .candidato-img { width: 60px; height: 60px; }
  .candidato-nombre { font-size: 0.88rem; }
}