/* =========================================================
   surveys.css — Survey page styles
   ========================================================= */

/* Hero Section */
.surveys-hero {
  background: linear-gradient(135deg, var(--color-brand-primary)22 0%, transparent 100%);
  border-bottom: 1px solid var(--color-surface-border);
  padding: var(--sp-8);
}

.survey-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--sp-4);
  margin-top: var(--sp-6);
}

.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-surface-border);
  border-radius: var(--br-md);
  padding: var(--sp-4);
  text-align: center;
  transition: all 0.2s ease;
}

.stat-card:hover {
  border-color: var(--color-brand-primary);
  background: var(--color-bg-elevated);
}

.stat-value {
  display: block;
  font-size: var(--fs-2xl);
  font-weight: 700;
  color: var(--color-brand-primary);
  line-height: 1;
  margin-bottom: var(--sp-2);
}

.stat-label {
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Toolbar */
.surveys-toolbar {
  display: flex;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
  flex-wrap: wrap;
}

.search-bar {
  flex: 1;
  min-width: 200px;
  position: relative;
}

.search-bar input {
  width: 100%;
  padding: var(--sp-3) var(--sp-3) var(--sp-3) var(--sp-7);
  background: var(--color-surface);
  border: 1px solid var(--color-surface-border);
  border-radius: var(--br-md);
  color: var(--color-text);
  font-size: var(--fs-sm);
  transition: all 0.2s ease;
}

.search-bar input:focus {
  outline: none;
  border-color: var(--color-brand-primary);
  box-shadow: 0 0 0 3px var(--color-brand-primary)15;
}

.search-icon {
  position: absolute;
  left: var(--sp-3);
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--color-text-muted);
  pointer-events: none;
}

#surveys-sort {
  padding: var(--sp-3);
  background: var(--color-surface);
  border: 1px solid var(--color-surface-border);
  border-radius: var(--br-md);
  color: var(--color-text);
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 160px;
}

#surveys-sort:focus {
  outline: none;
  border-color: var(--color-brand-primary);
}

/* Categories */
.survey-categories {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  overflow-x: auto;
  padding-bottom: var(--sp-2);
  margin-bottom: var(--sp-4);
}

.category-pill {
  padding: var(--sp-2) var(--sp-4);
  background: var(--color-surface);
  border: 1px solid var(--color-surface-border);
  border-radius: 20px;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  font-size: var(--fs-sm);
}

.category-pill:hover {
  border-color: var(--color-brand-primary);
  color: var(--color-brand-primary);
}

.category-pill.active {
  background: var(--color-brand-primary);
  border-color: var(--color-brand-primary);
  color: white;
}

/* Survey Cards */
.surveys-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--sp-5);
  margin-bottom: var(--sp-8);
}

.survey-card {
  background: var(--color-surface);
  border: 1px solid var(--color-surface-border);
  border-radius: var(--br-lg);
  padding: var(--sp-5);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.survey-card:hover {
  border-color: var(--color-brand-primary);
  transform: translateY(-4px);
  box-shadow: 0 12px 24px var(--color-brand-primary)20;
}

.survey-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--sp-3);
}

.survey-badge {
  display: inline-block;
  padding: var(--sp-1) var(--sp-3);
  background: var(--color-brand-primary)20;
  color: var(--color-brand-primary);
  border-radius: 4px;
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.bookmark-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.bookmark-btn:hover,
.bookmark-btn.bookmarked {
  opacity: 1;
}

.survey-title {
  font-size: var(--fs-lg);
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: var(--sp-4);
  color: var(--color-text);
  flex-grow: 1;
}

.survey-stats {
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--sp-4);
  display: flex;
  gap: var(--sp-3);
}

.survey-cta {
  display: flex;
  gap: var(--sp-2);
}

.survey-cta .btn {
  flex: 1;
  padding: var(--sp-3);
  font-size: var(--fs-sm);
}

/* Modal */
.survey-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--sp-4);
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.survey-modal-content {
  background: var(--color-bg);
  border-radius: var(--br-lg);
  width: 100%;
  max-width: 700px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: var(--sp-6);
  border-bottom: 1px solid var(--color-surface-border);
  gap: var(--sp-4);
}

.modal-header h2 {
  font-size: var(--fs-xl);
  font-weight: 700;
  line-height: 1.4;
  margin: 0;
  flex: 1;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--color-text-muted);
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.modal-close:hover {
  background: var(--color-surface);
  color: var(--color-text);
}

.modal-body {
  padding: var(--sp-6);
  flex: 1;
  overflow-y: auto;
}

.survey-description {
  font-size: var(--fs-base);
  line-height: 1.6;
  color: var(--color-text-muted);
  margin-bottom: var(--sp-6);
}

.already-voted-banner {
  background: var(--color-brand-primary)15;
  border-left: 4px solid var(--color-brand-primary);
  padding: var(--sp-3) var(--sp-4);
  border-radius: 4px;
  margin-bottom: var(--sp-6);
  color: var(--color-brand-primary);
  font-size: var(--fs-sm);
  font-weight: 500;
}

/* Voting Options */
.survey-options {
  margin-bottom: var(--sp-4);
}

.survey-vote-actions {
  display: flex;
  justify-content: center;
  margin-bottom: var(--sp-6);
}

.survey-vote-actions .btn {
  min-width: 180px;
}

.survey-vote-actions .btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.vote-option {
  display: flex;
  align-items: center;
  padding: var(--sp-4);
  margin-bottom: var(--sp-3);
  background: var(--color-surface);
  border: 2px solid var(--color-surface-border);
  border-radius: var(--br-md);
  cursor: pointer;
  transition: all 0.2s ease;
}

.vote-option:hover:not(.disabled) {
  border-color: var(--color-brand-primary);
  background: var(--color-bg-elevated);
}

.vote-option.selected {
  border-color: var(--color-brand-primary);
  background: var(--color-brand-primary)15;
}

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

.vote-option input[type="radio"] {
  margin-right: var(--sp-3);
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.vote-option.disabled input[type="radio"] {
  cursor: not-allowed;
}

.vote-option span {
  font-size: var(--fs-base);
  color: var(--color-text);
}

/* Results */
.survey-results {
  background: var(--color-bg-elevated);
  border-radius: var(--br-md);
  padding: var(--sp-5);
}

.results-table {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--color-surface-border);
  font-size: var(--fs-sm);
}

.result-row:last-child {
  border-bottom: none;
}

.result-row span:first-child {
  color: var(--color-text);
  font-weight: 500;
}

.result-row span:last-child {
  color: var(--color-text-muted);
}

/* Modal Footer */
.modal-footer {
  padding: var(--sp-6);
  border-top: 1px solid var(--color-surface-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-4);
}

.vote-count {
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
}

/* Dashboard */
.surveys-dashboard {
  padding-block: var(--sp-8) !important;
}

.dashboard-header {
  margin-bottom: var(--sp-6);
}

.dashboard-header .section-title {
  margin-top: var(--sp-3);
}

.dashboard-content {
  display: grid;
  gap: var(--sp-6);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: var(--sp-8);
}

.empty-state h3 {
  margin: 0;
  color: var(--color-text);
}

.empty-state p {
  margin: var(--sp-2) 0 0 0;
  color: var(--color-text-muted);
}

/* Responsive */
@media (max-width: 768px) {
  .surveys-hero {
    padding: var(--sp-5);
  }

  .survey-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .surveys-toolbar {
    flex-direction: column;
  }

  .search-bar,
  #surveys-sort {
    width: 100%;
  }

  .surveys-grid {
    grid-template-columns: 1fr;
  }

  .survey-card {
    padding: var(--sp-4);
  }

  .modal-header {
    padding: var(--sp-4);
  }

  .modal-body {
    padding: var(--sp-4);
  }

  .modal-footer {
    padding: var(--sp-4);
    flex-direction: column;
    align-items: stretch;
  }

  .vote-count {
    text-align: center;
  }
}

@media (max-width: 480px) {
  .survey-stats {
    grid-template-columns: 1fr;
  }

  .survey-modal-content {
    border-radius: var(--br-md);
  }

  .modal-close {
    width: 28px;
    height: 28px;
  }

  .vote-option {
    padding: var(--sp-3);
  }
}
