.categories-dashboard {
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  min-height: 100vh;
  padding: 2rem 0;
}

/* Header Styles */
.dashboard-header {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  color: white;
  padding: 3rem 0;
  margin-bottom: 2rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dashboard-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin: 0;
  background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.dashboard-subtitle {
  font-size: 1.1rem;
  opacity: 0.9;
  margin: 0.5rem 0 0 0;
}

.header-actions .btn {
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  border: none;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  transition: all 0.3s ease;
}

.header-actions .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(59, 130, 246, 0.3);
}

/* Stats Overview */
.stats-overview {
  max-width: 1200px;
  margin: 0 auto 2rem;
  padding: 0 2rem;
}

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

.stat-card {
  background: white;
  border-radius: 16px;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  border-left: 4px solid;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.stat-total { border-left-color: #6366f1; }
.stat-active { border-left-color: #10b981; }
.stat-categorized { border-left-color: #3b82f6; }
.stat-uncategorized { border-left-color: #f59e0b; }

.stat-icon {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 1rem;
  font-size: 1.5rem;
}

.stat-total .stat-icon {
  background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
  color: #4f46e5;
}

.stat-active .stat-icon {
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
  color: #059669;
}

.stat-categorized .stat-icon {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  color: #2563eb;
}

.stat-uncategorized .stat-icon {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: #d97706;
}

.stat-number {
  font-size: 2rem;
  font-weight: 700;
  color: #1e293b;
  line-height: 1;
}

.stat-label {
  font-size: 0.875rem;
  color: #64748b;
  margin-top: 0.25rem;
}

/* Section Styles */
.dashboard-section {
  max-width: 1200px;
  margin: 0 auto 2rem;
  padding: 0 2rem;
}

.section-header {
  background: white;
  border-radius: 16px 16px 0 0;
  padding: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.section-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1e293b;
  display: flex;
  align-items: center;
}

.section-content {
  background: white;
  border-radius: 0 0 16px 16px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

/* Categories Grid */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1.5rem;
}

.category-card {
  background: white;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.category-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  border-color: #cbd5e1;
}

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

.category-icon {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
  color: #4f46e5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.category-status {
  display: flex;
  gap: 0.5rem;
}

.status-badge {
  padding: 0.375rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

.status-inactive {
  background: #f1f5f9;
  color: #64748b;
}

.category-body {
  padding: 0 1.5rem 1.5rem;
}

.category-name {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1e293b;
  margin: 0 0 0.75rem 0;
}

.category-description {
  color: #64748b;
  margin-bottom: 1rem;
  line-height: 1.5;
}

.category-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.metric-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1rem;
  background: #f8fafc;
  border-radius: 8px;
}

.metric-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0.25rem 0;
}

.metric-label {
  font-size: 0.75rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.category-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.category-actions .btn {
  flex: 1;
  min-width: 100px;
}

/* Products Table */
.products-table-container {
  background: white;
  border-radius: 12px;
  overflow: hidden;
}

.table-header {
  background: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
}

.table-header th {
  border: none;
  padding: 1rem;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.875rem;
}

.product-row {
  transition: background-color 0.2s ease;
}

.product-row:hover {
  background-color: #f8fafc;
}

.product-row td {
  padding: 1rem;
  border: none;
  vertical-align: middle;
}

.product-info {
  display: flex;
  flex-direction: column;
}

.product-name {
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 0.25rem;
}

.product-description {
  font-size: 0.875rem;
  color: #64748b;
  line-height: 1.4;
}

.metric-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background: #f1f5f9;
  color: #475569;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
}

/* Modal Styles */
.modal-content {
  border-radius: 16px;
  border: none;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.modal-header {
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  border-bottom: 1px solid #e2e8f0;
  border-radius: 16px 16px 0 0;
}

.modal-title {
  color: #1e293b;
  font-weight: 600;
}

.product-info-display {
  background: #f8fafc;
  border-radius: 8px;
  padding: 1rem;
  border-left: 4px solid #3b82f6;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
}

.empty-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state h4 {
  color: #475569;
  margin-bottom: 0.5rem;
}

.empty-state p {
  color: #94a3b8;
  margin-bottom: 1.5rem;
}

/* Search Section */
.search-section {
  margin-bottom: 1.5rem;
}

.search-wrapper {
  position: relative;
  max-width: 400px;
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  z-index: 10;
}

.search-input {
  padding-left: 3rem;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 1rem;
  transition: all 0.3s ease;
}

.search-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  outline: none;
}

/* Pagination Section */
.pagination-section {
  border-top: 1px solid #e2e8f0;
  padding-top: 1.5rem;
}

.pagination {
  margin: 0;
}

.page-link {
  color: #3b82f6;
  border: 1px solid #e2e8f0;
  padding: 0.5rem 0.75rem;
  margin: 0 0.125rem;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.page-link:hover {
  background-color: #f1f5f9;
  border-color: #cbd5e1;
  color: #1d4ed8;
}

.page-item.active .page-link {
  background-color: #3b82f6;
  border-color: #3b82f6;
  color: white;
}

.page-item.disabled .page-link {
  color: #94a3b8;
  background-color: #f8fafc;
  border-color: #e2e8f0;
  cursor: not-allowed;
}

/* Loading State */
.spinner-border {
  width: 2rem;
  height: 2rem;
}

/* Responsive adjustments for search and pagination */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    text-align: center;
    gap: 1.5rem;
  }

  .dashboard-title {
    font-size: 2rem;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .categories-grid {
    grid-template-columns: 1fr;
  }

  .category-actions {
    flex-direction: column;
  }

  .category-actions .btn {
    flex: none;
    width: 100%;
  }

  .search-wrapper {
    max-width: 100%;
  }

  .pagination-section .d-flex {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .dashboard-header {
    padding: 2rem 0;
  }

  .header-content {
    padding: 0 1rem;
  }

  .stats-overview,
  .dashboard-section {
    padding: 0 1rem;
  }

  .category-card {
    margin: 0 -1rem;
    border-radius: 0;
  }
}

/* Search Results Count */
.search-results-count {
  color: #64748b;
  font-size: 0.875rem;
  margin-top: 0.75rem;
  padding: 0.5rem 0;
  min-height: 2.5rem;
  display: flex;
  align-items: center;
}

.search-results-count .text-success {
  color: #059669 !important;
  font-weight: 500;
}

.search-results-count .text-muted {
  color: #94a3b8 !important;
  font-style: italic;
}

/* Pagy Pagination Styles */
.pagy-nav {
  margin: 0;
}

.pagy-nav .page {
  display: inline-block;
  margin: 0 0.125rem;
}

.pagy-nav .page a,
.pagy-nav .page span {
  display: block;
  padding: 0.5rem 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  text-decoration: none;
  transition: all 0.2s ease;
  min-width: 2.5rem;
  text-align: center;
}

.pagy-nav .page a {
  color: #3b82f6;
  background: white;
}

.pagy-nav .page a:hover {
  background-color: #f1f5f9;
  border-color: #cbd5e1;
  color: #1d4ed8;
  transform: translateY(-1px);
}

.pagy-nav .page.active span {
  background-color: #3b82f6;
  border-color: #3b82f6;
  color: white;
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.pagy-nav .page.prev a,
.pagy-nav .page.next a {
  font-weight: bold;
}

.pagy-nav .page.prev a:hover,
.pagy-nav .page.next a:hover {
  text-decoration: none;
}

/* Alternative: Style the page-link class directly */
.pagy-nav .page-link {
  color: #3b82f6 !important;
  background: white !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 6px !important;
  padding: 0.5rem 0.75rem !important;
  margin: 0 0.125rem !important;
  text-decoration: none !important;
  transition: all 0.2s ease !important;
  min-width: 2.5rem !important;
  text-align: center !important;
}

.pagy-nav .page-link:hover {
  background-color: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
  color: #1d4ed8 !important;
  transform: translateY(-1px) !important;
}




