/* ============================================================
   SMART SEARCH
   ============================================================ */

.smart-search-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s ease,
    visibility 0.2s ease;
}

.smart-search-overlay.is-open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

/* ============================================================
   BACKDROP
   ============================================================ */

.smart-search-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.68);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* ============================================================
   PAGE LOCK
   ============================================================ */

.smart-search-body-open {
  overflow: hidden !important;
}

/* ============================================================
   WRAPPER
   ============================================================ */

.smart-search-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  padding-top: 40px;
  padding-bottom: 40px;
  overflow-y: auto;
}

/* ============================================================
   SEARCH BOX
   ============================================================ */

.smart-search-box {
  position: relative;
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

/* ============================================================
   HEADER
   ============================================================ */

.smart-search-header {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 76px;
  padding: 14px 18px;
  border-bottom: 1px solid #e5e7eb;
  background: #ffffff;
}

.smart-search-input-wrapper {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.smart-search-icon {
  position: absolute;
  left: 17px;
  top: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translateY(-50%);
  color: #64748b;
  pointer-events: none;
}

.smart-search-input {
  width: 100%;
  height: 50px;
  padding: 0 52px;
  border: 1px solid #d8dee8;
  border-radius: 9px;
  outline: none;
  background: #f8fafc;
  color: #172033;
  font-size: 16px;
  line-height: 50px;
  box-shadow: none;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease;
}

.smart-search-input:focus {
  border-color: #94a3b8;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(100, 116, 139, 0.12);
}

.smart-search-input::-webkit-search-cancel-button {
  display: none;
}

.smart-search-spinner {
  position: absolute;
  right: 17px;
  top: 50%;
  width: 19px;
  height: 19px;
  margin-top: -9.5px;
  border: 2px solid #dbe2ea;
  border-top-color: #475569;
  border-radius: 50%;
  opacity: 0;
  visibility: hidden;
  animation: smart-search-spin 0.75s linear infinite;
}

.smart-search-spinner.is-visible {
  opacity: 1;
  visibility: visible;
}

@keyframes smart-search-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ============================================================
   CLOSE
   ============================================================ */

.smart-search-close {
  width: 50px;
  height: 50px;
  flex: 0 0 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid #d8dee8;
  border-radius: 9px;
  background: #ffffff;
  color: #475569;
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease;
}

.smart-search-close:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #0f172a;
}

.smart-search-close svg {
  display: block;
}

/* ============================================================
   RESULTS BODY
   ============================================================ */

.smart-search-results {
  display: flex;
  width: 100%;
  min-height: 430px;
  max-height: calc(100vh - 170px);
  overflow: hidden;
}

/* ============================================================
   SIDEBAR
   ============================================================ */

.smart-search-sidebar {
  width: 33.333333%;
  flex: 0 0 33.333333%;
  padding: 24px 22px;
  border-right: 1px solid #e5e7eb;
  background: #fbfcfe;
  overflow-y: auto;
}

.smart-search-section {
  margin-bottom: 28px;
}

.smart-search-section:last-child {
  margin-bottom: 0;
}

.smart-search-section-title {
  margin-bottom: 10px;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.3;
  text-transform: uppercase;
}

.smart-search-link-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.smart-search-sidebar-link {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 9px;
  border-radius: 7px;
  color: #334155;
  text-decoration: none !important;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}

.smart-search-sidebar-link:hover {
  background: #eef2f7;
  color: #0f172a;
}

.smart-search-sidebar-link-icon {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 9px;
  border-radius: 6px;
  background: #ffffff;
  color: #64748b;
}

.smart-search-sidebar-link-text {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
}

.smart-search-arrow {
  margin-left: 8px;
  color: #94a3b8;
  font-size: 21px;
  line-height: 1;
}

.smart-search-popular-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.smart-search-popular {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #ffffff;
  color: #475569;
  font-size: 12px;
  line-height: 1.2;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    color 0.15s ease;
}

.smart-search-popular:hover {
  border-color: #cbd5e1;
  background: #f1f5f9;
  color: #0f172a;
}

.smart-search-popular-icon {
  display: flex;
  align-items: center;
}

/* ============================================================
   PRODUCTS
   ============================================================ */

.smart-search-products {
  width: 66.666667%;
  flex: 0 0 66.666667%;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #ffffff;
  overflow-y: auto;
}

.smart-search-products-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  padding: 18px 24px 10px;
}

.smart-search-results-title {
  color: #0f172a;
  font-size: 15px;
  font-weight: 700;
}

.smart-search-results-count {
  color: #94a3b8;
  font-size: 12px;
}

.smart-search-product-list {
  display: flex;
  flex-direction: column;
  padding: 0 24px 10px;
}

/* ============================================================
   PRODUCT CARD
   ============================================================ */

.smart-search-product-card {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 94px;
  padding: 11px 4px;
  border-bottom: 1px solid #edf0f4;
  color: inherit;
  text-decoration: none !important;
  transition:
    background 0.15s ease,
    transform 0.15s ease;
}

.smart-search-product-card:last-child {
  border-bottom: 0;
}

.smart-search-product-card:hover {
  background: #fafbfc;
}

.smart-search-product-image {
  width: 76px;
  height: 76px;
  flex: 0 0 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 15px;
  overflow: hidden;
  border-radius: 7px;
  background: #f8fafc;
}

.smart-search-product-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.smart-search-product-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: #cbd5e1;
}

.smart-search-product-content {
  flex: 1;
  min-width: 0;
  padding-right: 15px;
}

.smart-search-product-manufacturer {
  margin-bottom: 2px;
  color: #94a3b8;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1.2;
  text-transform: uppercase;
}

.smart-search-product-name {
  overflow: hidden;
  color: #1e293b;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.smart-search-product-category {
  margin-top: 4px;
  overflow: hidden;
  color: #64748b;
  font-size: 11px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.smart-search-product-reference {
  margin-top: 3px;
  color: #94a3b8;
  font-size: 10px;
  line-height: 1.3;
}

.smart-search-product-price {
  flex: 0 0 auto;
  color: #0f172a;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

/* ============================================================
   HIGHLIGHT
   ============================================================ */

.smart-search-highlight {
  padding: 1px 2px;
  border-radius: 2px;
  background: #fff3b8;
  color: inherit;
  font-weight: 700;
}

/* ============================================================
   VIEW ALL
   ============================================================ */

.smart-search-view-all {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 10px 24px 24px;
  padding: 12px 16px;
  border: 1px solid #dbe2ea;
  border-radius: 7px;
  color: #334155;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none !important;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}

.smart-search-view-all:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #0f172a;
}

/* ============================================================
   NO RESULTS
   ============================================================ */

.smart-search-no-results {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 260px;
  padding: 30px;
  text-align: center;
}

.smart-search-no-results-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 74px;
  height: 74px;
  margin-bottom: 17px;
  border-radius: 50%;
  background: #f8fafc;
  color: #94a3b8;
}

.smart-search-no-results h3 {
  margin: 0 0 7px;
  color: #334155;
  font-size: 17px;
  font-weight: 700;
}

.smart-search-no-results p {
  max-width: 380px;
  margin: 0;
  color: #94a3b8;
  font-size: 13px;
  line-height: 1.5;
}

/* ============================================================
   ERROR
   ============================================================ */

.smart-search-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 250px;
  padding: 30px;
  color: #64748b;
  text-align: center;
}

.smart-search-error-icon {
  margin-bottom: 12px;
  color: #94a3b8;
}

.smart-search-error strong {
  display: block;
  margin-bottom: 4px;
  color: #334155;
  font-size: 15px;
}

.smart-search-error span {
  font-size: 13px;
}

/* ============================================================
   SCROLLBARS
   ============================================================ */

.smart-search-sidebar::-webkit-scrollbar,
.smart-search-products::-webkit-scrollbar {
  width: 7px;
}

.smart-search-sidebar::-webkit-scrollbar-track,
.smart-search-products::-webkit-scrollbar-track {
  background: transparent;
}

.smart-search-sidebar::-webkit-scrollbar-thumb,
.smart-search-products::-webkit-scrollbar-thumb {
  border-radius: 10px;
  background: #dbe2ea;
}

/* ============================================================
   SEARCH CORRECTION
   ============================================================ */

#smart-search-search-correction {
  padding: 1rem;
  padding-bottom: 0px;
}

.smart-search-correction {
  margin-bottom: 18px;
  padding: 12px 16px;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  background: #fafafa;
}

.smart-search-correction-main {
  display: flex;
  align-items: baseline;
  gap: 5px;
  flex-wrap: wrap;
}

.smart-search-correction-label {
  font-size: 14px;
  color: #666;
}

.smart-search-correction-query {
  font-size: 14px;
  color: #222;
}

.smart-search-correction-original {
  display: inline-block;
  margin: 4px 0 0;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 13px;
  color: #666;
  cursor: pointer;
  text-align: left;
}

.smart-search-correction-original:hover {
  color: #222;
  text-decoration: underline;
}

.smart-search-correction-original strong {
  font-weight: 500;
}

/* ============================================================
   TABLET
   ============================================================ */

@media (max-width: 1199px) {
  .smart-search-box {
    max-width: calc(100% - 30px);
  }

  .smart-search-wrapper {
    padding-top: 25px;
  }
}

/* ============================================================
   MOBILE
   ============================================================ */

@media (max-width: 991px) {
  .smart-search-wrapper {
    padding: 15px;
  }

  .smart-search-box {
    max-width: 100%;
    border-radius: 11px;
  }

  .smart-search-results {
    display: block;
    max-height: calc(100vh - 68px);
    overflow-y: auto;
  }

  .smart-search-sidebar {
    width: 100%;
    padding: 18px;
    border-right: 0;
    border-bottom: 1px solid #e5e7eb;
    overflow: visible;
  }

  .smart-search-products {
    width: 100%;
    overflow: visible;
  }

  .smart-search-product-list {
    padding: 0 18px 10px;
  }

  .smart-search-products-header {
    padding-left: 18px;
    padding-right: 18px;
  }

  .smart-search-view-all {
    margin-left: 18px;
    margin-right: 18px;
  }
}

/* ============================================================
   SMALL MOBILE
   ============================================================ */

@media (max-width: 575px) {
  .smart-search-wrapper {
    padding: 0;
  }

  .smart-search-box {
    min-height: 100vh;
    border-radius: 0;
  }

  .smart-search-header {
    min-height: 68px;
    padding: 10px;
  }

  .smart-search-input {
    height: 46px;
    padding-left: 45px;
    padding-right: 43px;
    font-size: 15px;
    line-height: 46px;
  }

  .smart-search-close {
    width: 46px;
    height: 46px;
    flex-basis: 46px;
  }

  .smart-search-sidebar {
    padding: 15px;
  }

  .smart-search-product-list {
    padding-left: 15px;
    padding-right: 15px;
  }

  .smart-search-products-header {
    padding-left: 15px;
    padding-right: 15px;
  }

  .smart-search-product-image {
    width: 62px;
    height: 62px;
    flex-basis: 62px;
    margin-right: 11px;
  }

  .smart-search-product-name {
    font-size: 13px;
  }

  .smart-search-product-category {
    font-size: 10px;
  }

  .smart-search-product-reference {
    display: none;
  }

  .smart-search-product-price {
    font-size: 13px;
  }

  .smart-search-view-all {
    margin-left: 15px;
    margin-right: 15px;
  }
}

/* ==============================
   SEARCH - DESKTOP
   ============================== */

.search {
  padding-left: 129px;
  margin-left: auto;
  position: relative;
  width: 100%;
}

.search form {
  flex: 1;
  display: flex;
}

.search input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 6px 0 0 6px;
  outline: none;
}

.search input:focus {
  border-color: var(--bs-primary);
  box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.15);
}

.search button[type='submit'] {
  background: var(--bs-primary);
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 0 6px 6px 0;
  cursor: pointer;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.search-toggle {
  display: none;
  background: none;
  border: none;
  padding: 0px;
  cursor: pointer;
  /* color: var(--bs-primary); */
}

.search-close {
  display: none;
}

/* ==============================
   MOBILE
   ============================== */

@media (max-width: 768px) {
  .search {
    grid-area: search;

    width: auto;

    padding-left: 0;

    position: static;
  }

  .search-widget {
    display: none;
  }

  .search-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.375rem;
  }
}
