/**
 * Polls Styles - Village Brand System
 * Colors: Teal #14b8a6, Earth Black #0b0d0e, Paper White #fcfcff
 * Typography: Atkinson Hyperlegible
 * Accessibility: WCAG AAA compliant
 */

/* =======================
   Poll Card
   ======================= */

.poll-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.2s ease;
}

.poll-card:hover {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.poll-header {
  border-bottom: 1px solid #e5e7eb;
}

.poll-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #0b0d0e;
  line-height: 1.5;
}

/* =======================
   Vote Button
   ======================= */

.vote-button {
  position: relative;
  border: 2px solid #e5e7eb;
  background: white;
  transition: all 0.2s ease;
  min-height: 44px; /* WCAG AAA touch target */
}

.vote-button:hover:not(:disabled) {
  border-color: #14b8a6;
  background: #f0fdfa;
  transform: translateY(-1px);
}

.vote-button:focus {
  outline: none;
  ring: 2px;
  ring-color: #14b8a6;
  ring-offset: 2px;
}

.vote-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.vote-button.voted {
  border-color: #14b8a6;
  background: linear-gradient(135deg, #f0fdfa 0%, #ccfbf1 100%);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.1);
}

.vote-button.voted::before {
  content: '✓';
  position: absolute;
  top: 8px;
  right: 12px;
  color: #14b8a6;
  font-weight: bold;
  font-size: 1.25rem;
}

/* =======================
   Vote Bar
   ======================= */

.vote-bar {
  width: 100%;
  height: 8px;
  background: #f3f4f6;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.vote-bar-fill {
  height: 100%;
  background: linear-gradient(to right, #14b8a6, #0d9b8c);
  border-radius: 4px;
  transition: width 0.3s ease;
  position: relative;
}

.vote-bar-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.3) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* =======================
   Voter Badges
   ======================= */

.voter-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
  background: linear-gradient(135deg, #ccfbf1 0%, #99f6e4 100%);
  color: #0f766e;
  transition: all 0.2s ease;
}

.voter-badge:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 4px rgba(20, 184, 166, 0.2);
}

/* =======================
   Voters List
   ======================= */

.voters-list {
  background: #f9fafb;
}

.voters-list h4 {
  font-weight: 600;
  color: #0b0d0e;
}

/* =======================
   Poll Actions
   ======================= */

.poll-actions {
  background: #f9fafb;
}

.poll-actions button:hover {
  text-decoration: underline;
}

/* =======================
   Create Poll Modal
   ======================= */

.modal-overlay {
  backdrop-filter: blur(4px);
}

/* =======================
   Empty State
   ======================= */

.empty-state svg {
  color: #9ca3af;
}

.empty-state h3 {
  font-size: 1.125rem;
  font-weight: 500;
  color: #0b0d0e;
}

.empty-state p {
  color: #6b7280;
}

/* =======================
   Loading State
   ======================= */

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

.animate-spin {
  animation: spin 1s linear infinite;
}

/* =======================
   Status Badges
   ======================= */

.status-badge {
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

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

.status-badge.expired {
  background: #f3f4f6;
  color: #6b7280;
}

/* =======================
   Form Inputs
   ======================= */

input[type="text"],
input[type="datetime-local"],
select,
textarea {
  font-family: 'Atkinson Hyperlegible', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

input[type="text"]:focus,
input[type="datetime-local"]:focus,
select:focus,
textarea:focus {
  border-color: #14b8a6;
  ring: 2px;
  ring-color: #14b8a6;
}

/* =======================
   Buttons
   ======================= */

.btn-primary {
  background: linear-gradient(135deg, #14b8a6 0%, #0d9b8c 100%);
  color: white;
  font-weight: 500;
  padding: 0.625rem 1.25rem;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
  min-height: 44px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #0d9b8c 0%, #0a7f73 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(20, 184, 166, 0.2);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: white;
  color: #0b0d0e;
  border: 1px solid #d1d5db;
  font-weight: 500;
  padding: 0.625rem 1.25rem;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
  min-height: 44px;
}

.btn-secondary:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

/* =======================
   Pagination
   ======================= */

.pagination button {
  min-height: 44px;
  min-width: 88px;
}

/* =======================
   Dark Mode
   ======================= */

@media (prefers-color-scheme: dark) {
  .poll-card {
    background: #1f2937;
    color: #f9fafb;
  }

  .poll-header {
    border-bottom-color: #374151;
  }

  .poll-header h3 {
    color: #f9fafb;
  }

  .vote-button {
    background: #1f2937;
    border-color: #374151;
    color: #f9fafb;
  }

  .vote-button:hover:not(:disabled) {
    background: #0f172a;
    border-color: #14b8a6;
  }

  .vote-button.voted {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  }

  .vote-bar {
    background: #374151;
  }

  .poll-actions,
  .voters-list {
    background: #111827;
    border-color: #374151;
  }

  .voter-badge {
    background: linear-gradient(135deg, #0f766e 0%, #0d9488 100%);
    color: #ccfbf1;
  }

  .empty-state h3 {
    color: #f9fafb;
  }

  .empty-state p {
    color: #9ca3af;
  }

  input[type="text"],
  input[type="datetime-local"],
  select,
  textarea {
    background: #1f2937;
    border-color: #374151;
    color: #f9fafb;
  }

  input[type="text"]:focus,
  input[type="datetime-local"]:focus,
  select:focus,
  textarea:focus {
    border-color: #14b8a6;
    background: #0f172a;
  }

  .btn-secondary {
    background: #374151;
    color: #f9fafb;
    border-color: #4b5563;
  }

  .btn-secondary:hover {
    background: #4b5563;
    border-color: #6b7280;
  }
}

/* =======================
   Reduced Motion
   ======================= */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .vote-bar-fill::after {
    animation: none;
  }
}

/* =======================
   Responsive Design
   ======================= */

/* Mobile */
@media (max-width: 640px) {
  .poll-header h3 {
    font-size: 1.125rem;
  }

  .poll-card {
    border-radius: 8px;
  }

  .vote-button {
    padding: 0.875rem 1rem;
  }

  .voter-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.625rem;
  }

  .btn-primary,
  .btn-secondary {
    width: 100%;
    justify-content: center;
  }
}

/* Tablet */
@media (min-width: 641px) and (max-width: 1024px) {
  .poll-header h3 {
    font-size: 1.25rem;
  }
}

/* Desktop */
@media (min-width: 1025px) {
  .poll-card:hover {
    transform: translateY(-2px);
  }
}

/* =======================
   Accessibility
   ======================= */

/* Focus visible for keyboard navigation */
*:focus-visible {
  outline: 2px solid #14b8a6;
  outline-offset: 2px;
}

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .vote-button {
    border-width: 3px;
  }

  .vote-button.voted {
    border-width: 4px;
  }

  .vote-bar-fill {
    background: #14b8a6;
  }
}

/* =======================
   Print Styles
   ======================= */

@media print {
  .poll-actions,
  .vote-button,
  button {
    display: none;
  }

  .poll-card {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .vote-bar {
    border: 1px solid #000;
  }

  .vote-bar-fill {
    background: #666;
  }
}
