/* Poll — responsive, accessible, no CDN */

:root {
  --poll-primary: #6366f1;
  --poll-primary-dark: #4f46e5;
  --poll-primary-light: #eef2ff;
  --poll-success: #10b981;
  --poll-danger: #ef4444;
  --poll-warning: #f59e0b;
  --poll-bg: #f1f5f9;
  --poll-card: #ffffff;
  --poll-text: #0f172a;
  --poll-muted: #64748b;
  --poll-border: #e2e8f0;
  --poll-radius: 16px;
  --poll-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.06);
  --poll-shadow-lg: 0 20px 25px -5px rgba(99, 102, 241, 0.12), 0 8px 10px -6px rgba(0, 0, 0, 0.08);
}

.poll-container {
  min-height: 60vh;
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1rem 4rem;
  background: var(--poll-bg);
}

.poll-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.875rem;
  color: var(--poll-muted);
  margin-bottom: 1.5rem;
}

.poll-breadcrumb a {
  color: var(--poll-primary);
  text-decoration: none;
}

.poll-breadcrumb a:hover {
  text-decoration: underline;
}

.poll-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 2rem;
  padding: 2rem;
  background: linear-gradient(135deg, var(--poll-primary) 0%, var(--poll-primary-dark) 100%);
  border-radius: var(--poll-radius);
  color: #fff;
  box-shadow: var(--poll-shadow-lg);
}

.poll-header h1 {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  font-weight: 700;
  margin: 0 0 0.5rem;
}

.poll-header p {
  margin: 0;
  opacity: 0.9;
  font-size: 1rem;
}

.poll-header-icon {
  font-size: 3rem;
  opacity: 0.35;
  display: none;
}

@media (min-width: 640px) {
  .poll-header-icon {
    display: block;
  }
}

.poll-search {
  margin-bottom: 2rem;
}

.poll-search-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--poll-card);
  border: 2px solid var(--poll-border);
  border-radius: 999px;
  padding: 0.5rem 0.5rem 0.5rem 1.25rem;
  box-shadow: var(--poll-shadow);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.poll-search-inner:focus-within {
  border-color: var(--poll-primary);
  box-shadow: 0 0 0 4px var(--poll-primary-light);
}

.poll-search-inner i {
  color: var(--poll-muted);
}

.poll-search-inner input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1rem;
  background: transparent;
  min-width: 0;
}

.poll-search-inner button {
  background: var(--poll-primary);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 0.625rem 1.5rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.poll-search-inner button:hover {
  background: var(--poll-primary-dark);
}

.poll-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.poll-card {
  background: var(--poll-card);
  border-radius: var(--poll-radius);
  box-shadow: var(--poll-shadow);
  overflow: hidden;
  transition: transform 0.25s, box-shadow 0.25s;
}

.poll-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--poll-shadow-lg);
}

.poll-card-layout {
  display: flex;
  flex-direction: column;
}

@media (min-width: 640px) {
  .poll-card-layout {
    flex-direction: row;
  }
}

.poll-card-image {
  flex-shrink: 0;
}

.poll-card-image img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}

@media (min-width: 640px) {
  .poll-card-image {
    width: 220px;
  }
  .poll-card-image img {
    height: 100%;
    min-height: 220px;
  }
}

.poll-card-body {
  flex: 1;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.poll-card-top {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.poll-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
}

.poll-status--open {
  background: #d1fae5;
  color: #065f46;
}

.poll-status--open i {
  font-size: 0.5rem;
  color: var(--poll-success);
}

.poll-status--closed {
  background: #fee2e2;
  color: #991b1b;
}

.poll-badge {
  font-size: 0.75rem;
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  font-weight: 500;
}

.poll-badge--login {
  background: #fef3c7;
  color: #92400e;
}

.poll-badge--voted {
  background: var(--poll-primary-light);
  color: var(--poll-primary-dark);
}

.poll-card-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.4;
}

.poll-card-title a {
  color: var(--poll-text);
  text-decoration: none;
}

.poll-card-title a:hover {
  color: var(--poll-primary);
}

.poll-card-summary {
  color: var(--poll-muted);
  font-size: 0.9375rem;
  margin: 0;
  line-height: 1.6;
}

.poll-stats {
  background: var(--poll-bg);
  border-radius: 12px;
  padding: 1rem;
}

.poll-stats-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.8125rem;
  color: var(--poll-muted);
  margin-bottom: 0.75rem;
}

.poll-stats-live {
  color: var(--poll-primary);
  font-weight: 600;
}

.poll-bars {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.poll-bar-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.poll-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8125rem;
  color: var(--poll-text);
}

.poll-bar-pct {
  font-weight: 600;
  color: var(--poll-primary);
}

.poll-bar-track {
  height: 8px;
  background: var(--poll-border);
  border-radius: 999px;
  overflow: hidden;
}

.poll-bar-track-lg {
  height: 12px;
}

.poll-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--poll-primary), #818cf8);
  border-radius: 999px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 0;
}

.poll-bar-fill--mine {
  background: linear-gradient(90deg, var(--poll-success), #34d399);
}

.poll-stats-hidden {
  font-size: 0.8125rem;
  color: var(--poll-muted);
  margin: 0;
}

.poll-card-actions {
  margin-top: auto;
  padding-top: 0.5rem;
}

.poll-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9375rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.poll-btn-primary {
  background: var(--poll-primary);
  color: #fff;
}

.poll-btn-primary:hover {
  background: var(--poll-primary-dark);
  color: #fff;
}

.poll-btn-lg {
  padding: 0.875rem 2rem;
  font-size: 1rem;
}

.poll-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 2.5rem;
  flex-wrap: wrap;
}

.poll-pagination a,
.poll-pagination span {
  padding: 0.625rem 1.25rem;
  border-radius: 10px;
  font-size: 0.9375rem;
  text-decoration: none;
}

.poll-pagination a {
  background: var(--poll-card);
  color: var(--poll-primary);
  border: 2px solid var(--poll-border);
  font-weight: 600;
}

.poll-pagination a:hover {
  border-color: var(--poll-primary);
  background: var(--poll-primary-light);
}

.poll-pagination .current {
  background: var(--poll-primary);
  color: #fff;
  font-weight: 600;
}

.poll-pagination .disabled {
  color: var(--poll-muted);
  opacity: 0.5;
}

.poll-empty {
  text-align: center;
  padding: 4rem 2rem;
  background: var(--poll-card);
  border-radius: var(--poll-radius);
}

.poll-empty i {
  font-size: 3rem;
  color: var(--poll-muted);
  margin-bottom: 1rem;
}

/* Detail page */
.poll-detail {
  background: var(--poll-card);
  border-radius: var(--poll-radius);
  box-shadow: var(--poll-shadow-lg);
  overflow: hidden;
}

.poll-detail-hero {
  display: flex;
  flex-direction: column;
}

@media (min-width: 768px) {
  .poll-detail-hero {
    flex-direction: row;
  }
}

.poll-detail-image {
  flex-shrink: 0;
}

.poll-detail-image img {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  display: block;
}

@media (min-width: 768px) {
  .poll-detail-image {
    width: 42%;
  }
  .poll-detail-image img {
    height: 100%;
    min-height: 280px;
    max-height: none;
  }
}

.poll-detail-header {
  padding: 2rem;
  flex: 1;
}

.poll-detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.poll-detail-header h1 {
  font-size: clamp(1.375rem, 3.5vw, 1.875rem);
  font-weight: 700;
  margin: 0 0 0.75rem;
  line-height: 1.35;
  color: var(--poll-text);
}

.poll-detail-summary {
  color: var(--poll-muted);
  line-height: 1.7;
  margin: 0 0 1rem;
}

.poll-detail-meta {
  font-size: 0.875rem;
  color: var(--poll-muted);
  margin: 0;
}

.poll-vote-section,
.poll-results-section {
  padding: 1.5rem 2rem 2rem;
  border-top: 1px solid var(--poll-border);
}

.poll-vote-section h2,
.poll-results-section h2 {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0 0 1.25rem;
  color: var(--poll-text);
}

.poll-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.poll-option-label {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border: 2px solid var(--poll-border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.poll-option-label:hover {
  border-color: var(--poll-primary);
  background: var(--poll-primary-light);
}

.poll-option-label input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.poll-option-text {
  flex: 1;
  font-weight: 500;
  color: var(--poll-text);
}

.poll-option-check {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--poll-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  transition: all 0.2s;
  flex-shrink: 0;
}

.poll-option-label input:checked ~ .poll-option-check {
  background: var(--poll-primary);
  border-color: var(--poll-primary);
  color: #fff;
}

.poll-option-label:has(input:checked) {
  border-color: var(--poll-primary);
  background: var(--poll-primary-light);
}

.poll-voted-notice,
.poll-closed-notice,
.poll-login-notice {
  margin: 0 2rem 1.5rem;
  padding: 1rem 1.25rem;
  border-radius: 12px;
  font-size: 0.9375rem;
}

.poll-voted-notice {
  background: #d1fae5;
  color: #065f46;
}

.poll-closed-notice {
  background: #fee2e2;
  color: #991b1b;
}

.poll-login-notice {
  background: #fef3c7;
  color: #92400e;
}

.poll-login-notice a {
  color: var(--poll-primary-dark);
  font-weight: 600;
}

.poll-results-grid {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.poll-result-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.poll-result-label {
  font-weight: 600;
  color: var(--poll-text);
}

.poll-result-numbers {
  font-size: 0.875rem;
  color: var(--poll-muted);
  white-space: nowrap;
}

.poll-total-votes {
  margin: 1.5rem 0 0;
  font-size: 0.875rem;
  color: var(--poll-muted);
  text-align: center;
}

@media (max-width: 480px) {
  .poll-container {
    padding: 1rem 0.75rem 3rem;
  }
  .poll-header {
    padding: 1.5rem;
  }
  .poll-detail-header,
  .poll-vote-section,
  .poll-results-section {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }
}
