/* ============================================
   estilos.css - Campo Democrático
   Versão 1.3
   ============================================ */

/* ===== RESET E VARIÁVEIS ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --green: #34a853;
  --green-dark: #2d9248;
  --danger: #dc3545;
  --danger-hover: #c82333;
  --bg: #f0f2f5;
  --card-bg: #ffffff;
  --border: #dadce0;
  --text: #1f1f1f;
  --text-secondary: #5f6368;
  --shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  --radius: 8px;
  --transition: 0.2s ease;
  --font-size-base: 16px;
}

html,
body {
  height: 100%;
  overflow: auto;
  overscroll-behavior-y: none;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: var(--font-size-base);
}

#app {
  max-width: 1600px;
  margin: 0 auto;
  padding: 6px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== HEADER ===== */
.header {
  background: var(--card-bg);
  padding: 6px 14px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
  flex-shrink: 0;
}

.header-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0px;
}

.header-left .logo {
  height: 36px;
  width: auto;
}

.header-left .subtitle {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 1.2;
}

.header-right {
  display: flex;
  gap: 6px;
}

/* ===== BOTÕES ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: none;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 2px 8px rgba(26, 115, 232, 0.3);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.btn-outline:hover {
  background: var(--bg);
}

.btn-sm {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: var(--transition);
  background: transparent;
  text-decoration: none;
  font-weight: 500;
}

.btn-sm:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.btn-sm .material-icons {
  font-size: 16px;
}

.btn-export {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  white-space: nowrap;
}

.btn-export:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(26, 115, 232, 0.3);
}

.btn-export img {
  width: 18px;
  height: 18px;
  filter: brightness(0) invert(1);
}

.btn-filtros {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: none;
  border-radius: 20px;
  background: var(--green);
  color: white;
  cursor: pointer;
  transition: var(--transition);
  font-size: 16px;
  font-weight: 500;
  white-space: nowrap;
}

.btn-filtros:hover {
  background: var(--green-dark);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(52, 168, 83, 0.3);
}

.btn-filtros .material-icons {
  font-size: 20px;
  color: white;
}

/* ===== SELECTS ===== */
.select-simple {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
  background: white;
  width: 100%;
  min-height: 36px;
  cursor: pointer;
  transition: var(--transition);
  appearance: auto;
}

.select-simple:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 1px rgba(115, 115, 115, 0.12);
}

.filter-item-small {
  flex: 0 0 auto;
  min-width: 80px;
}

.filter-item-medium {
  flex: 0 0 auto;
  min-width: 120px;
}

/* ===== DROPDOWN CHECKLIST ===== */
.dropdown-check-list {
  display: inline-block;
  width: 100%;
  min-width: 140px;
  position: relative;
}

.dropdown-check-list .anchor {
  position: relative;
  cursor: pointer;
  display: inline-block;
  padding: 6px 36px 6px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  width: 100%;
  font-size: 0.85rem;
  min-height: 36px;
  display: flex;
  align-items: center;
  transition: var(--transition);
  user-select: none;
}

.dropdown-check-list .anchor:after {
  position: absolute;
  content: "";
  border-left: 2px solid var(--text);
  border-top: 2px solid var(--text);
  padding: 4px;
  right: 12px;
  top: 38%;
  transform: rotate(-135deg);
  transition: transform 0.3s ease;
}

.dropdown-check-list.visible .anchor:after {
  transform: rotate(45deg);
  top: 45%;
}

.dropdown-check-list .anchor .selected-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.dropdown-check-list ul.items {
  padding: 4px;
  display: none;
  margin: 4px 0 0 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  max-height: 180px;
  overflow-y: auto;
  position: absolute;
  z-index: 100;
  width: 100%;
  min-width: 200px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.dropdown-check-list ul.items li {
  list-style: none;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.dropdown-check-list ul.items li:hover {
  background: #f0f2f5;
}

.dropdown-check-list ul.items li input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  flex-shrink: 0;
  pointer-events: none;
}

.dropdown-check-list ul.items li label {
  cursor: pointer;
  flex: 1;
  font-size: 0.85rem;
  pointer-events: none;
}

.dropdown-check-list .items-header {
  display: flex;
  gap: 4px;
  padding: 4px 8px 6px 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.dropdown-check-list .items-header .btn-sm {
  font-size: 0.75rem;
  padding: 2px 10px;
  border-radius: 10px;
}

.dropdown-check-list.visible .anchor {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.12);
}

.dropdown-check-list.visible .items {
  display: block;
}

.inline-checkboxes {
  display: flex;
  gap: 10px;
  padding: 2px 0;
  flex-wrap: wrap;
}

.inline-checkboxes label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: var(--transition);
}

.inline-checkboxes label:hover {
  background: var(--bg);
}

.inline-checkboxes input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* ===== FILTERS BAR ===== */
.filters-bar {
  background: var(--card-bg);
  padding: 8px 14px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.filter-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 80px;
}

.filter-item label {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* ===== SIDEBAR ===== */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 99;
}

.sidebar-overlay.open {
  display: block;
}

.sidebar-left {
  position: fixed;
  top: 0;
  left: -380px;
  width: 360px;
  height: 100vh;
  background: var(--card-bg);
  border-radius: 0;
  box-shadow: var(--shadow);
  padding: 12px 16px;
  overflow-y: auto;
  z-index: 100;
  transition: left 0.3s ease;
  flex-shrink: 0;
}

.sidebar-left.open {
  left: 0;
}

.sidebar-left::-webkit-scrollbar {
  width: 4px;
}

.sidebar-left::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.sidebar-sticky-header {
  position: sticky;
  top: 0;
  background: var(--card-bg);
  z-index: 10;
  padding-bottom: 6px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
}

.sidebar-header .sidebar-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.sidebar-header .sidebar-actions {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
}

.sidebar-header .btn-sm {
  font-size: 0.8rem;
  padding: 4px 12px;
}

.btn-primary-sm {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.btn-primary-sm:hover {
  background: var(--primary-dark);
}

.btn-danger-sm {
  color: var(--danger);
  border-color: var(--danger);
}

.btn-danger-sm:hover {
  background: #fee;
}

.sidebar-search {
  margin-bottom: 10px;
}

.sidebar-search label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  display: block;
  margin-bottom: 2px;
}

.sidebar-search .search-field {
  display: flex;
  align-items: center;
  background: #f8f9fa;
  border-radius: 20px;
  padding: 0 12px;
  border: 1px solid var(--border);
  width: 100%;
  min-height: 36px;
}

.sidebar-search .search-field .search-icon {
  width: 18px;
  height: 18px;
  opacity: 0.5;
  cursor: pointer;
  flex-shrink: 0;
}

.sidebar-search .search-field input {
  border: none;
  background: transparent;
  padding: 6px 10px;
  font-size: 0.85rem;
  outline: none;
  width: 100%;
}

.filter-section h4 {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 2px;
}

.filter-section {
  margin-bottom: 10px;
}

/* ===== MAIN LIST ===== */
.main-list {
  flex: 1;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: visible;
  position: relative;
}

/* ===== LIST HEADER (STICKY - SEMPRE VISÍVEL) ===== */
.list-header-wrapper {
  background: var(--card-bg);
  z-index: 20;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
}

.list-header-row1 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 4px;
}

.list-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.list-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-all {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 16px;
  cursor: pointer;
}

.checkbox-all input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.checkbox-all .checkbox-label {
  font-size: 16px;
}

.results-count {
  font-size: 16px;
  color: var(--text-secondary);
}

.list-header-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.list-header-row2 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.list-actions-left {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.list-actions-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.list-actions .btn-sm {
  border-radius: 14px;
  padding: 4px 12px;
  font-size: 16px;
  font-weight: 500;
}

.list-actions-right .sort-wrapper {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 200px;
  max-width: 250px;
}

.list-actions-right .select-simple {
  min-height: 32px;
  padding: 4px 10px;
  font-size: 0.85rem;
  width: 100%;
}

.candidates-list {
  flex: 1;
  overflow: visible;
  max-height: none;
  padding-right: 2px;
  min-height: 150px;
  display: flex;
  flex-direction: column;
}

.candidates-list::-webkit-scrollbar {
  width: 4px;
}

.candidates-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

/* ===== LOAD MORE ===== */
.load-more-container {
  text-align: center;
  padding: 10px 0;
  display: none;
}

.load-more-container .btn-load-more {
  padding: 8px 24px;
  font-size: 0.95rem;
}

.load-more-container .load-more-status {
  margin-top: 4px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.load-more-container .load-more-status .completed {
  color: var(--green);
  font-weight: 600;
}

/* ===== CANDIDATE ROW ===== */
.candidate-row {
  background: white;
  border-radius: 6px;
  padding: 6px 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  border: 1px solid #e9edf3;
  width: 100%;
  transition: all 0.2s ease;
  cursor: default;
  margin-bottom: 4px;
}

.candidate-row:hover {
  border-color: #dadce0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.candidate-row.excluido {
  opacity: 0.5;
  background: #fafafa;
  text-decoration: line-through;
}

.candidate-row.excluido .candidate-name {
  text-decoration: line-through;
}

.candidate-row.excluido .social-link,
.candidate-row.excluido .btn-tse {
  pointer-events: none;
  opacity: 0.5;
}

.candidate-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: 1fr;
  gap: 4px 10px;
  align-items: center;
}

.candidate-left {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 60px;
}

.candidate-left .candidate-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #1a73e8;
  flex-shrink: 0;
}

.candidate-left .candidate-checkbox:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.candidate-avatar {
  width: 60px;
  height: 80px;
  border-radius: 4px;
  background: #e8eaed;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1.4rem;
  color: #5f6368;
  flex-shrink: 0;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.candidate-avatar:hover {
  transform: scale(1.03);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.candidate-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.candidate-right {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.candidate-row1 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 6px;
}

.candidate-number {
  font-size: 16px;
  font-weight: 600;
  color: #1f1f1f;
  white-space: nowrap;
}

.candidate-name {
  font-size: 16px;
  font-weight: 600;
  color: #1f1f1f;
  word-break: break-word;
}

.candidate-partido {
  font-size: 16px;
  font-weight: 600;
  color: #5f6368;
  background: #e8eaed;
  padding: 1px 10px;
  border-radius: 10px;
  white-space: nowrap;
}

.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  border-radius: 4px;
  text-decoration: none;
  transition: all 0.2s ease;
  overflow: hidden;
  flex-shrink: 0;
  background: transparent;
  border: none;
  padding: 0;
}

.social-link:hover {
  transform: scale(1.08);
}

.social-link img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  display: block;
}

.no-redes {
  font-size: 0.75rem;
  color: #999;
  font-style: italic;
}

.btn-tse {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  text-decoration: none;
  color: #1a73e8;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 12px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-tse:hover {
  background: #e3f2fd;
  transform: scale(1.02);
}

.btn-tse img {
  width: 24px;
  height: 24px;
  min-width: 24px;
  min-height: 24px;
  border-radius: 3px;
  object-fit: contain;
}

.candidate-row2 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px;
}

.candidate-actions-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.candidate-actions-right {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.btn-action {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 10px;
  border: none;
  border-radius: 14px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  background: transparent;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.2px;
}

.btn-action:hover {
  transform: scale(1.04);
}

.btn-resumo {
  color: #1a73e8;
}

.btn-resumo:hover {
  background: #e3f2fd;
}

.btn-delete {
  color: #dc3545;
}

.btn-delete:hover {
  background: #fee;
}

.btn-restore {
  color: #1a73e8;
}

.btn-restore:hover {
  background: #e3f2fd;
}

.btn-action .btn-text {
  display: inline;
}

/* ===== FOOTER ===== */
.footer {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 8px 16px;
  margin-top: 6px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.footer a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.75rem;
  font-weight: 500;
  transition: var(--transition);
}

.footer a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.footer .separator {
  color: var(--border);
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #1f1f1f;
  color: white;
  padding: 10px 24px;
  border-radius: 32px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transition: all 0.4s ease;
  z-index: 1000;
  pointer-events: none;
  font-size: 0.85rem;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== MODAL ===== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: var(--radius);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.4rem;
  color: var(--text-secondary);
}

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

.modal iframe {
  width: 100%;
  height: 400px;
  border: none;
  border-radius: 6px;
  margin-top: 10px;
}

/* ===== EMPTY STATE ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}

.empty-state .material-icons {
  font-size: 3rem;
  color: #dadce0;
}

.empty-state p {
  margin-top: 8px;
  font-size: 0.95rem;
}

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

/* ===== RESTAURAR/DESATIVAR ===== */
.candidate-row.excluido .btn-restore {
  display: inline-flex !important;
}
.candidate-row.excluido .btn-delete {
  display: none !important;
}
.candidate-row:not(.excluido) .btn-restore {
  display: none !important;
}
.candidate-row:not(.excluido) .btn-delete {
  display: inline-flex !important;
}

/* ===== BUSCA NO CABEÇALHO ===== */
.search-field-header {
  display: flex;
  align-items: center;
  background: #f8f9fa;
  border-radius: 20px;
  padding: 0 12px;
  border: 1px solid var(--border);
  min-height: 36px;
  transition: border-color 0.2s ease;
}

.search-field-header:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.12);
}

.search-field-header input {
  border: none;
  background: transparent;
  padding: 4px 10px;
  font-size: 0.85rem;
  outline: none;
  width: 180px;
}

.search-field-header img {
  width: 18px;
  height: 18px;
  opacity: 0.5;
  cursor: pointer;
  flex-shrink: 0;
}

/* ===== BOTÃO VOLTAR AO TOPO (mobile) ===== */
.btn-topo {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(26, 115, 232, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 50;
  opacity: 0;
  transform: scale(0.8);
  pointer-events: none;
}

.btn-topo.show {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.btn-topo:hover {
  background: var(--primary-dark);
  transform: scale(1.05);
}

.btn-topo .material-icons {
  font-size: 28px;
  color: white;
}



/* ============================================
   RESPONSIVIDADE
   ============================================ */

/* DESKTOP ONLY - CORREÇÃO DO STICKY */
@media (min-width: 769px) {
  .main-content {
    flex: 1;
    min-height: 0;
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .main-list {
    height: auto;
    max-height: none;
    overflow: visible;
    display: flex;
    flex-direction: column;
  }

  .candidates-list {
    flex: 1;
    overflow: visible;
    max-height: none;
    display: flex;
    flex-direction: column;
    padding-right: 4px;
  }

  .list-header-wrapper {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--card-bg);
    flex-shrink: 0;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 10px;
  }

  .candidates-content {
    flex: 1;
  }
}

/* RESPONSIVIDADE MOBILE */
@media (max-width: 768px) {
  #app {
    padding: 4px;
  }
  .header {
    padding: 4px 10px;
  }
  .header-left .logo {
    height: 30px;
  }
  .header-left .subtitle {
    font-size: 16px;
  }
  .btn-export {
    display: none !important;
  }

  .filters-bar {
    padding: 6px 10px;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }
  .filter-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
  }
  .filter-item-small,
  .filter-item-medium {
    max-width: none;
    min-width: 0;
  }
  .filter-item select {
    font-size: 0.85rem;
    padding: 6px 8px;
    min-height: 34px;
  }
  .filter-item label {
    font-size: 0.6rem;
  }

  .candidate-left .candidate-checkbox {
    display: none !important;
  }

  .sidebar-left {
    width: 100%;
    left: -100%;
    padding: 12px;
  }
  .sidebar-left.open {
    left: 0;
  }
  .sidebar-overlay.open {
    display: block;
  }

  .main-list {
    padding: 6px 8px;
  }

  .list-header-wrapper {
    padding-bottom: 8px;
    margin-bottom: 8px;
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--card-bg);
  }

  .checkbox-all {
    display: none !important;
  }
  .list-header-row1 {
    justify-content: space-between;
  }
  .list-header-row2 {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }
  .list-actions-left {
    justify-content: center;
    flex-wrap: wrap;
  }
  .list-actions-right {
    justify-content: center;
  }
  .list-actions .btn-sm {
    font-size: 16px;
    padding: 4px 10px;
  }
  .list-actions-right .sort-wrapper {
    min-width: 100%;
    max-width: 100%;
    justify-content: center;
  }
  .list-actions-right .select-simple {
    min-width: 100%;
    max-width: 100%;
    font-size: 0.85rem;
    min-height: 34px;
  }
  .btn-filtros {
    font-size: 16px;
    padding: 4px 12px;
  }

  .candidate-left {
    flex-direction: row;
    align-items: center;
    gap: 4px;
    min-height: 50px;
  }
  .candidate-avatar {
    width: 50px;
    height: 66px;
    font-size: 1.2rem;
  }
  .candidate-row {
    padding: 4px 8px;
    border-radius: 6px;
    margin-bottom: 3px;
  }
  .candidate-grid {
    gap: 4px 8px;
  }
  .candidate-number,
  .candidate-name,
  .candidate-partido {
    font-size: 15px;
  }
  .candidate-partido {
    padding: 1px 8px;
  }

  .social-link {
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
  }
  .social-link img {
    width: 24px;
    height: 24px;
  }
  .btn-tse {
    font-size: 0.7rem;
  }
  .btn-tse img {
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
  }
  .btn-action {
    font-size: 0.7rem;
    padding: 2px 8px;
  }
  .no-redes {
    font-size: 0.65rem;
  }

  .modal-content {
    max-width: 95%;
    padding: 14px;
    margin: 8px;
  }
  .footer {
    padding: 6px 12px;
    gap: 8px;
  }
  .footer a {
    font-size: 0.7rem;
  }

  .search-field-header input {
    width: 120px;
    font-size: 0.8rem;
  }
  .search-field-header {
    min-height: 32px;
    padding: 0 8px;
  }

  .btn-topo {
    bottom: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
  }
  .btn-topo .material-icons {
    font-size: 24px;
  }
}

@media (max-width: 480px) {
  .filter-group {
    grid-template-columns: 1fr 1fr;
  }
  .candidate-avatar {
    width: 42px;
    height: 56px;
    font-size: 1rem;
  }
  .candidate-number,
  .candidate-name,
  .candidate-partido {
    font-size: 14px;
  }
  .candidate-partido {
    padding: 0px 6px;
  }
  .social-link {
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
  }
  .social-link img {
    width: 20px;
    height: 20px;
  }
  .btn-tse {
    font-size: 0.65rem;
  }
  .btn-tse img {
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
  }
  .btn-action {
    font-size: 0.65rem;
    padding: 1px 6px;
  }
  .results-count {
    font-size: 14px;
  }
  .header-left .subtitle {
    font-size: 14px;
  }
  .header-left .logo {
    height: 24px;
  }

  .search-field-header input {
    width: 80px;
    font-size: 0.75rem;
  }

  .btn-topo {
    bottom: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
  }
  .btn-topo .material-icons {
    font-size: 20px;
  }

  /* ===== ALTURA DO DROPDOWN DE PARTIDOS ===== */
  #partidosDropdown ul.items {
    max-height: 450px !important;
    overflow-y: auto !important;
    padding: 6px 4px !important;
  }

  /* Reduzir padding dos itens para caber mais */
  #partidosDropdown ul.items li {
    padding: 3px 8px !important;
    margin: 1px 0 !important;
  }

  #partidosDropdown ul.items li label {
    font-size: 0.8rem !important;
  }

  /* Reduzir padding do cabeçalho da federação */
  #partidosDropdown ul.items li[style*="background:#f8f9fa"] {
    padding: 3px 10px !important;
    margin: 3px 0 !important;
  }
}

/* ============================================
   FIX: DROPDOWN DE PARTIDOS - CLICK CORRETO
   ============================================ */

/* Garantir que o dropdown e seus elementos sejam clicáveis */
#partidosDropdown .items {
    pointer-events: auto !important;
    z-index: 9999 !important;
}

#partidosDropdown .items li {
    pointer-events: auto !important;
}

#partidosDropdown .items label {
    pointer-events: auto !important;
    cursor: pointer !important;
}

#partidosDropdown .items input[type="checkbox"] {
    pointer-events: auto !important;
    cursor: pointer !important;
}

#partidosDropdown .items button {
    pointer-events: auto !important;
    cursor: pointer !important;
}

/* Garantir que o dropdown-toggle seja clicável */
#partidosDropdown .dropdown-toggle {
    cursor: pointer !important;
    pointer-events: auto !important;
}

/* Evitar que overlays bloqueiem o clique */
.sidebar-left .filter-section {
    position: relative;
    z-index: 1;
}

#partidosDropdown {
    position: relative;
    z-index: 10;
}

/* Quando o dropdown estiver aberto, garantir que fique acima de tudo */
#partidosDropdown .items[style*="display: block"] {
    z-index: 99999 !important;
    position: absolute !important;
}

/* Corrigir possível conflito com o sidebar */
.sidebar-left {
    overflow: visible !important;
}

.sidebar-left .filter-section:last-child {
    margin-bottom: 20px;
}

/* ============================================
   FIX: DROPDOWN DE PARTIDOS - SOBRESCREVER TUDO
   ============================================ */

/* Garantir que o dropdown fique ACIMA de tudo */
#partidosDropdown {
    position: relative;
    z-index: 99999 !important;
}

#partidosDropdown .items {
    position: absolute !important;
    z-index: 999999 !important;
    background: white !important;
    pointer-events: auto !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25) !important;
    max-height: 450px !important;
    overflow-y: auto !important;
    border-radius: 8px !important;
    border: 1px solid #e0e0e0 !important;
}

/* Todos os elementos dentro do dropdown devem ser clicáveis */
#partidosDropdown .items * {
    pointer-events: auto !important;
}

#partidosDropdown .items li {
    pointer-events: auto !important;
    list-style: none !important;
}

#partidosDropdown .items label {
    pointer-events: auto !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 2px 0 !important;
}

#partidosDropdown .items input[type="checkbox"] {
    pointer-events: auto !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
    width: 15px !important;
    height: 15px !important;
}

#partidosDropdown .items button {
    pointer-events: auto !important;
    cursor: pointer !important;
}

/* Impedir que o container do sidebar corte o dropdown */
.sidebar-left {
    overflow: visible !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
}

.sidebar-left .filter-section {
    position: relative !important;
    z-index: 1 !important;
}

.sidebar-left .filter-section:has(#partidosDropdown) {
    z-index: 99999 !important;
}

/* Garantir que o dropdown aberto fique sobre tudo */
#partidosDropdown .items[style*="display: block"],
#partidosDropdown .items[style*="display:block"] {
    display: block !important;
    z-index: 999999 !important;
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    right: 0 !important;
    margin-top: 4px !important;
    background: white !important;
    pointer-events: auto !important;
}

/* Corrigir o overlay do sidebar */
.sidebar-overlay {
    z-index: 9998 !important;
}

.sidebar-left.open {
    z-index: 99999 !important;
}

/* Para mobile - garantir que o dropdown não seja cortado */
@media (max-width: 768px) {
    #partidosDropdown .items {
        max-height: 300px !important;
        position: fixed !important;
        top: auto !important;
        left: 10px !important;
        right: 10px !important;
        width: auto !important;
        z-index: 999999 !important;
    }
}


/* ============================================
   FIX: DROPDOWNS OCUPAÇÃO / INSTRUÇÃO
   Sobe o .filter-section inteiro quando um dropdown está aberto.
   Espelha o que já existe para #partidosDropdown.
   ============================================ */
.sidebar-left .filter-section:has(.dropdown-check-list.visible) {
    z-index: 99999 !important;
}

/* Reforço de opacidade (caso o navegador ignore o !important anterior) */
.dropdown-check-list.visible ul.items {
    background: #ffffff !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25) !important;
}

/* ============================================
   FIX: BOTÕES DESABILITADOS
   ============================================ */
.btn-filtros:disabled,
.btn-sm:disabled,
.btn-primary:disabled,
.btn-export:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
    box-shadow: none;
    transform: none;
}

/* ============================================
   EMPTY STATE — Banner do agregador (partido único)
   ============================================ */
.empty-state .empty-banner {
    display: block;
    margin-bottom: 16px;
    text-decoration: none;
    transition: transform 0.2s ease;
}

.empty-state .empty-banner:hover {
    transform: scale(1.03);
}

.empty-state .empty-banner img {
    max-width: 400px;
    width: 100%;
    height: auto;
    border-radius: 6px;
    display: block;
}

/* ============================================
   LISTA — Ícones + URLs das redes
   ============================================ */
.candidate-icons {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    flex-wrap: wrap;
}

.candidate-urls {
    flex-basis: 100%;
    list-style: none;
    padding: 2px 0 0 0;
    margin: 0;
    line-height: 1.35;
}

.candidate-urls li {
    font-size: 0.85rem;
    margin: 0;
}

.candidate-urls li a {
    color: #5f6368;
    text-decoration: none;
    word-break: break-all;
}

.candidate-urls {
    flex-basis: 100%;
    list-style: none;
    padding: 3px 0 0 0;   /* era 2px 0 0 0 */
    margin: 0;
    line-height: 1.45;    /* era 1.35 */
}

.candidate-urls li a:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* ============================================
   FOTO — proporção 80×112 com 1 dimensão fixa
   ============================================ */
.candidate-avatar {
    width: auto;
    height: 100px;
    aspect-ratio: 80 / 112;
}

@media (max-width: 768px) {
    .candidate-avatar {
        width: 80px;
        height: auto;
        aspect-ratio: 80 / 112;
    }
}

/* ============================================
   EMPTY STATE — Botão "Centro-Esquerda"
   Aparece APENAS em sites de partido único ($partidoUnico !== null).
   No agregador, o bloco `if` do renderEmpty() nunca o renderiza.
   ============================================ */
.empty-banner-text {
  font-size: 0.85rem;
  color: #5f6368;
  margin-bottom: 12px;
  line-height: 1.4;
}

.empty-brand {
  display: inline-block;
  padding: 8px 22px;
  border: 1px solid #1f1f1f;
  border-radius: 6px;
  background: #ffffff;
  font-family: inherit;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.5px;
  text-decoration: none;
  line-height: 1.1;
  transition: all 0.2s ease;
  margin: 4px 0 12px;
}

.empty-brand:hover {
  background: #f8f9fa;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.empty-brand .brand-a {
  color: #1a73e8;
}

.empty-brand .brand-b {
  color: rgb(234, 67, 53);
}

/* ============================================
   EMPTY STATE — Hint de filtro de gênero ativo
   ============================================ */
.empty-hint {
  font-size: 0.85rem;
  color: #5f6368;
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: 6px;
  padding: 8px 14px;
  margin: 14px auto 0;
  max-width: 420px;
  line-height: 1.4;
  text-align: center;
}

.empty-hint strong { color: #1f1f1f; }

.empty-hint a {
  color: #1a73e8;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.empty-hint a:hover { text-decoration: underline; }

/* ============================================
   BUSCA — alargar input para caber placeholder contextual
   ============================================ */
#sidebarSearchInput,
#headerSearchInput {
  min-width: 240px;
  width: 100%;
}

#sidebarSearchInput::placeholder,
#headerSearchInput::placeholder {
  font-size: 0.8rem;   /* reduz um pouco para caber sem truncar */
}

/* ============================================
   CANDIDATO — Lista de redes (ícone + URL)
   ============================================ */
.redes-lista {
  list-style: none;
  padding: 0;
  margin: 8px 0;
}

.redes-lista li {
  margin: 4px 0;
}

.redes-lista a {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  padding: 4px 0;
}

.rede-icone {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  object-fit: contain;
}

.rede-url {
  color: #1a73e8;
  font-size: 0.85rem;
  word-break: break-all;
  line-height: 1.3;
}

.rede-url:hover {
  text-decoration: underline;
}

/* Mobile: ícone + URL em linha, sem quebrar estranho */
@media (max-width: 480px) {
  .redes-lista a {
    gap: 6px;
  }
  .rede-icone {
    width: 20px;
    height: 20px;
  }
  .rede-url {
    font-size: 0.75rem;
  }
}

/* ============================================
   CANDIDATO — Botões de share (uniforme com index)
   ============================================ */
.btn-share-sm {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid #1a73e8;
  border-radius: 20px;
  background: #1a73e8;
  color: white;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  flex-shrink: 0;
  white-space: nowrap;
  font-family: inherit;
}

.btn-share-sm:hover {
  background: #1557b0;
  border-color: #1557b0;
  box-shadow: 0 2px 8px rgba(26, 115, 232, 0.3);
  transform: translateY(-1px);
}

.btn-share-sm .material-icons {
  color: white;
}

/* Estado "Copiado!" — verde sucesso */
.btn-share-sm-ok {
  background: #34a853 !important;
  border-color: #34a853 !important;
}

.btn-share-sm-ok:hover {
  background: #2d9248 !important;
  border-color: #2d9248 !important;
}

/* Mobile: botões ocupam a linha toda */
@media (max-width: 480px) {
  .btn-share-sm {
    font-size: 0.75rem;
    padding: 5px 10px;
  }
}

.candidate-estrelas {
  color: #f5a623;
  font-size: 13px;
  letter-spacing: -1px;
  margin-left: 4px;
}

.candidate-estrelas {
    color: #f5a623;
    font-size: 13px;
    letter-spacing: -1px;
    margin-left: 6px;
    vertical-align: middle;
    cursor: help;
}