/**
 * Polls System Styling
 * Cryptographic voting interface
 */

/* ===== Poll Cards (in feed) ===== */
.poll-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  border-left: 4px solid #10b981; /* Green accent for polls */
}

.poll-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

/* Poll content area */
.poll-content {
  margin-top: 15px;
}

.poll-question {
  font-size: 1.25em;
  color: #111827;
  margin: 0 0 10px 0;
  font-weight: 600;
  line-height: 1.4;
}

.poll-description {
  color: #6b7280;
  font-size: 0.95em;
  margin: 0 0 15px 0;
  line-height: 1.6;
}

.poll-meta-info {
  display: flex;
  gap: 15px;
  margin: 15px 0;
  font-size: 0.9em;
  color: #6b7280;
}

.poll-status-badge {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.85em;
  font-weight: 600;
  text-transform: uppercase;
}

.poll-status-badge.open {
  background: #d1fae5;
  color: #065f46;
}

.poll-status-badge.closed {
  background: #fee2e2;
  color: #991b1b;
}

/* Poll category badge (in header) */
.poll-category-badge {
  padding: 4px 12px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  border-radius: 20px;
  font-size: 0.75em;
  font-weight: 600;
  text-transform: uppercase;
}

.poll-category-badge.politics {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.poll-category-badge.community {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

.poll-category-badge.policy {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

/* Poll Header */
.poll-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  gap: 15px;
}

.poll-header h3 {
  flex: 1;
  margin: 0;
  font-size: 1.25em;
  color: #111827;
  line-height: 1.4;
}

.poll-category {
  padding: 4px 12px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  border-radius: 20px;
  font-size: 0.75em;
  font-weight: 600;
  text-transform: uppercase;
  white-space: nowrap;
}

.poll-category.politics {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.poll-category.community {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

.poll-category.policy {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

/* Poll Description */
.poll-description {
  color: #6b7280;
  font-size: 0.95em;
  line-height: 1.6;
  margin-bottom: 15px;
}

/* Poll Meta */
.poll-meta {
  display: flex;
  gap: 15px;
  margin-bottom: 15px;
  font-size: 0.85em;
  color: #9ca3af;
}

.poll-meta span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.poll-status {
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.poll-status.open {
  background: #d1fae5;
  color: #065f46;
}

.poll-status.closed {
  background: #fee2e2;
  color: #991b1b;
}

/* ===== Poll Voting Section (in feed) ===== */
.poll-voting-section {
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid #e5e7eb;
}

.poll-options-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 15px;
}

.poll-option-item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border: 2px solid #e5e7eb;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: white;
}

.poll-option-item:hover {
  border-color: #10b981;
  background: #f0fdf4;
}

.poll-option-item input[type="radio"] {
  margin-right: 10px;
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.poll-option-text {
  flex: 1;
  color: #374151;
  font-size: 0.95em;
}

.poll-option-item input[type="radio"]:checked ~ .poll-option-text {
  font-weight: 600;
  color: #10b981;
}

.poll-vote-btn {
  width: 100%;
  padding: 10px 20px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.poll-vote-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #059669, #047857);
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(16, 185, 129, 0.3);
}

.poll-vote-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.poll-closed-msg {
  text-align: center;
  padding: 15px;
  color: #9ca3af;
  font-style: italic;
  background: #f9fafb;
  border-radius: 6px;
}

/* ===== Poll Voted Section (after voting) ===== */
.poll-voted-section {
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid #e5e7eb;
}

.vote-confirmation {
  background: #ecfdf5;
  border-left: 3px solid #10b981;
  padding: 12px 15px;
  border-radius: 6px;
  margin-bottom: 12px;
}

.vote-confirmation strong {
  color: #065f46;
  display: block;
  margin-bottom: 5px;
  font-size: 1em;
}

.vote-confirmation p {
  color: #047857;
  margin: 5px 0;
  font-size: 0.9em;
}

.vote-receipt-hash {
  font-family: 'Courier New', monospace;
  color: #6b7280;
  font-size: 0.75em;
  display: block;
  margin-top: 8px;
}

.poll-results-preview {
  padding: 10px;
  background: #f9fafb;
  border-radius: 6px;
  text-align: center;
  margin-bottom: 12px;
}

.poll-results-preview strong {
  color: #374151;
  font-size: 0.95em;
}

.poll-verify-btn {
  width: 100%;
  padding: 10px 20px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.95em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.poll-verify-btn:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(59, 130, 246, 0.3);
}

.poll-error {
  color: #dc2626;
  padding: 10px;
  text-align: center;
  font-size: 0.9em;
}

/* ===== Poll Voting ===== */
.poll-voting {
  margin: 20px 0;
}

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

.poll-option {
  display: flex;
  align-items: center;
  padding: 12px 15px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: white;
}

.poll-option:hover {
  border-color: #10b981;
  background: #f0fdf4;
}

.poll-option input[type="radio"] {
  margin-right: 12px;
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.poll-option span {
  flex: 1;
  color: #111827;
  font-size: 0.95em;
}

.poll-option input[type="radio"]:checked + span {
  font-weight: 600;
  color: #10b981;
}

/* Vote Button */
.vote-btn {
  width: 100%;
  padding: 12px 24px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.vote-btn:hover {
  background: linear-gradient(135deg, #059669, #047857);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

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

/* Poll Closed Message */
.poll-closed-message {
  text-align: center;
  padding: 20px;
  color: #9ca3af;
  font-style: italic;
}

/* ===== Poll Results ===== */
.poll-results {
  background: #f9fafb;
  border-radius: 8px;
  padding: 15px;
}

.vote-receipt {
  background: #ecfdf5;
  border-left: 4px solid #10b981;
  padding: 12px 15px;
  border-radius: 6px;
  margin-bottom: 12px;
}

.vote-receipt strong {
  color: #065f46;
  display: block;
  margin-bottom: 5px;
}

.vote-receipt p {
  color: #047857;
  font-size: 0.9em;
  margin: 5px 0;
}

.vote-receipt small {
  font-family: 'Courier New', monospace;
  color: #6b7280;
  font-size: 0.75em;
}

.poll-total-votes {
  text-align: center;
  padding: 10px;
  background: white;
  border-radius: 6px;
  font-weight: 600;
  color: #374151;
}

/* ===== Verify Vote Button ===== */
.verify-vote-btn {
  width: 100%;
  padding: 10px 20px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.95em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 10px;
}

.verify-vote-btn:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* ===== Poll Timestamp ===== */
.poll-timestamp {
  text-align: right;
  font-size: 0.8em;
  color: #9ca3af;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #e5e7eb;
}

/* ===== My Votes Section ===== */
.poll-votes-section {
  background: rgba(16, 185, 129, 0.05);
  border-radius: 12px;
  padding: 20px;
}

.poll-votes-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.my-vote-item {
  background: white;
  border-radius: 8px;
  padding: 15px;
  border-left: 4px solid #10b981;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
}

.my-vote-item h4 {
  margin: 0 0 8px 0;
  color: #111827;
  font-size: 1em;
}

.vote-info {
  display: flex;
  gap: 15px;
  font-size: 0.85em;
  color: #6b7280;
}

.verify-btn-small {
  padding: 8px 16px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.85em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.verify-btn-small:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  transform: scale(1.05);
}

.no-votes {
  text-align: center;
  padding: 30px;
  color: #9ca3af;
  font-style: italic;
}

/* ===== Loading States ===== */
.loading-state {
  text-align: center;
  padding: 40px;
  color: #9ca3af;
}

.loading-state .spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e5e7eb;
  border-top-color: #10b981;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 15px;
}

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

/* ===== Modal Overrides ===== */
.modal-overlay .poll-card {
  margin: 0;
  box-shadow: none;
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
  .poll-header {
    flex-direction: column;
  }

  .poll-category {
    align-self: flex-start;
  }

  .poll-meta {
    flex-direction: column;
    gap: 8px;
  }

  .my-vote-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .verify-btn-small {
    width: 100%;
  }
}

/* ===== Animations ===== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.poll-card {
  animation: fadeIn 0.3s ease-out;
}

/* ===== Accessibility ===== */
.poll-option:focus-within {
  outline: 2px solid #10b981;
  outline-offset: 2px;
}

.vote-btn:focus,
.verify-vote-btn:focus,
.verify-btn-small:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* ===== Print Styles ===== */
@media print {
  .vote-btn,
  .verify-vote-btn,
  .verify-btn-small {
    display: none;
  }

  .poll-card {
    box-shadow: none;
    border: 1px solid #e5e7eb;
    break-inside: avoid;
  }
}
