/* Table header */
.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.table-header h3 {
  margin: 0;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  white-space: nowrap;
}

/* Expandable rows */
.main-row {
  cursor: pointer;
}

.main-row:hover {
  background-color: #f9fafb;
}

.details-row {
  display: none;
}

.details-row.open {
  display: table-row;
}

.details-row td {
  background: #fafafa;
  padding: 12px 16px;
}

.details-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.spread-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.site-group {
  background: #f3f4f6;
  border-left: 4px solid #2563eb;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 0.75rem;
}

.site-group h4 {
  margin: 0 0 0.5rem 0;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #2563eb;
}

.site-group ul {
  margin: 0;
  padding-left: 1rem;
}

.status-pill {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
}

.status-pill.active {
  background: #ecfdf5;
  color: #059669;
}

.status-pill.inactive {
  background: #fef2f2;
  color: #dc2626;
}

/* Modal styling (matches invoice modal) */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  width: 92%;
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid #e5e7eb;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.4rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #6b7280;
  padding: 0;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  color: #111827;
}

#spreadForm {
  padding: 1.5rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.site-spread-section {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1rem;
  margin-top: 1rem;
}

.site-spread-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.site-spread-header h4 {
  margin: 0;
  font-size: 1rem;
  color: #1f2937;
}

.list-controls {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1rem;
  margin-top: 0.75rem;
  align-items: center;
}

.list-box label {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
  color: #374151;
  font-weight: 500;
}

.list-box select {
  width: 100%;
  min-height: 120px;
  padding: 0.5rem;
  border: 1.5px solid #d1d5db;
  border-radius: 6px;
  background-color: #ffffff;
  font-family: inherit;
  font-size: 0.9rem;
  color: #1f2937;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.list-box select:hover {
  border-color: #9ca3af;
}

.list-box select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.list-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.list-buttons button {
  width: 44px;
  height: 36px;
}

.site-spread-section.disabled {
  opacity: 0.6;
}

.site-spread-section.disabled select,
.site-spread-section.disabled button {
  pointer-events: none;
}

.add-site-row {
  margin-top: 1.25rem;
}

.add-site-selector {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.75rem;
  align-items: center;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  padding: 1.25rem 0 0;
  border-top: 1px solid #e5e7eb;
  margin-top: 1.5rem;
}

.hidden {
  display: none !important;
}

@media (max-width: 768px) {
  .table-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .list-controls {
    grid-template-columns: 1fr;
  }

  .list-buttons {
    flex-direction: row;
    justify-content: center;
  }
}
