:root {
  --tm-dark: #151515;
  --tm-gray-900: #292929;
  --tm-gray-700: #555;
  --tm-gray-300: #d7d7d7;
  --tm-gray-100: #f5f5f5;
  --tm-blue: #1f3d8e;
}

.search-results-page {
  min-height: 50vh;
  padding-top: 14px;
  padding-bottom: 28px;
  font-family: Verdana, Arial, Helvetica, sans-serif;
  font-size: 12px;
}

.results-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--tm-gray-300);
  background: var(--tm-gray-100);
  border-radius: 6px;
}

.results-summary { min-width: 0; }
.results-summary strong { display: block; font-size: 13px; }
.results-summary span { color: var(--tm-gray-700); }

.view-switch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  padding: 7px 11px;
  border: 1px solid var(--tm-dark);
  border-radius: 5px;
  background: #fff;
  color: var(--tm-dark);
  text-decoration: none;
  font-weight: 700;
}
.view-switch:hover { background: var(--tm-dark); color: #fff; }
.view-switch i { font-size: 18px; }

.results-table-wrap {
  overflow-x: auto;
  border: 1px solid #bdbdbd;
  border-radius: 5px;
  background: #fff;
}
.results-table { margin: 0; min-width: 980px; }
.results-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 8px 6px;
  border-color: #aaa;
  background: var(--tm-dark);
  color: #fff;
  font-size: 11px;
  text-align: center;
  white-space: nowrap;
}
.results-table tbody td {
  padding: 7px 6px;
  border-color: #ddd;
  vertical-align: middle;
  font-size: 11px;
}
.results-table tbody tr:nth-child(even) { background: #f7f7f7; }
.results-table tbody tr:hover { background: #eaeaea; }
.product-code { font-weight: 700; white-space: nowrap; }
.product-description { min-width: 340px; }
.stock-cell, .price-cell, .image-cell { text-align: center; white-space: nowrap; }
.promo-cell { min-width: 180px; }
.product-thumb { width: 50px; height: 50px; object-fit: contain; }

.results-empty {
  padding: 38px 20px;
  border: 1px dashed #aaa;
  border-radius: 6px;
  text-align: center;
  background: #fafafa;
}
.results-empty i { display: block; margin-bottom: 8px; font-size: 32px; }

.product-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}
.product-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  padding: 10px;
  border: 1px solid #d3d3d3;
  border-radius: 6px;
  background: #fff;
  transition: box-shadow .2s ease, transform .2s ease;
}
.product-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.12); }
.product-card-code { margin: 0 0 7px; font-size: 11px; font-weight: 700; text-align: center; }
.product-card-image {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 145px;
  margin-bottom: 8px;
}
.product-card-image img { max-width: 100%; max-height: 145px; object-fit: contain; }
.product-card-description { margin: auto 0 0; font-size: 11px; line-height: 1.35; text-align: center; }
.product-card-price { display: block; margin-top: 6px; font-size: 13px; }

.search-pagination { margin-top: 18px; }
.search-pagination .page-link { color: var(--tm-dark); border-color: #bbb; }
.search-pagination .page-item.active .page-link { background: var(--tm-dark); border-color: var(--tm-dark); color: #fff; }

.search-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 2500;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.82);
}
.search-loading-overlay.is-visible { display: flex; }
.search-loading-box {
  padding: 18px 24px;
  border-radius: 7px;
  background: #222;
  color: #fff;
  font-weight: 700;
}

@media (max-width: 991.98px) {
  .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 767.98px) {
  .search-results-page { padding-top: 8px; font-size: 11px; }
  .results-toolbar { align-items: stretch; flex-direction: column; }
  .view-switch { justify-content: center; width: 100%; }
  .results-table-wrap { overflow: visible; border: 0; background: transparent; }
  .results-table { min-width: 0; border: 0; }
  .results-table thead { display: none; }
  .results-table, .results-table tbody, .results-table tr, .results-table td { display: block; width: 100%; }
  .results-table tbody tr {
    margin-bottom: 12px;
    overflow: hidden;
    border: 1px solid #bbb;
    border-radius: 6px;
    background: #fff !important;
  }
  .results-table tbody td {
    display: grid;
    grid-template-columns: 104px minmax(0, 1fr);
    gap: 8px;
    min-width: 0;
    padding: 7px 9px;
    border: 0;
    border-bottom: 1px solid #e6e6e6;
    text-align: left !important;
    white-space: normal;
  }
  .results-table tbody td:last-child { border-bottom: 0; }
  .results-table tbody td::before {
    content: attr(data-label);
    font-weight: 700;
    color: #333;
  }
  .product-description, .promo-cell { min-width: 0; }
  .image-cell a { justify-self: start; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .product-card-image { min-height: 120px; }
  .product-card-image img { max-height: 120px; }
}

@media (max-width: 390px) {
  .product-grid { grid-template-columns: 1fr; }
}
