/* Toolbar - Modern Compact Header */
.toolbar {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  background: linear-gradient(to bottom, #fafbfc, #f5f8fc);
  border-radius: 12px 12px 0 0;
  border: 1px solid var(--border);
  border-bottom: none;
}

.toolbar-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.record-count {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
  background: var(--surface);
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
}

/* Search */
.search {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  color: var(--muted);
  pointer-events: none;
}

.search input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px 10px 38px;
  font-size: 14px;
  background: #fff;
  transition: all 0.2s ease;
}
.search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(74, 111, 165, 0.15);
  outline: none;
}

.filters select {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filters select:hover {
  border-color: var(--accent);
}

.filters select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(74, 111, 165, 0.15);
}

.toolbar-actions {
  justify-self: end;
}

.btn-primary {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-block;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #252547 0%, #1e2d4d 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(26, 26, 46, 0.25);
}

.btn-primary:active {
  transform: translateY(0);
}

/* Row action buttons — keep View / Edit / Delete on a single line, evenly
   sized, instead of wrapping onto a second row. */
.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  flex-wrap: nowrap;
}

.row-actions .btn {
  margin: 0;
  white-space: nowrap;
  text-align: center;
  min-width: 54px;
  text-decoration: none;
}

/* Table */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 12px 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

th, td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  transition: background-color 0.15s ease;
  text-align: left;
}

th {
  background: linear-gradient(to bottom, #f5f8fc, #eef3fa);
  font-weight: 600;
  color: #1a1a2e;
  font-size: 12px;
  user-select: none;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

th .sort {
  margin-left: 6px;
  font-size: 11px;
  opacity: 0.6;
}

tr:hover td {
  background: var(--row-hover);
}

/* Status badges */
.status {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
}

.status.Active {
  background: #d4edda;
  color: #155724;
}

.status.Closed {
  background: #e2e8f0;
  color: #475569;
}

.status.Pending {
  background: #fff3cd;
  color: #856404;
}

.status.Inactive {
  background: #f8d7da;
  color: #721c24;
}

/* Footer */
.list-footer {
  padding: 16px 20px;
  color: var(--muted);
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
  border-top: 1px solid var(--border);
  border-radius: 0 0 12px 12px;
}

.pagination {
  display: flex;
  gap: 8px;
}

.page {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.page:hover:not(.active) {
  background: var(--row-hover);
  border-color: var(--accent);
}

.page.active {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(26, 26, 46, 0.25);
}

@media (max-width: 900px) {
  .toolbar {
    padding: 16px 20px;
  }

  .toolbar-header {
    flex-basis: 100%;
    margin-bottom: 8px;
  }

  th:nth-child(5), td:nth-child(5), th:nth-child(6), td:nth-child(6) {
    display: none;
  }
}

@media (max-width: 640px) {
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-header {
    margin-bottom: 12px;
  }

  .toolbar-header h1 {
    font-size: 18px;
  }

  .search {
    width: 100%;
  }

  .filters {
    width: 100%;
  }

  .filters select {
    width: 100%;
  }

  .btn-primary {
    width: 100%;
    text-align: center;
  }

  th, td {
    padding: 12px 8px;
    font-size: 13px;
  }

  th:nth-child(4), td:nth-child(4),
  th:nth-child(7), td:nth-child(7),
  th:nth-child(8), td:nth-child(8) {
    display: none;
  }
}

/* ============================================
   DARK MODE OVERRIDES
   ============================================ */

[data-theme="dark"] .toolbar {
  background: linear-gradient(to bottom, #1f1f35, #1a1a2e);
  border-color: var(--border);
}

[data-theme="dark"] table {
  background: var(--surface);
  border-color: var(--border);
}

[data-theme="dark"] th {
  background: linear-gradient(to bottom, #252540, #1f1f35);
  color: var(--text);
}

[data-theme="dark"] td {
  color: var(--text);
  border-color: var(--border);
}

[data-theme="dark"] tr:hover td {
  background: var(--row-hover);
}

[data-theme="dark"] .search input {
  background: var(--input-bg);
  border-color: var(--border);
  color: var(--text);
}

[data-theme="dark"] .search input::placeholder {
  color: var(--muted);
}

[data-theme="dark"] .filters select {
  background: var(--input-bg);
  border-color: var(--border);
  color: var(--text);
}

[data-theme="dark"] .list-footer {
  background: #1f1f35;
  border-color: var(--border);
}

[data-theme="dark"] .page {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

[data-theme="dark"] .page:hover:not(.active) {
  background: var(--row-hover);
}

[data-theme="dark"] .page.active {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
}

/* Dark mode status badges - improved contrast */
[data-theme="dark"] .status.Active {
  background: rgba(16, 185, 129, 0.2);
  color: #4ade80;
}

[data-theme="dark"] .status.Closed {
  background: rgba(100, 116, 139, 0.2);
  color: #94a3b8;
}

[data-theme="dark"] .status.Pending {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

[data-theme="dark"] .status.Inactive {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

[data-theme="dark"] .btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
}

[data-theme="dark"] .btn-primary:hover {
  background: linear-gradient(135deg, var(--accent-light) 0%, #9fc0e8 100%);
  box-shadow: 0 4px 12px rgba(107, 140, 190, 0.35);
}
