/* ==========================================================================
   BATCHES MODULE — Lotes de Grupos (CSS Dedicado)
   ========================================================================== */

/* Grid da página de Lotes */
.batches-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-4);
}

.batch-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  min-height: 150px;
}

.batch-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-subtle);
}

.batch-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
  gap: var(--space-3);
}

.batch-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.batch-card-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: var(--space-2);
  line-height: 1.4;
}

/* Fileira de Avatares dos Grupos do Lote */
.batch-avatar-stack {
  display: flex;
  align-items: center;
  margin: 10px 0;
}

.batch-avatar-item {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--bg-card);
  margin-left: -8px;
  overflow: hidden;
  background: var(--bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
  transition: transform 0.15s ease;
}

.batch-avatar-item:first-child {
  margin-left: 0;
}

.batch-avatar-item:hover {
  transform: translateY(-2px) scale(1.15);
  z-index: 5;
}

.batch-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.batch-avatar-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--primary);
  background: var(--primary-subtle);
  border-radius: 50%;
}

.batch-avatar-more {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--bg-card);
  margin-left: -8px;
  background: var(--bg-input);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.batch-card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: var(--space-3);
  border-top: 1px dashed var(--border);
  padding-top: var(--space-3);
}

.batch-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

/* ==========================================================================
   MODAL DE LOTES — LAYOUT E RESPONSIVIDADE
   ========================================================================== */

#batchModal .modal,
#viewBatchModal .modal {
  width: 90vw !important;
  max-width: 640px !important;
  max-height: 85vh !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  border-radius: var(--radius-xl) !important;
  box-shadow: var(--shadow-xl) !important;
  background: var(--bg-card) !important;
}

#batchModal .modal-header,
#viewBatchModal .modal-header {
  padding: 16px 20px !important;
  border-bottom: 1px solid var(--border) !important;
  flex-shrink: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
}

#batchModal form {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 !important;
  overflow: hidden !important;
  margin: 0 !important;
}

#batchModal .modal-body,
#viewBatchModal .modal-body {
  padding: 16px 20px !important;
  flex: 1 !important;
  overflow-y: auto !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 14px !important;
}

#batchModal .modal-footer,
#viewBatchModal .modal-footer {
  padding: 12px 20px !important;
  border-top: 1px solid var(--border) !important;
  background: var(--bg-card) !important;
  flex-shrink: 0 !important;
  display: flex !important;
  justify-content: flex-end !important;
  gap: 10px !important;
}

/* Campo de busca e seleção de grupos no Modal */
#batchModal .group-selection-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#batchModal .group-search-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#batchModal .search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

#batchModal .search-input-wrapper svg {
  position: absolute;
  left: 10px;
  color: var(--text-dim);
  pointer-events: none;
}

#batchModal .search-input-wrapper .search-input {
  width: 100%;
  padding: 8px 12px 8px 34px !important;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text);
  outline: none;
  font-family: var(--font);
  transition: border-color 0.15s, box-shadow 0.15s;
}

#batchModal .search-input-wrapper .search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-subtle);
}

#batchModal .group-list-container {
  border: 1px solid var(--border);
  border-radius: 6px;
  height: 220px;
  max-height: 220px;
  overflow-y: auto;
  background: var(--bg-card);
}

#batchModal .group-card {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.15s;
}

#batchModal .group-card:last-child {
  border-bottom: none;
}

#batchModal .group-card:hover {
  background: var(--bg-hover);
}

#batchModal .group-card:has(input:checked) {
  background: var(--primary-subtle);
}

#batchModal .group-card-checkbox input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* Modal de Visualização de Lote */
.batch-view-list {
  max-height: 360px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.batch-view-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
}

.batch-view-item-name {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text);
}

.batch-view-item-jid {
  font-size: 0.75rem;
  color: var(--text-muted);
}
