/* ============================================
   Catalog Screen
   ============================================ */

.catalog-screen {
  min-height: 100vh;
  background: var(--neutral-50);
}

/* ---- Top Bar ---- */
.catalog-topbar {
  background: var(--white);
  border-bottom: 1px solid var(--neutral-200);
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.catalog-topbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--green-800);
  white-space: nowrap;
}

.topbar-brand img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: contain;
}

/* Role Badge */
.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.65rem;
  font-weight: 700;
  font-family: var(--font-sans);
  letter-spacing: 0.5px;
}

.role-badge.admin {
  background: linear-gradient(135deg, #d97706, #f59e0b);
  color: var(--white);
}

.role-badge.viewer {
  background: var(--neutral-200);
  color: var(--neutral-600);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-btn {
  padding: 8px 14px;
  border-radius: var(--radius-full);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid var(--neutral-200);
  background: var(--white);
  color: var(--neutral-600);
  transition: all var(--duration-fast) var(--ease-smooth);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  text-decoration: none;
}

.topbar-btn:hover {
  border-color: var(--neutral-400);
  color: var(--neutral-800);
}

.topbar-btn.danger:hover {
  border-color: #e53e3e;
  color: #e53e3e;
  background: #fff5f5;
}

/* ---- Filter / Toolbar ---- */
.catalog-toolbar {
  padding: 20px 0 12px;
}

.catalog-toolbar .container {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.search-box {
  flex: 1;
  min-width: 220px;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 11px 16px 11px 42px;
  border: 1.5px solid var(--neutral-200);
  border-radius: var(--radius-full);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  color: var(--neutral-800);
  background: var(--white);
  outline: none;
  transition: all var(--duration-fast) var(--ease-smooth);
}

.search-box input:focus {
  border-color: var(--green-500);
  box-shadow: 0 0 0 4px rgba(56,161,105,0.1);
}

.search-box .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  color: var(--neutral-400);
  pointer-events: none;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.filter-select {
  padding: 10px 32px 10px 14px;
  border: 1.5px solid var(--neutral-200);
  border-radius: var(--radius-full);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--neutral-700);
  background: var(--white);
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23737373' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: all var(--duration-fast) var(--ease-smooth);
}

.filter-select:focus {
  border-color: var(--green-500);
  box-shadow: 0 0 0 4px rgba(56,161,105,0.1);
}

/* View toggle */
.view-toggle {
  display: flex;
  border: 1.5px solid var(--neutral-200);
  border-radius: var(--radius-full);
  overflow: hidden;
  background: var(--white);
}

.view-toggle button {
  padding: 9px 14px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 1rem;
  color: var(--neutral-400);
  transition: all var(--duration-fast) var(--ease-smooth);
  display: flex;
  align-items: center;
  justify-content: center;
}

.view-toggle button.active {
  background: var(--green-600);
  color: var(--white);
}

.view-toggle button:hover:not(.active) {
  background: var(--neutral-100);
  color: var(--neutral-700);
}

/* Product count / stats bar */
.catalog-stats {
  padding: 0 0 8px;
}

.catalog-stats .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.product-count {
  font-size: 0.82rem;
  color: var(--neutral-500);
  font-weight: 500;
}

.product-count strong {
  color: var(--green-700);
  font-weight: 700;
}

.active-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: var(--green-50);
  border: 1px solid var(--green-400);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--green-700);
}

.filter-pill button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--green-600);
  line-height: 1;
  padding: 0;
}

.filter-pill button:hover {
  color: #e53e3e;
}

/* ============================================
   Grid View (Image-based cards)
   ============================================ */

.catalog-content {
  padding: 16px 0 64px;
}

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

.catalog-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--neutral-100);
  transition: all var(--duration-normal) var(--ease-smooth);
  animation: fadeInUp 0.4s var(--ease-smooth) both;
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.catalog-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.card-brand-strip {
  height: 5px;
  width: 100%;
}

/* Admin card actions */
.card-admin-actions {
  display: flex;
  gap: 6px;
  transition: opacity var(--duration-fast) var(--ease-smooth);
}

.card-action-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--neutral-200);
  background: var(--white);
  cursor: pointer;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  transition: all var(--duration-fast) var(--ease-smooth);
}

.card-action-btn:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-md);
}

.card-action-btn.delete-btn:hover {
  background: #fff5f5;
}

.card-image-area {
  height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--white);
  padding: 0;
  position: relative;
  overflow: hidden;
}

.card-image-area img {
  height: 100%;
  width: 100%;
  object-fit: contain;
  transform: scale(1.1);
  transition: transform var(--duration-normal) var(--ease-smooth);
}

.card-top-space {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.card-tags {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  flex-grow: 1;
}

.clickable-tag {
  cursor: pointer;
  transition: transform var(--duration-fast) var(--ease-smooth), opacity var(--duration-fast);
}

.clickable-tag:hover {
  transform: scale(1.05);
  opacity: 0.9;
}

.card-brand-badge {
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--white);
}

.card-type-tag {
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  background: var(--neutral-200);
  color: var(--neutral-700);
}

.card-brand-initial {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--white);
}

.card-body {
  padding: 16px 20px 20px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.card-sku {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--neutral-400);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 4px;
}

.card-name {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--neutral-900);
  line-height: 1.35;
  margin-bottom: 6px;
}

.card-packaging {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--amber-700);
  background: var(--amber-100);
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  margin-bottom: 8px;
}

.packaging-label {
  font-weight: 500;
  opacity: 0.75;
  margin-right: 2px;
}

.card-description {
  font-size: 0.8rem;
  color: var(--neutral-500);
  line-height: 1.5;
  margin-bottom: 8px;
}

.card-prices {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: auto;
}

.price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
}

.price-row:nth-child(odd) {
  background: var(--neutral-50);
}

.price-label {
  color: var(--neutral-500);
  font-weight: 500;
}

.price-value {
  font-weight: 700;
  color: var(--green-700);
}

.price-row.best-price {
  background: var(--green-50);
  border: 1px solid rgba(56,161,105,0.15);
}

.price-row.best-price .price-label {
  color: var(--green-700);
}

.price-row.best-price .price-value {
  color: var(--green-800);
  font-size: 0.9rem;
}

/* ============================================
   List View (Table-based)
   ============================================ */

.catalog-table-wrapper {
  background: var(--white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--neutral-100);
  box-shadow: var(--shadow-sm);
}

.catalog-table {
  width: 100%;
  border-collapse: collapse;
}

.catalog-table thead {
  background: var(--green-800);
  position: sticky;
  top: 0;
  z-index: 10;
}

.catalog-table th {
  padding: 14px 16px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--white);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: background var(--duration-fast) var(--ease-smooth);
}

.catalog-table th:hover {
  background: var(--green-700);
}

.catalog-table th .sort-icon {
  margin-left: 6px;
  font-size: 0.7rem;
  opacity: 0.5;
}

.catalog-table th.sorted .sort-icon {
  opacity: 1;
}

.catalog-table td {
  padding: 12px 16px;
  font-size: 0.85rem;
  color: var(--neutral-700);
  border-bottom: 1px solid var(--neutral-100);
  transition: background var(--duration-fast) var(--ease-smooth);
}

.catalog-table tbody tr:hover td {
  background: var(--green-50);
}

.catalog-table tbody tr:nth-child(even) td {
  background: var(--neutral-50);
}

.catalog-table tbody tr:nth-child(even):hover td {
  background: var(--green-50);
}

.table-brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 8px;
  vertical-align: middle;
}

.table-price {
  font-weight: 700;
  color: var(--green-700);
  white-space: nowrap;
}

.table-sku {
  font-family: monospace;
  font-size: 0.8rem;
  color: var(--neutral-500);
}

/* Table admin action buttons */
.table-action-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 4px;
  border-radius: 4px;
  transition: background var(--duration-fast) var(--ease-smooth);
}

.table-action-btn:hover {
  background: var(--neutral-100);
}
