.products-page .page-header {
  align-items: center;
}

.products-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding: 0.875rem 1.25rem !important;
}

.search-box {
  flex: 1;
}

.search-box input {
  width: 100%;
  padding: 0.65rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 0.9375rem;
  background: var(--card);
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-glow);
}

.view-toggle {
  display: flex;
  gap: 0.25rem;
  background: var(--bg-subtle);
  padding: 0.25rem;
  border-radius: 10px;
}

.view-toggle button {
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.2s;
}

.view-toggle button.active {
  background: var(--card);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.category-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.category-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.category-pill:hover {
  border-color: var(--primary-light);
  color: var(--primary);
}

.category-pill.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-color: transparent;
  color: white;
  box-shadow: 0 2px 10px rgba(79, 70, 229, 0.35);
}

.pill-count {
  background: rgba(0, 0, 0, 0.08);
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.6875rem;
}

.category-pill.active .pill-count {
  background: rgba(255, 255, 255, 0.25);
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.product-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.25s ease;
  box-shadow: var(--shadow-sm);
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.product-card-header {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid;
}

.product-category-tag {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
}

.product-card-body {
  padding: 1.25rem 1.5rem;
  flex: 1;
}

.product-id {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.35rem;
}

.product-name {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
  line-height: 1.35;
}

.product-price {
  font-size: 1.375rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.02em;
  margin-bottom: 1.25rem;
}

.product-stock-section {
  padding-top: 1rem;
  border-top: 1px solid var(--border-light);
}

.stock-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.stock-badge {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
}

.stock-badge.good { background: var(--success-bg); color: #047857; }
.stock-badge.moderate { background: #e0f2fe; color: #0369a1; }
.stock-badge.low { background: var(--warning-bg); color: #b45309; }
.stock-badge.critical { background: var(--danger-bg); color: #b91c1c; }

.stock-count {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
}

.stock-progress {
  height: 6px;
  background: var(--border-light);
  border-radius: 999px;
  overflow: hidden;
}

.stock-progress-bar {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s ease;
}

.stock-progress-bar.good { background: linear-gradient(90deg, #10b981, #34d399); }
.stock-progress-bar.moderate { background: linear-gradient(90deg, #0ea5e9, #38bdf8); }
.stock-progress-bar.low { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.stock-progress-bar.critical { background: linear-gradient(90deg, #ef4444, #f87171); }

.product-card-footer {
  display: flex;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  background: var(--bg-subtle);
  border-top: 1px solid var(--border-light);
}

.product-card-footer .btn-outline {
  flex: 1;
}

.btn-ghost.danger {
  color: var(--danger);
}

.btn-ghost.danger:hover {
  background: var(--danger-bg);
}

.products-empty {
  text-align: center;
  padding: 4rem 2rem !important;
}

.products-empty h3 {
  margin: 0.5rem 0;
  font-size: 1.125rem;
}

.products-empty p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.products-table-wrap {
  padding: 0 !important;
  overflow: hidden;
}

.products-table {
  margin: 0;
}

.table-product-cell {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.table-product-cell strong {
  display: block;
  font-size: 0.9375rem;
}

.table-id {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.table-price {
  font-weight: 700;
  color: var(--primary);
}

.table-actions {
  display: flex;
  gap: 0.35rem;
}

.product-modal .modal-subtitle {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin: -1rem 0 1.5rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

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

  .form-row {
    grid-template-columns: 1fr;
  }

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