
/* ============================================================
   search.css — Search page, visual-search modal, product cards
   Uses the global design tokens from style.css (--cream, --brown…)
   ============================================================ */

/* ---------------- TOP NAV (standalone page) ---------------- */

.search-topnav {
  display: flex;
  align-items: center;
  gap: 22px;
}

.search-topnav a {
  color: #55504a;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: .18s ease;
}

.search-topnav a:hover {
  color: var(--brown);
}

.search-topnav a.active {
  color: var(--brown-dark);
  border-bottom: 2px solid var(--brown);
  padding-bottom: 2px;
}

/* ---------------- PAGE LAYOUT ---------------- */

.search-page {
  min-height: calc(100vh - 97px);
}

.search-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 5vw 70px;
}

.search-header h1 {
  font-family: "Playfair Display", serif;
  font-size: clamp(34px, 3.4vw, 48px);
  margin: 0;
  letter-spacing: -.03em;
}

.search-header h1 span {
  color: var(--brown);
}

.search-subtitle {
  max-width: 620px;
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

/* ---------------- UPLOAD CARD ---------------- */

.upload-card {
  margin-top: 28px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 14px 40px rgba(40,25,15,.06);
  padding: 42px 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
}

.upload-card > i {
  font-size: 44px;
  color: var(--brown);
}

.upload-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.65;
}

.service-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 14px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-checking { background: #d4b94e; }
.status-online    { background: #4caf50; }
.status-degraded  { background: #e69138; }
.status-offline   { background: #c0392b; }

/* ---------------- ALERTS ---------------- */

.search-alert {
  margin-top: 20px;
  padding: 14px 18px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.5;
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-alert:not([hidden]) {
  display: flex;
}

.search-alert.error {
  background: #fdf2f2;
  border: 1px solid #f3c9c5;
  color: #a13530;
}

.search-alert.info {
  background: #f4f0ea;
  border: 1px solid var(--border);
  color: #6b6259;
}

/* ---------------- RESULTS ---------------- */

.results-meta {
  margin: 24px 0 14px;
  color: var(--muted);
  font-size: 13.5px;
}

.results-meta:not([hidden]) {
  display: block;
}

.product-grid:not(:empty) {
  margin-bottom: 40px;
}

.product-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: .2s ease;
}

.product-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 34px rgba(35,27,18,.09);
}

.product-image {
  position: relative;
  aspect-ratio: 1 / 1;
  background: #f0ece5;
  overflow: hidden;
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.product-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 15px 16px;
  flex: 1;
}

.product-source {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--brown);
}

.product-title {
  font-family: "DM Sans", sans-serif;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.45;
  margin: 0;
  color: var(--ink);

  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 39px;
}

.product-price-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.product-price {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--ink);
}

.product-old-price {
  font-size: 12px;
  color: #a5a099;
  text-decoration: line-through;
}

.product-meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.product-rating {
  font-size: 12px;
  color: #b8860b;
  font-weight: 600;
}

.product-cta {
  margin-top: auto;
  min-height: 42px;
  font-size: 13px;
  text-decoration: none;
  width: 100%;
}

/* ---------------- EMPTY STATE ---------------- */

.search-empty {
  margin-top: 46px;
  text-align: center;
  background: white;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 55px 30px;
}

.search-empty[hidden] {
  display: none !important;
}

.search-empty-icon {
  width: 68px;
  height: 68px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #f1e4d8;
  color: var(--brown);
  font-size: 27px;
}

.search-empty h2 {
  font-family: "Playfair Display", serif;
  font-size: 24px;
  margin: 0 0 10px;
}

.search-empty p {
  max-width: 460px;
  margin: 0 auto;
  color: var(--muted);
  line-height: 1.65;
  font-size: 14px;
}

/* ---------------- VISUAL SEARCH MODAL ---------------- */

.vs-overlay {
  position: fixed;
  inset: 0;
  z-index: 2100;
  display: grid;
  place-items: center;
  background: rgba(248,246,242,.9);
  backdrop-filter: blur(7px);
  padding: 20px;
}

.vs-modal {
  width: min(520px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: white;
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(40,25,15,.16);
  padding: 26px 26px 24px;
}

.vs-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.vs-modal-header h3 {
  font-family: "Playfair Display", serif;
  font-size: 21px;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}

.vs-close {
  background: transparent;
  color: #777;
  font-size: 18px;
  padding: 6px;
  border-radius: 8px;
  transition: .15s ease;
}

.vs-close:hover {
  background: var(--cream-dark);
  color: var(--ink);
}

.vs-hint {
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.6;
  margin: 0 0 18px;
}

.vs-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  border: 2px dashed #d8d1c6;
  border-radius: 14px;
  background: #fbfaf8;
  padding: 36px 22px;
  cursor: pointer;
  transition: .2s ease;
}

.vs-dropzone:hover,
.vs-dropzone.dragover {
  border-color: var(--brown);
  background: #f6efe7;
}

.vs-dropzone i {
  font-size: 38px;
  color: var(--brown);
  margin-bottom: 6px;
}

.vs-dropzone strong {
  font-size: 14.5px;
  color: var(--ink);
}

.vs-dropzone span {
  font-size: 12.5px;
  color: var(--muted);
}

.vs-preview {
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  background: #fbfaf8;
}

.vs-preview img {
  width: 86px;
  height: 86px;
  object-fit: cover;
  border-radius: 10px;
  flex-shrink: 0;
}

.vs-preview-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.vs-preview-info strong {
  font-size: 13.5px;
  overflow-wrap: anywhere;
}

.vs-preview-info span {
  font-size: 12px;
  color: var(--muted);
}

.vs-error {
  margin: 14px 0 0;
  padding: 11px 14px;
  background: #fdf2f2;
  border: 1px solid #f3c9c5;
  color: #a13530;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
}

.vs-error[hidden] {
  display: none;
}

.vs-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.vs-actions .btn-primary-custom,
.vs-actions .btn-outline-custom {
  min-height: 47px;
  font-size: 14px;
}

.vs-remove-btn {
  color: #c0392b;
  border-color: #e5b6b2;
}

.vs-remove-btn:hover {
  background: #fdf2f2;
  color: #a13530;
}

/* ---------------- LOADING OVERLAY ---------------- */

.vs-loading {
  position: fixed;
  inset: 0;
  z-index: 2200;
  display: grid;
  place-items: center;
  background: rgba(248,246,242,.88);
  backdrop-filter: blur(6px);
}

.vs-loading-card {
  text-align: center;
  background: white;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 40px 52px;
  box-shadow: 0 20px 60px rgba(40,25,15,.12);
}

.vs-loading-card .spinner-border {
  width: 46px;
  height: 46px;
  color: var(--brown);
}

.vs-loading-card p {
  margin: 18px 0 0;
  font-size: 14.5px;
  font-weight: 600;
  color: #4d463f;
}

/* ---------------- RESPONSIVE ---------------- */

@media (max-width: 767px) {
  .search-container {
    padding: 32px 20px 55px;
  }

  .search-topnav {
    display: none;
  }

  .upload-card {
    padding: 32px 18px;
  }

  .upload-card .btn-primary-custom {
    width: 100%;
  }

  .vs-actions .btn-primary-custom,
  .vs-actions .btn-outline-custom {
    width: 100%;
  }

  .vs-loading-card {
    margin: 0 20px;
    padding: 32px 30px;
  }

  .product-cta {
    min-height: 40px;
  }
}
