/* Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  color: #333;
  background: #f5f5f5;
  min-height: 100vh;
  padding: 0;
}

/* Header/Navigation */
.app-header {
  background: linear-gradient(135deg, #0b5cff 0%, #0052d9 100%);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  padding: 1rem 2rem;
  margin-bottom: 2rem;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
}

.home-link {
  color: white;
  text-decoration: none;
  font-size: 1.5rem;
  font-weight: 600;
  display: inline-block;
  transition: opacity 0.2s ease;
}

.home-link:hover {
  opacity: 0.9;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  background: white;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin-bottom: 2rem;
}

h1 {
  color: #333;
  font-size: 2rem;
}

/* Alert Messages */
.alert {
  padding: 1rem;
  margin: 1rem 0;
  border-radius: 4px;
  border-left: 4px solid;
}

.alert-success {
  background: #d4edda;
  border-color: #28a745;
  color: #155724;
}

.alert-error {
  background: #f8d7da;
  border-color: #dc3545;
  color: #721c24;
}

.alert-info {
  background: #d1ecf1;
  border-color: #17a2b8;
  color: #0c5460;
}

/* Auth Status Components */
.auth-container {
  margin: 2rem 0;
}

.user-connected {
  padding: 1.5rem;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border-radius: 8px;
  border-left: 4px solid #0b5cff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.user-connected p {
  margin: 0 0 1rem 0;
  color: #1e40af;
  font-size: 0.95rem;
}

.user-connected strong {
  color: #1e3a8a;
  font-weight: 600;
}

.user-disconnected {
  padding: 2rem;
  background: #f8f9fa;
  border-radius: 8px;
  text-align: center;
  border: 2px dashed #dee2e6;
}

.user-disconnected p {
  margin: 0 0 1.5rem 0;
  color: #6c757d;
  font-size: 1rem;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: all 0.2s ease;
  line-height: 1;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

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

.btn-primary {
  background: #0b5cff;
  color: white;
  padding: 0.75rem 2rem;
}

.btn-primary:hover {
  background: #0951e6;
}

.btn-danger {
  background: #dc3545;
  color: white;
}

.btn-danger:hover {
  background: #c82333;
}

/* HTMX Loading States */
.htmx-request .btn {
  opacity: 0.6;
  cursor: wait;
  pointer-events: none;
}

.htmx-request .btn::after {
  content: '...';
  margin-left: 0.25rem;
}

/* Zoom Button Loading State */
.btn-zoom-create .btn-label {
  display: inline;
}

.btn-zoom-create .btn-loading {
  display: none;
}

.htmx-request .btn-zoom-create .btn-label,
.btn-zoom-create.htmx-request .btn-label {
  display: none;
}

.htmx-request .btn-zoom-create .btn-loading,
.btn-zoom-create.htmx-request .btn-loading {
  display: inline;
}

/* Remove animated dots from generic loading for zoom button */
.htmx-request .btn-zoom-create::after,
.btn-zoom-create.htmx-request::after {
  content: none;
}

/* Zoom button specific loading feedback */
.htmx-request .btn-zoom-create,
.btn-zoom-create.htmx-request {
  opacity: 0.8;
  cursor: wait;
  pointer-events: none;
}

/* Pulsing animation for loading text */
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.htmx-request .btn-zoom-create .btn-loading,
.btn-zoom-create.htmx-request .btn-loading {
  animation: pulse 1.5s ease-in-out infinite;
}

/* Fade transitions for HTMX */
.htmx-swapping {
  opacity: 0;
  transition: opacity 200ms ease-out;
}

.htmx-settling {
  opacity: 1;
  transition: opacity 200ms ease-in;
}

/* Navigation Menu */
.navigation-menu {
  margin: 2rem 0;
}

.navigation-menu h2 {
  color: #333;
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #0b5cff;
}

.menu-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.menu-card {
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  border: 2px solid #e9ecef;
  border-radius: 8px;
  padding: 1.5rem;
  transition: all 0.3s ease;
}

.menu-card:hover {
  border-color: #0b5cff;
  box-shadow: 0 4px 12px rgba(11, 92, 255, 0.15);
  transform: translateY(-2px);
}

.menu-card h3 {
  color: #333;
  font-size: 1.3rem;
  margin-bottom: 0.75rem;
}

.menu-card p {
  color: #6c757d;
  font-size: 0.95rem;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.menu-card .btn {
  width: 100%;
  text-align: center;
}

/* Participantes Module Styles */
.participantes-container,
.participantes-detail-container {
  max-width: 1200px;
  margin: 0 auto;
  background: white;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.filter-section,
.create-section,
.upload-section,
.actions-section,
.listas-section,
.participantes-section {
  margin: 2rem 0;
  padding: 1.5rem;
  background: #f8f9fa;
  border-radius: 8px;
}

.filter-section h2,
.create-section h2,
.upload-section h2,
.actions-section h2,
.listas-section h2,
.participantes-section h2 {
  margin-bottom: 1rem;
  color: #495057;
  font-size: 1.3rem;
}

/* Forms */
.filter-form,
.create-lista-form,
.upload-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-weight: 600;
  color: #495057;
  font-size: 0.9rem;
}

.form-group input,
.form-group select {
  padding: 0.75rem;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 1rem;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #0b5cff;
  box-shadow: 0 0 0 3px rgba(11, 92, 255, 0.1);
}

.form-group input[type='file'] {
  padding: 0.5rem;
}

.help-text {
  font-size: 0.85rem;
  color: #6c757d;
  font-style: italic;
}

.filter-form .form-group,
.upload-form .form-group {
  flex-direction: column;
}

.filter-form button,
.filter-form a {
  margin-top: 0.5rem;
}

.table-scroll-x {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-scroll-x .participantes-table {
  width: max-content;
  min-width: 100%;
}

/* Tables */
.listas-table,
.participantes-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.listas-table thead,
.participantes-table thead {
  background: #0b5cff;
  color: white;
}

.listas-table th,
.participantes-table th {
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.listas-table td,
.participantes-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e9ecef;
}

.listas-table tr:hover,
.participantes-table tr:hover {
  background: #f8f9fa;
}

.listas-table tr:last-child td,
.participantes-table tr:last-child td {
  border-bottom: none;
}

.listas-table td.actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.listas-table td.actions .btn,
.participantes-table td.actions .btn {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

/* Button Variants */
.btn-secondary {
  background: #6c757d;
  color: white;
}

.btn-secondary:hover {
  background: #5a6268;
}

.btn-success {
  background: #28a745;
  color: white;
}

.btn-success:hover {
  background: #218838;
}

.btn-warning {
  background: #ffc107;
  color: #212529;
}

.btn-warning:hover {
  background: #e0a800;
}

/* Action Buttons */
.action-buttons {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

/* Import Result */
.import-result {
  margin: 1rem 0;
  animation: slideIn 0.3s ease-out;
}

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

.import-result h3 {
  margin-bottom: 0.5rem;
  font-size: 1.2rem;
}

.import-result .error-summary {
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.import-result .help-text {
  margin-top: 0.75rem;
  font-style: italic;
  opacity: 0.9;
}

.error-list {
  list-style-position: inside;
  padding-left: 1rem;
  margin-top: 0.5rem;
  max-height: 300px;
  overflow-y: auto;
}

.error-list li {
  margin: 0.5rem 0;
  font-size: 0.9rem;
  line-height: 1.5;
}

.error-list strong {
  color: #721c24;
  font-weight: 600;
}

/* Import Feedback Container */
#import-feedback {
  min-height: 40px;
  transition: all 0.3s ease;
}

#import-feedback:empty {
  min-height: 0;
}

/* Empty States */
.empty-state {
  text-align: center;
  padding: 2rem;
  color: #6c757d;
  font-style: italic;
  background: white;
  border-radius: 4px;
  border: 2px dashed #dee2e6;
}

/* Header Section (Detail Page) */
.header-section {
  margin-bottom: 2rem;
}

.header-section h1 {
  margin-bottom: 0.5rem;
}

.evento-info,
.created-info {
  color: #6c757d;
  font-size: 0.95rem;
  margin: 0.25rem 0;
}

/* Responsive Design */
@media (max-width: 768px) {
  .participantes-container,
  .participantes-detail-container {
    padding: 1rem;
  }

  .listas-table,
  .participantes-table {
    font-size: 0.85rem;
  }

  .listas-table th,
  .participantes-table th,
  .listas-table td,
  .participantes-table td {
    padding: 0.5rem;
  }

  .action-buttons {
    flex-direction: column;
  }

  .action-buttons .btn {
    width: 100%;
  }

  .listas-table td.actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .listas-table td.actions .btn {
    width: 100%;
  }
}

/* Enquete Overlay */
#enquete-overlay {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  width: 320px;
  max-width: calc(100vw - 2rem);
}

.enquete-card {
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  padding: 1.25rem;
  border-top: 4px solid #0b5cff;
}

.enquete-pergunta {
  font-size: 1rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 1rem;
  line-height: 1.4;
}

.opcao-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
  cursor: pointer;
  font-size: 0.95rem;
  color: #495057;
  border-bottom: 1px solid #f0f0f0;
}

.opcao-label:last-of-type {
  border-bottom: none;
}

.opcao-label input[type='radio'] {
  accent-color: #0b5cff;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.enquete-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.enquete-actions .btn {
  flex: 1;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  text-align: center;
}

/* Nova Enquete Form */
.enquetes-new-container {
  max-width: 800px;
  margin: 0 auto;
  background: white;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin-bottom: 2rem;
}

.enquetes-new-container .header-section {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.enquetes-new-container .header-section h1 {
  margin-bottom: 0;
}

.enquete-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.enquete-form textarea {
  padding: 0.75rem;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
  transition: border-color 0.2s;
}

.enquete-form textarea:focus {
  outline: none;
  border-color: #0b5cff;
  box-shadow: 0 0 0 3px rgba(11, 92, 255, 0.1);
}

.enquete-form input[type='text'] {
  padding: 0.75rem;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 1rem;
  transition: border-color 0.2s;
  flex: 1;
}

.enquete-form input[type='text']:focus {
  outline: none;
  border-color: #0b5cff;
  box-shadow: 0 0 0 3px rgba(11, 92, 255, 0.1);
}

#opcoes-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.opcao-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.opcao-row input[type='text'] {
  flex: 1;
}

/* Papéis checkboxes */
.papeis-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.papel-option {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  color: #495057;
  white-space: nowrap;
}

.papel-option input[type='checkbox'] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #0b5cff;
}

/* Form actions */
.form-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  padding-top: 0.5rem;
}

/* ===== Enquetes List Page ===== */
.enquetes-container {
  max-width: 800px;
  margin: 0 auto;
  background: white;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin-bottom: 2rem;
}

.enquetes-container .header-section {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.enquetes-container .header-section h1 {
  margin-bottom: 0;
}

.enquetes-container .actions-section {
  background: none;
  padding: 0;
  margin: 0 0 1.5rem 0;
}

.enquetes-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Card BEM — list page */
.enquete-card--criada,
.enquete-card--ativa,
.enquete-card--encerrada {
  background: white;
  border-radius: 8px;
  border: 1px solid #e9ecef;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.enquete-card--criada {
  border-left: 4px solid #6c757d;
}

.enquete-card--ativa {
  border-left: 4px solid #28a745;
}

.enquete-card--encerrada {
  border-left: 4px solid #adb5bd;
}

.enquete-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem 0.75rem;
}

.enquete-card__pergunta {
  font-size: 1.05rem;
  font-weight: 600;
  color: #212529;
  line-height: 1.4;
  margin: 0;
}

.enquete-card__body {
  padding: 0 1.25rem 0.75rem;
}

.enquete-card__meta {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.enquete-card__label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6c757d;
  display: block;
  margin-bottom: 0.35rem;
}

.enquete-card__opcoes {
  margin: 0;
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.enquete-card__opcoes li {
  font-size: 0.9rem;
  color: #495057;
}

.enquete-card__papeis {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.enquete-card__data {
  font-size: 0.8rem;
  color: #adb5bd;
  margin: 0.75rem 0 0;
}

.enquete-card__footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid #f0f0f0;
  background: #fafafa;
}

/* Badges de status */
.badge {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.badge-criada {
  background: #e9ecef;
  color: #495057;
}

.badge-ativa {
  background: #d4edda;
  color: #155724;
}

.badge-encerrada {
  background: #f0f0f0;
  color: #888;
}

/* Chips (papéis) */
.chip {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  background: #e8eeff;
  color: #1e40af;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
  white-space: nowrap;
}

/* ===== Resultado da Enquete ===== */
.resultado-container {
  max-width: 800px;
  margin: 0 auto;
  background: white;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin-bottom: 2rem;
}

.resultado-container .header-section {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.resultado-container .header-section h1 {
  margin-bottom: 0;
}

.enquete-info {
  padding: 1.25rem;
  background: #f8f9fa;
  border-radius: 8px;
  border-left: 4px solid #0b5cff;
  margin-bottom: 2rem;
}

.enquete-info h2 {
  font-size: 1.2rem;
  color: #212529;
  margin-bottom: 1rem;
}

.enquete-meta {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.enquete-meta > div {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Totais */
.resultado-totais {
  margin-bottom: 2rem;
}

.resultado-totais h2,
.resultado-votos h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #495057;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #e9ecef;
}

.totais-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.total-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: #f8f9fa;
  border-radius: 6px;
  border: 1px solid #e9ecef;
  gap: 1rem;
}

.total-card__opcao {
  font-weight: 500;
  color: #212529;
  flex: 1;
}

.total-card__votos {
  font-size: 0.9rem;
  font-weight: 700;
  color: #0b5cff;
  white-space: nowrap;
  background: #e8eeff;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
}

/* Tabela de votos */
.resultado-votos {
  margin-top: 0.5rem;
}

.votos-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.votos-table thead th {
  background: #0b5cff;
  color: white;
  padding: 0.6rem 0.75rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.votos-table tbody tr:nth-child(even) {
  background: #f8f9fa;
}

.votos-table tbody tr:hover {
  background: #e8eeff;
}

.votos-table tbody td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid #e9ecef;
  color: #333;
  white-space: nowrap;
}
