/* Enhanced changelist with Bootstrap styling */
:root {
  --accent: #6d28d9;
  --muted-text: #6b7280;
  --border: #e6e9ee;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
}

body { background: #f9fafb; }
#content-main { padding: 2rem 1.5rem; }

/* Main changelist container */
#changelist {
  background: white;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 2rem;
  box-shadow: 0 8px 24px rgba(17,24,39,0.06);
}

/* Header styling */
#changelist h1 {
  color: var(--accent);
  font-size: 1.5rem;
  margin: 0 0 1rem 0;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

#changelist h1 i { font-size: 1.75rem; }

/* Form container */
.changelist-form-container { padding: 0.5rem 0; }
form#changelist-form { background: transparent; }

/* Search form styling */
#changelist-search {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: #f3f4f6;
  border-radius: 8px;
  border: 1px solid var(--border);
}

#changelist-search .form-group { margin-bottom: 0; }
#changelist-search input, #changelist-search select {
  border-radius: 6px;
  border: 1px solid var(--border);
}
#changelist-search input:focus, #changelist-search select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(109, 40, 217, 0.1);
}

/* Results table */
.results, #result_list {
  width: 100%;
  margin: 0;
  border-collapse: collapse;
}

#result_list {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

/* Table header */
#result_list thead {
  background: #f3f4f6;
  border-bottom: 2px solid var(--border);
}

#result_list thead th {
  padding: 14px 16px;
  font-weight: 600;
  color: #374151;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: none;
  background: transparent;
}

/* Table rows */
#result_list tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background-color 0.2s;
}

#result_list tbody tr:hover {
  background-color: #fafafa;
}

#result_list td {
  padding: 16px;
  vertical-align: middle;
}

/* First column (checkbox) styling */
#result_list tbody td:first-child {
  padding-left: 16px;
}

/* Badge styling for model-specific fields */
.badge-status {
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-block;
}

.badge-status.success { background: #d1fae5; color: #065f46; }
.badge-status.warning { background: #fef3c7; color: #92400e; }
.badge-status.danger { background: #fee2e2; color: #7f1d1d; }
.badge-status.info { background: #dbeafe; color: #0c2340; }
.badge-status.secondary { background: #e5e7eb; color: #374151; }

/* Action links */
#result_list a {
  color: var(--accent);
  text-decoration: none;
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  transition: all 0.2s;
}

#result_list a:hover {
  background: rgba(109, 40, 217, 0.1);
  text-decoration: none;
}

/* Pagination */
.paginator, .paginator .paginator-info {
  text-align: center;
  color: var(--muted-text);
  padding: 2rem 0 1rem 0;
  margin-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.paginator a, .paginator span {
  padding: 0.5rem 0.75rem;
  margin: 0 0.25rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: white;
  color: var(--accent);
  text-decoration: none;
  display: inline-block;
  transition: all 0.2s;
}

.paginator a:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.paginator .this-page {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* Filters sidebar */
.module.filtered {
  border: 1px solid var(--border);
}

#changelist-filter {
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: 8px;
}

#changelist-filter h3 {
  color: var(--accent);
  padding: 1rem;
  margin: 0;
  border-bottom: 1px solid var(--border);
}

/* Actions area */
.submit-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.submit-row input, .submit-row button {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: none;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.submit-row input[type="submit"] {
  background: var(--accent);
  color: white;
}

.submit-row input[type="submit"]:hover {
  opacity: 0.9;
}

/* Responsive */
@media (max-width: 900px) {
  #changelist {
    padding: 1rem;
  }
  #result_list td {
    padding: 12px;
  }
}

/* Model-specific helpers (examples):
   You can further target by .app-<app_label>.model-<modelname> selectors
   e.g. .app-registres.model-organisation #result_list thead { ... }
*/

/* Additional common improvements for all change_list views */

/* Zebra striping for readability */
#result_list tbody tr:nth-child(odd) {
  background: #ffffff;
}
#result_list tbody tr:nth-child(even) {
  background: #fbfbfc;
}

/* Sticky header so column labels remain visible */
#result_list thead th {
  position: sticky;
  top: 0;
  z-index: 3;
}

/* Narrow checkbox column and center checkboxes */
#result_list tbody td:first-child, #result_list thead th:first-child {
  width: 48px;
  text-align: center;
}

/* Improve action buttons appearance */
.row-actions a, .inline-actions a {
  display: inline-block;
  margin-right: 0.35rem;
  padding: 0.25rem 0.45rem;
  border-radius: 6px;
  border: 1px solid rgba(99,102,241,0.08);
  background: rgba(99,102,241,0.04);
  color: var(--accent);
  font-size: 0.9rem;
}
.row-actions a:hover, .inline-actions a:hover {
  background: rgba(109,40,217,0.12);
  color: #3b0b9a;
}

/* Make boolean fields more visible as badges */
td.field-boolean {
  text-align: center;
}
td.field-boolean img, td.field-boolean i {
  vertical-align: middle;
}

/* Subtle left accent on hover to highlight the row */
#result_list tbody tr:hover {
  box-shadow: inset 4px 0 0 rgba(109,40,217,0.06);
}

/* Improve responsiveness for very small screens */
@media (max-width: 600px) {
  #result_list thead { display: none; }
  #result_list tbody td { display: block; width: 100%; }
  #result_list tbody tr { margin-bottom: 0.75rem; display: block; border-radius: 8px; }
  #result_list tbody td[data-label]::before {
    content: attr(data-label) ": ";
    font-weight: 600;
    color: #374151;
    display: inline-block;
    width: 40%;
  }
}

