/*
 Plugin de Encuestas CPT - Estilos Frontend
 Paleta de colores: Rojo Borgoña (#881337 / #4c0519) + Blanco Puro
*/

/* 1. Contenedor Principal de la Encuesta */
.poll-container {
  background-color: #ffffff;
  border: 1px solid #ffe4e6;
  border-radius: 1.5rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.01);
  padding: 2rem;
  max-width: 42rem;
  margin: 1.5rem auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  color: #1e293b;
  box-sizing: border-box;
}

.poll-container * {
  box-sizing: border-box;
}

/* 2. Cabecera de la Encuesta */
.poll-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid #f1f5f9;
}

.poll-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.poll-tag {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #881337;
  background-color: #ffe4e6;
  padding: 0.25rem 0.625rem;
  border-radius: 0.375rem;
}

.poll-counter-badge {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  background-color: #f8fafc;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  border: 1px solid #e2e8f0;
}

.poll-counter-badge strong {
  color: #881337;
}

.poll-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.3;
  margin: 0 0 0.5rem 0;
}

.poll-description {
  color: #64748b;
  font-size: 0.875rem;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

/* 3. Grid de Opciones */
.poll-options-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 640px) {
  .poll-options-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* 4. Tarjeta de Opción (Checkbox) */
.poll-option-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  padding: 1rem;
  border-radius: 0.75rem;
  border: 1px solid #e2e8f0;
  background-color: #ffffff;
  cursor: pointer !important;
  user-select: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.poll-option-card:hover:not(.poll-option-disabled) {
  transform: translateY(-2px);
  border-color: #881337;
  box-shadow: 0 4px 12px rgba(136, 19, 55, 0.08);
}

/* Input Checkbox expandido y transparente por encima de la tarjeta */
.poll-option-card input[type="checkbox"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  margin: 0;
  padding: 0;
  cursor: pointer !important;
  pointer-events: auto;
  z-index: 10;
}

/* Checkbox personalizado */
.poll-custom-checkbox {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 0.375rem;
  border: 2px solid #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 0.75rem;
  margin-top: 0.125rem;
  flex-shrink: 0;
  transition: all 0.2s ease;
  background-color: #ffffff;
  pointer-events: none; /* Permite traspasar la capa hasta el input */
}

.poll-custom-checkbox::after {
  content: "";
  width: 0.375rem;
  height: 0.625rem;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  transition: transform 0.15s ease-in-out;
  margin-bottom: 2px;
}

/* Estado Seleccionado */
.poll-option-card input[type="checkbox"]:checked ~ .poll-custom-checkbox,
.poll-option-card.poll-option-selected .poll-custom-checkbox {
  background-color: #881337;
  border-color: #881337;
}

.poll-option-card input[type="checkbox"]:checked ~ .poll-custom-checkbox::after,
.poll-option-card.poll-option-selected .poll-custom-checkbox::after {
  transform: rotate(45deg) scale(1);
}

.poll-option-card:has(input[type="checkbox"]:checked),
.poll-option-card.poll-option-selected {
  border-color: #881337;
  background-color: #fff1f2;
  box-shadow: 0 0 0 2px rgba(136, 19, 55, 0.15);
}

/* Estado Deshabilitado por límite */
.poll-option-card.poll-option-disabled {
  opacity: 0.5;
  cursor: not-allowed !important;
  background-color: #f8fafc;
  border-color: #e2e8f0;
}

.poll-option-card.poll-option-disabled input[type="checkbox"] {
  cursor: not-allowed !important;
  pointer-events: none;
}

.poll-option-label {
  display: flex;
  flex-direction: column;
  pointer-events: none;
}

.poll-option-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1e293b;
  line-height: 1.25;
}

/* 5. Botón de Envío */
.poll-submit-btn {
  width: 100%;
  background-color: #881337;
  color: #ffffff;
  font-weight: 600;
  font-size: 1rem;
  padding: 0.875rem 1.5rem;
  border-radius: 0.75rem;
  border: none;
  cursor: pointer;
  box-shadow: 0 10px 15px -3px rgba(136, 19, 55, 0.2);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.poll-submit-btn:hover {
  background-color: #4c0519;
  box-shadow: 0 12px 20px -3px rgba(136, 19, 55, 0.3);
}

.poll-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* 6. Mensajes de Estado y Agradecimiento */
.poll-message {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  display: none;
}

.poll-message.poll-error {
  display: block;
  background-color: #fffbebf1;
  color: #92400e;
  border: 1px solid #fcd34d;
}

.poll-thanks-container {
  text-align: center;
  padding: 2.5rem 1rem;
  animation: pollPopIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.poll-thanks-icon {
  width: 5rem;
  height: 5rem;
  background-color: #ffe4e6;
  color: #881337;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin: 0 auto 1.5rem auto;
}

.poll-thanks-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 0.75rem 0;
}

.poll-thanks-text {
  color: #475569;
  font-size: 1rem;
  max-width: 28rem;
  margin: 0 auto 1.5rem auto;
  line-height: 1.5;
}

@keyframes pollPopIn {
  0% { opacity: 0; transform: scale(0.95); }
  100% { opacity: 1; transform: scale(1); }
}