/* Component Styles */

/* Cargo Selector Bar */
.cargo-toggle-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: var(--bg-input);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.cargo-toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 10px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: var(--transition);
}

.cargo-toggle-btn .sub-text {
  font-size: 0.72rem;
  font-weight: 500;
  opacity: 0.8;
}

.cargo-toggle-btn.active {
  background: var(--bg-input);
  color: var(--primary);
  border: 1px solid var(--primary);
}

/* Metric / Stat Tiles */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

/* Glassmorphic Card Container */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.glass-card:hover {
  border-color: #475569;
}

/* Card Header */
.card-title-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-title-bar h2 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

/* Formulários e Inputs */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 1rem;
  color: var(--text-main);
  font-family: inherit;
  transition: var(--transition);
}

.form-input:focus {
  outline: none;
  border-color: var(--border-focus);
}

.form-input::placeholder {
  color: var(--text-dim);
}

/* Botões */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.btn-primary {
  background: var(--bg-input);
  color: var(--primary);
  border: 1px solid var(--primary);
}

.btn-primary:hover {
  background: var(--primary);
  color: #000000;
}

.btn-secondary {
  background: #334155;
  color: var(--text-main);
  border: 1px solid #475569;
}

.btn-secondary:hover {
  background: #475569;
}

.btn-success {
  background: var(--bg-input);
  color: var(--accent-green);
  border: 1px solid var(--accent-green);
}

.btn-success:hover {
  background: var(--accent-green);
  color: #000000;
}

.btn-danger {
  background: #EF4444;
  color: #FFFFFF;
}

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

.btn-sm {
  padding: 6px 12px;
  font-size: 0.85rem;
}

.btn-lg {
  padding: 12px 20px;
  font-size: 1rem;
}

.metric-tile {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
}

.metric-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
}

.metric-value {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary-light);
}

/* Progress & Balance Bar */
.balance-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
}

.balance-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
}

.progress-track {
  width: 100%;
  height: 8px;
  background: #0F172A;
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--primary);
  transition: width 0.3s ease;
}

.progress-fill.surplus {
  background: var(--accent-red);
}

/* Search Dropdown / Autocomplete for Candidates */
.search-box-container {
  position: relative;
}

.candidate-dropdown-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 250px;
  overflow-y: auto;
  background: #1E293B;
  border: 1px solid var(--border-focus);
  border-radius: var(--radius-sm);
  z-index: 100;
  box-shadow: var(--shadow-lg);
  display: none;
}

.candidate-dropdown-item {
  padding: 10px 12px;
  border-bottom: 1px solid #334155;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: var(--transition);
}

.candidate-dropdown-item:hover {
  background: #334155;
}

.candidate-dropdown-item:last-child {
  border-bottom: none;
}

/* Party / Federation Accordion Cards */
.party-group-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 12px;
  transition: var(--transition);
}

.party-group-card.has-seats {
  border-color: rgba(56, 189, 248, 0.4);
}

.party-group-header {
  padding: 14px 16px;
  background: rgba(15, 23, 42, 0.6);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  transition: var(--transition);
}

.party-group-header:hover {
  background: rgba(30, 41, 59, 0.9);
}

.party-group-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 0.95rem;
}

.party-group-chevron {
  transition: transform 0.25s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-light);
}

.party-group-card.collapsed .party-group-chevron {
  transform: rotate(-90deg);
}

.party-summary-chips {
  display: flex;
  align-items: center;
  gap: 8px;
}

.party-group-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-top: 1px solid #334155;
  transition: max-height 0.3s ease, opacity 0.3s ease;
}

.party-group-card.collapsed .party-group-body {
  display: none;
}

/* Candidate Row in Group */
.candidate-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  border: 1px solid #334155;
}

.candidate-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.candidate-name {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-main);
}

.candidate-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  gap: 6px;
  align-items: center;
}

.vote-input-wrapper {
  display: flex;
  align-items: center;
  gap: 4px;
}

.vote-input-field {
  width: 100px;
  background: #0B1120;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: #FFFFFF;
  padding: 6px 8px;
  font-size: 0.88rem;
  font-weight: 700;
  text-align: right;
}

/* Table Styles for Results & Audit */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  text-align: left;
}

.custom-table th {
  background: #0F172A;
  color: var(--text-muted);
  padding: 10px 12px;
  font-weight: 700;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.custom-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #26354D;
  white-space: nowrap;
}

.custom-table tr:last-child td {
  border-bottom: none;
}

.custom-table tr:hover td {
  background: rgba(56, 189, 248, 0.05);
}

/* Elected Candidates Card List */
.elected-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

.elected-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.elected-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.elected-name {
  font-weight: 800;
  font-size: 0.92rem;
  color: #FFFFFF;
}

/* Quick Vote Helper Buttons */
.quick-vote-btn {
  background: #26354D;
  color: var(--text-muted);
  border: 1px solid #334155;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.7rem;
  cursor: pointer;
}

.quick-vote-btn:hover {
  background: #334155;
  color: #FFFFFF;
}

/* Modal Popup */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 16px;
}

.modal-backdrop.active {
  display: flex;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
