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

.alert__close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  opacity: 0.6;
  color: inherit;
  transition: opacity 0.15s;
}

.alert__close:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.08);
}

@keyframes alertFadeOut {
  from {
    opacity: 1;
    transform: translateY(0);
    max-height: 200px;
    margin: 1rem 0;
    padding-top: 1rem;
    padding-bottom: 1rem;
  }
  to {
    opacity: 0;
    transform: translateY(-6px);
    max-height: 0;
    margin: 0;
    padding-top: 0;
    padding-bottom: 0;
  }
}

.alert--dismissing {
  overflow: hidden;
  animation: alertFadeOut 0.35s ease-out forwards;
  pointer-events: none;
}

.alert-success {
  background: #d4edda;
  border-color: var(--mandua-green);
  color: var(--mandua-green-dark);
}

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

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

/* Zoom Button Loading State */
#zoom-schedule-dialog footer,
#email-disparo-dialog footer,
#email-participante-dialog footer {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  padding: 0;
  margin-top: 1rem;
}

#zoom-schedule-dialog footer button,
#email-disparo-dialog footer button,
#email-participante-dialog footer button {
  width: auto;
}

.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;
}

/* Tabela com scroll horizontal em telas pequenas */
.table-scroll {
  overflow-x: auto;
}

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

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

/* Import Result (HTMX feedback) */
.import-result {
  animation: slideIn 0.3s ease-out;
}

.import-result--error {
  border-left: 4px solid #dc3545;
}

.import-result--success {
  border-left: 4px solid var(--mandua-green);
}

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

.error-list {
  max-height: 300px;
  overflow-y: auto;
}

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

/* Loading state for submit buttons (htmx-disabled-elt + htmx-indicator) */
[aria-busy='true'],
.htmx-request[type='submit'],
button.htmx-request {
  opacity: 0.7;
  cursor: wait;
  pointer-events: none;
}

/* Participante Form */
.participante-form-card {
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

.participante-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1rem;
}

.participante-form-grid label {
  margin-bottom: 0;
}

.participante-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  align-items: center;
  margin-top: 1.5rem;
}

.participante-form-actions button,
.participante-form-actions a[role='button'] {
  width: auto;
  margin-bottom: 0;
}

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

/* Login Page */
.login-page {
  display: flex;
  justify-content: center;
  padding-top: 3rem;
}

.login-container {
  width: 100%;
  max-width: 420px;
}

/* Login Button Loading State */
#btn-entrar .btn-label {
  display: inline;
}

#btn-entrar .btn-loading {
  display: none;
}

#btn-entrar.htmx-request .btn-label {
  display: none;
}

#btn-entrar.htmx-request .btn-loading {
  display: inline;
  animation: pulse 1.5s ease-in-out infinite;
}

#btn-entrar.htmx-request::after {
  content: none;
}

/* Enquete Overlay */
#enquete-overlay {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9999;
  width: 320px;
  max-width: calc(100vw - 2rem);
  cursor: default;
  transition: none;
}

#enquete-overlay.htmx-added,
#enquete-overlay.htmx-swapping,
#enquete-overlay.htmx-settling {
  opacity: 1;
  transition: none;
}

.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 var(--pico-primary);
  transition: none;
}

.enquete-pergunta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 1rem;
  line-height: 1.4;
  cursor: grab;
}

.enquete-pergunta::before {
  content: '⠿';
  font-size: 1.1rem;
  color: #adb5bd;
  flex-shrink: 0;
  line-height: 1;
  user-select: none;
}

.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: var(--pico-primary);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

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

.enquete-actions button {
  flex: 1;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  text-align: center;
  margin-bottom: 0;
}

/* Overlay roda também na tela da sala (sem Pico); define contraste explícito */
#enquete-overlay .enquete-actions button {
  background: var(--pico-primary);
  border: 1px solid var(--pico-primary);
  color: #ffffff;
  border-radius: 6px;
}

#enquete-overlay .enquete-actions button:hover {
  background: var(--pico-primary-hover);
  border-color: var(--pico-primary-hover);
}

#enquete-overlay .enquete-actions button:disabled {
  background: #9fb7b2;
  border-color: #9fb7b2;
  color: rgba(255, 255, 255, 0.88);
  cursor: not-allowed;
  opacity: 0.7;
}

#enquete-overlay .enquete-actions button:disabled:hover {
  background: #9fb7b2;
  border-color: #9fb7b2;
}

#enquete-overlay .enquete-actions button.secondary {
  background: transparent;
  border: 1px solid var(--pico-primary);
  color: var(--pico-primary);
}

#enquete-overlay .enquete-actions button.secondary:hover {
  background: rgba(0, 84, 72, 0.08);
}

.voto-opcao-destaque {
  color: var(--mandua-green);
  font-weight: 700;
}

.resultado-opcao {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.75rem 0.85rem;
  margin-bottom: 0.75rem;
  border: 1px solid #dbe4e8;
  border-radius: 8px;
  background: #f8fbfb;
}

.resultado-opcao--destaque {
  border-color: var(--mandua-green);
  border-width: 2px;
  background: #eef8f6;
}

.resultado-opcao__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.resultado-opcao__label {
  font-size: 0.95rem;
  font-weight: 600;
  color: #21313c;
}

.resultado-opcao__meta {
  font-size: 0.82rem;
  color: #52606d;
  white-space: nowrap;
}

.resultado-barra {
  width: 100%;
  height: 0.55rem;
  overflow: hidden;
  border-radius: 999px;
  background: #d9e7e4;
}

.resultado-barra__fill {
  display: block;
  height: 100%;
  min-width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--mandua-green), #63b7a5);
}

.resultado-total {
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: #21313c;
}

.resultado-encerradaEm {
  margin: 0.25rem 0 0;
  font-size: 0.82rem;
  color: #52606d;
}

#enquetes-historico {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9998;
  max-height: calc(100vh - 3rem);
  overflow-y: auto;
}

#enquetes-historico:empty {
  display: none;
}

/* Quando o histórico está colapsado (barra visível mas fechada), empurra o #zmmtg-root para cima
   para que a barra não sobreponha a área da reunião. !important é necessário para sobrescrever
   os estilos (inline ou de folha externa) que o Zoom SDK aplica em #zmmtg-root.
   height é necessário porque o CSS prioriza top+height sobre bottom ao posicionar o elemento;
   sem sobrescrever height, o bottom: 2rem é ignorado pelo modelo de caixa. */
body.historico-colapsado #zmmtg-root {
  bottom: 2rem !important;
  height: calc(100vh - 2rem) !important;
}

.historico-section {
  background: rgba(240, 243, 245, 0.96);
  backdrop-filter: blur(6px);
  border: none;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 0;
}

.historico-item {
  background: #ffffff;
  border: 1px solid #dbe4e8;
  border-radius: 6px;
}

.historico-section summary,
.historico-item summary {
  cursor: pointer;
  list-style: none;
}

.historico-section summary::-webkit-details-marker,
.historico-item summary::-webkit-details-marker {
  display: none;
}

.historico-section > summary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.4rem 1rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: #6b7a8d;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.historico-section > summary::before {
  content: '▲';
  font-size: 0.55rem;
  transition: transform 0.2s;
}

.historico-section[open] > summary::before {
  transform: rotate(180deg);
}

.historico-section__body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.25s ease;
  overflow: hidden;
}

.historico-section[open] > .historico-section__body {
  grid-template-rows: 1fr;
}

.historico-section.closing > .historico-section__body {
  grid-template-rows: 0fr;
}

.historico-section__body > * {
  overflow: hidden;
  min-height: 0;
}

.historico-section__body-inner {
  display: grid;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
}

.historico-item > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border-radius: 5px;
  transition: background 0.15s;
}

.historico-item > summary:hover {
  background: rgba(0, 0, 0, 0.04);
}

.historico-item[open] > summary {
  border-radius: 5px 5px 0 0;
}

.historico-item > summary::after {
  content: '▶';
  font-size: 0.5rem;
  color: #8a9aaa;
  transition: transform 0.15s;
  flex-shrink: 0;
}

.historico-item[open] > summary::after {
  transform: rotate(90deg);
}

.historico-item__pergunta {
  font-size: 0.8rem;
  font-weight: 600;
  color: #21313c;
  flex: 1;
}

.historico-item__data {
  font-size: 0.72rem;
  color: #52606d;
  white-space: nowrap;
}

/* Especificidade alta para sobrescrever o UA stylesheet (details > *:not(summary) { display:none }) */
details.historico-item > .historico-item__body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.2s ease;
  overflow: hidden;
}

details.historico-item[open] > .historico-item__body {
  grid-template-rows: 1fr;
}

details.historico-item.closing > .historico-item__body {
  grid-template-rows: 0fr;
}

.historico-item__body-inner {
  min-height: 0;
  overflow: hidden;
  padding: 0 0.75rem 0.75rem;
}

/* Opções de enquete — lista de campos inline */
#opcoes-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.opcao-row {
  margin-bottom: 0;
}

/* Card BEM — enquetes da lista (article do Pico fornece bg/borda/sombra) */
.enquete-card--criada,
.enquete-card--ativa,
.enquete-card--encerrada {
  padding: 0;
  overflow: hidden;
}

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

.enquete-card--ativa {
  border-left: 4px solid var(--mandua-green);
}

.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 {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  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: var(--mandua-green-dark);
}

.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;
}

/* .enquete-meta: exibido dentro de article (Pico fornece bg/padding) */
.enquete-meta {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 0;
}

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

/* Indicador WebSocket (sala) */
.ws-indicator {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  pointer-events: none;
  transition: all 0.3s ease;
}

.ws-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.ws-connected .ws-dot {
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.65);
}

.ws-disconnected .ws-dot {
  background: #9ca3af;
  box-shadow: none;
}

.ws-label {
  color: #374151;
  transition: all 0.3s ease;
}

/* Botão compacto para uso em tabelas */
button.btn-sm,
a[role='button'].btn-sm {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  margin: 0;
}

/* ===== Config forms — hint e labels compactos ===== */
.config-hint {
  font-size: 0.8rem;
  color: var(--pico-muted-color);
  margin: -0.15rem 0 0.75rem;
}

.config-hint--notice {
  color: #6b5200;
  background: #fff9e6;
  border-left: 3px solid #e8b400;
  padding: 0.35rem 0.65rem;
  border-radius: 4px;
  margin: 0 0 0.5rem;
}

.config-group-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--pico-muted-color);
  margin: 0.5rem 0 0.2rem;
}

.config-zoom-only {
  opacity: 0.35;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

/* ===== Votação por Link — form compacto ===== */

.vpl-dates-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1rem;
  max-width: 560px;
}

.vpl-comprovante {
  max-width: 270px;
}

.vpl-dates-grid input[type='datetime-local'],
.vpl-comprovante input[type='datetime-local'] {
  padding-block: 0.45rem;
  font-size: 0.875rem;
}

.vpl-form-actions {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.vpl-form-actions button {
  margin-bottom: 0;
  width: auto;
}

@media (max-width: 600px) {
  .vpl-dates-grid {
    grid-template-columns: 1fr;
  }

  .vpl-comprovante {
    max-width: 100%;
  }
}

/* ===== Toolbar de ações da lista (detalhe) ===== */

.detail-toolbar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  padding: 0.6rem 0;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--pico-muted-border-color);
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

/* Botões primários da toolbar: compactos */
.toolbar-group--primary button,
.toolbar-group--primary a[role='button'] {
  font-size: 0.82rem;
  padding: 0.3rem 0.7rem;
  margin-bottom: 0;
  white-space: nowrap;
}

/* Empurra o dropdown para a extremidade direita */
.toolbar-spacer {
  flex-grow: 1;
}

/* ── Dropdown "⚙ Configurações" ── */

.toolbar-dropdown {
  position: relative;
}

.toolbar-dropdown > summary {
  list-style: none;
  cursor: pointer;
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--pico-border-radius);
  padding: 0.3rem 0.65rem;
  font-size: 0.82rem;
  line-height: 1.5;
  background: transparent;
  color: var(--pico-color);
  transition:
    background 0.15s,
    border-color 0.15s;
  user-select: none;
  white-space: nowrap;
}

.toolbar-dropdown > summary::-webkit-details-marker {
  display: none;
}

.toolbar-dropdown > summary:hover {
  background: var(--pico-secondary-background);
  border-color: var(--pico-muted-color);
}

.toolbar-dropdown > ul {
  display: block;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 100;
  min-width: 220px;
  background: var(--pico-background-color);
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--pico-border-radius);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  padding: 0.4rem 0;
  margin: 0;
  list-style: none;
}

.toolbar-dropdown > ul li {
  padding: 0;
}

/* Itens regulares do dropdown (botões e links não-destrutivos) */
/* Reset --pico-color e --pico-background-color que o Pico define no próprio button */
.toolbar-dropdown__btn,
.toolbar-dropdown > ul li a.toolbar-dropdown__btn,
#zoom-button-container button {
  --pico-color: inherit;
  --pico-background-color: transparent;
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  margin: 0;
  color: var(--pico-color);
  cursor: pointer;
  transition: background 0.12s;
  white-space: nowrap;
  text-decoration: none;
}

.toolbar-dropdown__btn:hover,
.toolbar-dropdown > ul li a.toolbar-dropdown__btn:hover,
#zoom-button-container button:hover {
  --pico-color: inherit;
  --pico-background-color: transparent;
  background: rgba(0, 0, 0, 0.06) !important;
  color: inherit;
}

/* Zoom button dentro do dropdown: sem outline, sem padding extra */
#zoom-button-container {
  display: block;
}

/* Separador visual entre itens regulares e destrutivos */
.toolbar-dropdown__divider {
  display: block;
  height: 1px;
  background: var(--pico-muted-border-color);
  margin: 0.4rem 0.9rem;
}

/* Itens destrutivos */
.toolbar-dropdown > ul li button.btn-delete {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  margin: 0;
  color: #dc3545;
  cursor: pointer;
  transition: background 0.12s;
}

.toolbar-dropdown > ul li button.btn-delete:hover {
  background: #fff0f0;
}

@media (max-width: 640px) {
  .detail-toolbar {
    gap: 0.3rem;
  }

  .toolbar-spacer {
    display: none;
  }
}
