/*
 * Poll Plugin — Frontend Styles
 * Design: Glassmorphism + Dark gradient + Animated results
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* =====================================================
   Variables
   ===================================================== */
:root {
  --poll-font: 'Inter', system-ui, -apple-system, sans-serif;
  --poll-gradient-1: #667eea;
  --poll-gradient-2: #764ba2;
  --poll-gradient-3: #f093fb;
  --poll-accent: #a78bfa;
  --poll-accent-2: #60a5fa;
  --poll-success: #34d399;
  --poll-white: #ffffff;
  --poll-glass-bg: rgba(255, 255, 255, 0.08);
  --poll-glass-border: rgba(255, 255, 255, 0.18);
  --poll-shadow: 0 25px 50px rgba(102, 126, 234, 0.35);
  --poll-radius: 20px;
  --poll-radius-sm: 12px;
  --poll-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =====================================================
   Widget Container
   ===================================================== */
.poll-widget {
  font-family: var(--poll-font);
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  border: 1px solid var(--poll-glass-border);
  border-radius: var(--poll-radius);
  padding: 32px;
  max-width: 560px;
  margin: 2rem auto;
  box-shadow: var(--poll-shadow);
  color: var(--poll-white);
  transition: var(--poll-transition);
}

.poll-widget:hover {
  box-shadow: 0 35px 70px rgba(102, 126, 234, 0.45);
  transform: translateY(-2px);
}

/* Orbs decorativos */
.poll-bg-decoration {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  border-radius: var(--poll-radius);
}

.poll-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.25;
  animation: poll-float 6s ease-in-out infinite;
}

.poll-orb-1 {
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, #667eea, #764ba2);
  top: -80px;
  right: -60px;
  animation-delay: 0s;
}

.poll-orb-2 {
  width: 160px;
  height: 160px;
  background: radial-gradient(circle, #f093fb, #a78bfa);
  bottom: -60px;
  left: -40px;
  animation-delay: 3s;
}

@keyframes poll-float {
  0%, 100% { transform: translateY(0) scale(1); }
  50%       { transform: translateY(-20px) scale(1.05); }
}

/* =====================================================
   Header
   ===================================================== */
.poll-header {
  position: relative;
  z-index: 1;
  margin-bottom: 24px;
}

.poll-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(167, 139, 250, 0.2);
  border: 1px solid rgba(167, 139, 250, 0.35);
  color: var(--poll-accent);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 12px;
}

.poll-badge-icon {
  font-size: 13px;
}

.poll-title {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 8px 0;
  color: var(--poll-white);
  text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.poll-description {
  font-size: 0.875rem;
  color: rgba(255,255,255,0.65);
  margin: 0;
  line-height: 1.5;
}

/* =====================================================
   Poll Body
   ===================================================== */
.poll-body {
  position: relative;
  z-index: 1;
}

/* =====================================================
   Voting Form
   ===================================================== */
.poll-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.poll-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.poll-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--poll-glass-bg);
  border: 1px solid var(--poll-glass-border);
  border-radius: var(--poll-radius-sm);
  cursor: pointer;
  transition: var(--poll-transition);
  user-select: none;
  position: relative;
  overflow: hidden;
}

.poll-option::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(167,139,250,0.1), rgba(96,165,250,0.1));
  opacity: 0;
  transition: opacity 0.3s;
}

.poll-option:hover {
  border-color: rgba(167, 139, 250, 0.5);
  transform: translateX(4px);
}

.poll-option:hover::before {
  opacity: 1;
}

.poll-option.poll-option-selected {
  border-color: var(--poll-accent);
  background: rgba(167, 139, 250, 0.15);
}

.poll-option.poll-option-selected::before {
  opacity: 1;
}

/* Esconder input nativo */
.poll-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

/* Indicador customizado */
.poll-option-indicator {
  width: 22px;
  height: 22px;
  min-width: 22px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.35);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--poll-transition);
  position: relative;
  z-index: 1;
}

.poll-option-indicator::after {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--poll-accent);
  opacity: 0;
  transform: scale(0);
  transition: var(--poll-transition);
}

.poll-option-selected .poll-option-indicator {
  border-color: var(--poll-accent);
  background: rgba(167, 139, 250, 0.2);
}

.poll-option-selected .poll-option-indicator::after {
  opacity: 1;
  transform: scale(1);
}

/* Checkbox style */
.poll-widget[data-allow-multiple="1"] .poll-option-indicator {
  border-radius: 6px;
}

.poll-widget[data-allow-multiple="1"] .poll-option-indicator::after {
  border-radius: 3px;
  width: 11px;
  height: 8px;
  background: transparent;
  border-left: 2px solid var(--poll-accent);
  border-bottom: 2px solid var(--poll-accent);
  transform: rotate(-45deg) scale(0);
  margin-bottom: 2px;
}

.poll-widget[data-allow-multiple="1"] .poll-option-selected .poll-option-indicator::after {
  transform: rotate(-45deg) scale(1);
  opacity: 1;
}

.poll-option-text {
  font-size: 0.95rem;
  font-weight: 500;
  color: rgba(255,255,255,0.9);
  position: relative;
  z-index: 1;
  line-height: 1.4;
}

/* =====================================================
   Vote Button
   ===================================================== */
.poll-vote-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 15px 24px;
  background: linear-gradient(135deg, var(--poll-gradient-1), var(--poll-gradient-2));
  color: var(--poll-white);
  font-family: var(--poll-font);
  font-size: 1rem;
  font-weight: 700;
  border: none;
  border-radius: var(--poll-radius-sm);
  cursor: pointer;
  transition: var(--poll-transition);
  position: relative;
  overflow: hidden;
  letter-spacing: 0.01em;
}

.poll-vote-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--poll-gradient-2), var(--poll-gradient-3));
  opacity: 0;
  transition: opacity 0.3s;
}

.poll-vote-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(102, 126, 234, 0.5);
}

.poll-vote-btn:hover::before {
  opacity: 1;
}

.poll-vote-btn:active {
  transform: translateY(0);
}

.poll-vote-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.poll-btn-text,
.poll-btn-icon {
  position: relative;
  z-index: 1;
}

.poll-btn-loader {
  position: relative;
  z-index: 1;
}

/* Spinner */
.poll-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: poll-spin 0.7s linear infinite;
}

@keyframes poll-spin {
  to { transform: rotate(360deg); }
}

/* =====================================================
   Results
   ===================================================== */
.poll-results {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.poll-result-item {
  position: relative;
}

.poll-result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.poll-result-text {
  font-size: 0.9rem;
  font-weight: 600;
  color: rgba(255,255,255,0.92);
}

.poll-result-percentage {
  font-size: 1rem;
  font-weight: 800;
  color: var(--poll-accent);
  min-width: 45px;
  text-align: right;
}

.poll-progress-bar {
  width: 100%;
  height: 10px;
  background: rgba(255,255,255,0.1);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 4px;
}

.poll-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--poll-gradient-1), var(--poll-accent));
  border-radius: 10px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.poll-progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: poll-shimmer 2s infinite;
}

@keyframes poll-shimmer {
  to { left: 100%; }
}

.poll-result-votes {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.45);
}

/* Destaque da opção mais votada */
.poll-result-item.poll-result-winner .poll-progress-fill {
  background: linear-gradient(90deg, #f093fb, var(--poll-accent));
}

.poll-result-item.poll-result-winner .poll-result-percentage {
  color: #f093fb;
}

/* Mensagem de já votou */
.poll-voted-message {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 14px;
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.3);
  border-radius: var(--poll-radius-sm);
  color: var(--poll-success);
  font-size: 0.85rem;
  font-weight: 500;
}

.poll-check-icon {
  font-style: normal;
  font-size: 1rem;
}

/* =====================================================
   Closed Notice
   ===================================================== */
.poll-closed-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--poll-radius-sm);
  color: rgba(255,255,255,0.5);
  font-size: 0.9rem;
}

/* =====================================================
   Footer
   ===================================================== */
.poll-footer {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.poll-footer-votes {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: rgba(255,255,255,0.5);
}

.poll-votes-icon {
  font-size: 1rem;
}

.poll-view-results-btn {
  background: transparent;
  border: 1px solid rgba(167, 139, 250, 0.4);
  color: var(--poll-accent);
  font-family: var(--poll-font);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: var(--poll-transition);
}

.poll-view-results-btn:hover {
  background: rgba(167, 139, 250, 0.15);
  border-color: var(--poll-accent);
}

/* =====================================================
   Notification Toast
   ===================================================== */
.poll-notification {
  position: relative;
  z-index: 10;
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: var(--poll-radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  text-align: center;
  animation: poll-slide-in 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.poll-notification.poll-notification-success {
  background: rgba(52, 211, 153, 0.15);
  border: 1px solid rgba(52, 211, 153, 0.35);
  color: #6ee7b7;
}

.poll-notification.poll-notification-error {
  background: rgba(248, 113, 113, 0.15);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: #fca5a5;
}

@keyframes poll-slide-in {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =====================================================
   Error message
   ===================================================== */
.poll-error {
  font-family: var(--poll-font);
  padding: 12px 16px;
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.3);
  border-radius: var(--poll-radius-sm);
  color: #fca5a5;
  font-size: 0.875rem;
}

/* =====================================================
   Closed state
   ===================================================== */
.poll-closed .poll-badge {
  background: rgba(148, 163, 184, 0.15);
  border-color: rgba(148, 163, 184, 0.3);
  color: #94a3b8;
}

/* =====================================================
   Result animation on reveal
   ===================================================== */
.poll-result-item {
  animation: poll-result-appear 0.5s ease both;
}

.poll-result-item:nth-child(1) { animation-delay: 0.05s; }
.poll-result-item:nth-child(2) { animation-delay: 0.15s; }
.poll-result-item:nth-child(3) { animation-delay: 0.25s; }
.poll-result-item:nth-child(4) { animation-delay: 0.35s; }
.poll-result-item:nth-child(5) { animation-delay: 0.45s; }
.poll-result-item:nth-child(n+6) { animation-delay: 0.55s; }

@keyframes poll-result-appear {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =====================================================
   Responsive
   ===================================================== */
@media (max-width: 480px) {
  .poll-widget {
    padding: 22px 18px;
    border-radius: 16px;
    margin: 1rem 0;
  }

  .poll-title {
    font-size: 1.15rem;
  }

  .poll-option {
    padding: 12px 14px;
  }
}
