/* Top-Matras Smart Search Dropdown — isolated for real top-matras.ru header (.search-window-wrapper) */

.search-window-wrapper {
  position: absolute;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 10020;
  pointer-events: none;
}

@media (min-width: 768px) {
  .container > .search-window-wrapper {
    position: relative !important;
    top: 0 !important;
    height: 0;
    overflow: visible !important;
    z-index: 10020;
  }
}

@media (max-width: 767px) {
  #main_container {
    padding-top: 46px !important;
  }
}

.tm-search-dropdown {
  pointer-events: auto;
  position: absolute;
  top: 6px;
  left: 0;
  width: 100%;
  max-width: 1320px;
  max-height: min(80vh, 690px);
  background: #ffffff;
  border: 1px solid #bfd7de;
  border-top: 3px solid #4a90a5;
  border-radius: 0 0 10px 10px;
  box-shadow: 0 20px 48px rgba(24, 54, 64, 0.24);
  z-index: 10025;
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 13px;
  line-height: 1.4;
  color: #1e293b;
  text-align: left;
  box-sizing: border-box;
}

.tm-search-dropdown.is-open {
  display: flex;
}

.tm-search-dropdown.tm-search-floating {
  position: fixed;
  left: 8px;
  right: 8px;
  width: auto;
  max-width: 960px;
  margin: 0 auto;
  z-index: 10050;
  border-radius: 10px;
}

/* Strict isolation against all-common.min.css rules (a underline, ul li line-height, floats) */
.tm-search-dropdown *,
.tm-search-dropdown *::before,
.tm-search-dropdown *::after {
  box-sizing: border-box;
}

.tm-search-dropdown a,
.tm-search-dropdown a:visited,
.tm-search-dropdown a:hover,
.tm-search-dropdown a:focus {
  text-decoration: none !important;
}

.tm-search-dropdown ul,
.tm-search-dropdown li {
  list-style: none !important;
  margin: 0;
  padding: 0;
  float: none !important;
  line-height: 1.35;
}

/* Top status + close bar */
.tm-sd-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 16px;
  background: #eef6f8;
  border-bottom: 1px solid #d5e5e9;
  font-size: 13px;
  color: #334155;
  flex-shrink: 0;
}

.tm-sd-status strong {
  color: #0f172a;
}

.tm-sd-typo-note {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 4px;
  background: #e3f2f6;
  color: #234955;
  font-size: 12px;
}

.tm-sd-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tm-sd-all-btn {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 6px;
  background: #4a90a5;
  color: #ffffff !important;
  font-size: 12.5px;
  font-weight: 600;
  transition: background-color 0.14s ease;
  white-space: nowrap;
}

.tm-sd-all-btn:hover,
.tm-sd-all-btn:focus-visible {
  background: #316575;
  color: #ffffff !important;
}

.tm-sd-close {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.tm-sd-close:hover {
  background: #1e293b;
  border-color: #1e293b;
  color: #ffffff;
}

/* Full-width query refinement bar (okmatras style) */
.tm-sd-refine-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  background: #ffffff;
  border-bottom: 1px solid #e2ecef;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.tm-sd-refine-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #475569;
  white-space: nowrap;
}

.tm-sd-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* High-contrast refinement chips (solid brand blue on hover, never washed-out light bg) */
.tm-sd-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid #8bbac8;
  background: #ffffff;
  color: #234955;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.14s ease, color 0.14s ease, border-color 0.14s ease;
  line-height: 1.25;
}

.tm-sd-chip:hover,
.tm-sd-chip:focus-visible {
  background: #4a90a5;
  border-color: #4a90a5;
  color: #ffffff;
}

.tm-sd-chip.is-active {
  background: #316575;
  border-color: #316575;
  color: #ffffff;
}

.tm-sd-chip.is-active:hover {
  background: #183640;
  border-color: #183640;
}

.tm-sd-chip-kind {
  font-size: 10.5px;
  font-weight: 400;
  opacity: 0.78;
}

.tm-sd-chip:hover .tm-sd-chip-kind,
.tm-sd-chip.is-active .tm-sd-chip-kind {
  opacity: 0.92;
  color: #e6f4f8;
}

/* Two-column main area */
.tm-sd-body {
  display: grid;
  grid-template-columns: 285px 1fr;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.tm-sd-sidebar {
  padding: 12px 14px;
  background: #f6fbfc;
  border-right: 1px solid #daecef;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.tm-sd-results {
  padding: 12px 16px 16px;
  background: #ffffff;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tm-sd-section-title {
  margin: 0 0 6px 0;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #475569;
}

/* Sidebar links: crisp dark text at rest, rich solid #4a90a5 blue + white text on hover */
.tm-sd-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.tm-sd-link,
.tm-sd-link:visited {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 9px;
  border-radius: 6px;
  color: #1e293b !important;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.tm-sd-link:hover,
.tm-sd-link:focus-visible {
  background: #4a90a5 !important;
  color: #ffffff !important;
}

.tm-sd-link-sub {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: #64748b;
  margin-top: 1px;
}

.tm-sd-link:hover .tm-sd-link-sub,
.tm-sd-link:focus-visible .tm-sd-link-sub {
  color: #e6f4f8 !important;
}

.tm-sd-link-meta {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #e2ecef;
  color: #334155;
  white-space: nowrap;
  flex-shrink: 0;
}

.tm-sd-link:hover .tm-sd-link-meta,
.tm-sd-link:focus-visible .tm-sd-link-meta {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.tm-sd-link mark {
  background: #fde68a;
  color: #0f172a;
  padding: 0 2px;
  border-radius: 2px;
}

.tm-sd-link:hover mark,
.tm-sd-link:focus-visible mark {
  background: rgba(255, 255, 255, 0.26);
  color: #ffffff;
}

/* Right column: 4-column product grid on 1170px desktop (matching okmatras.ru) */
.tm-sd-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.tm-sd-card,
.tm-sd-card:visited {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid #daecef;
  border-radius: 8px;
  padding: 9px;
  background: #ffffff;
  color: #1e293b !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.tm-sd-card:hover,
.tm-sd-card:focus-visible {
  border-color: #4a90a5;
  box-shadow: 0 8px 20px rgba(49, 101, 117, 0.14);
  transform: translateY(-1px);
}

.tm-sd-badge-sale {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #e85656;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  z-index: 2;
}

.tm-sd-thumb {
  width: 100%;
  height: 108px;
  border-radius: 6px;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 8px;
}

.tm-sd-thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.tm-sd-thumb-placeholder {
  font-size: 11px;
  color: #64748b;
  text-align: center;
  padding: 8px;
}

.tm-sd-card-cat {
  font-size: 11px;
  color: #64748b;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tm-sd-card-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  color: #0f172a;
  margin-bottom: 5px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tm-sd-card:hover .tm-sd-card-title {
  color: #316575;
}

.tm-sd-card-title mark {
  background: #fef08a;
  color: #0f172a;
  padding: 0 2px;
  border-radius: 2px;
}

.tm-sd-card-sizes {
  font-size: 11px;
  color: #475569;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tm-sd-price-row {
  margin-top: auto;
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}

.tm-sd-card-price {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}

.tm-sd-card-oldprice {
  font-size: 11.5px;
  color: #94a3b8;
  text-decoration: line-through;
}

.tm-sd-empty,
.tm-sd-loading {
  padding: 28px 16px;
  text-align: center;
  color: #475569;
  font-size: 13.5px;
}

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

@media (max-width: 820px) {
  .tm-search-dropdown {
    max-height: calc(100vh - 106px);
  }
  .tm-sd-header {
    padding: 8px 12px;
    font-size: 12px;
  }
  .tm-sd-refine-bar {
    padding: 8px 12px;
    flex-wrap: nowrap;
    overflow-x: auto;
  }
  .tm-sd-chips {
    flex-wrap: nowrap;
  }
  .tm-sd-chip {
    white-space: nowrap;
    flex-shrink: 0;
  }
  .tm-sd-body {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }
  .tm-sd-sidebar {
    border-right: none;
    border-bottom: 1px solid #daecef;
    overflow-y: visible;
    order: 2;
  }
  .tm-sd-results {
    overflow-y: visible;
    order: 1;
  }
  .tm-sd-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 360px) {
  .tm-sd-grid {
    grid-template-columns: 1fr;
  }
}

/* === MSPB V3 NORDIC SMART SEARCH DROPDOWN STYLING === */
.tm-search-dropdown {
  border-radius: 12px !important;
  border: 1px solid #c3dae2 !important;
  border-top: 1px solid #c3dae2 !important;
  box-shadow: 0 24px 54px rgba(18, 44, 54, 0.18) !important;
}

.tm-sd-header {
  background: #f4f9fb !important;
  border-bottom: 1px solid #ddebf0 !important;
  padding: 10px 18px !important;
}

.tm-sd-all-btn {
  border-radius: 8px !important;
  background: #3a7d91 !important;
  padding: 6px 14px !important;
}

.tm-sd-refine-bar {
  background: #fafcfd !important;
  padding: 8px 18px !important;
}

.tm-sd-chip {
  border-radius: 7px !important;
  background: #eef6f8 !important;
  border: 1px solid #cbe0e7 !important;
  color: #1c414d !important;
}

.tm-sd-chip:hover,
.tm-sd-chip.is-active {
  background: #3a7d91 !important;
  border-color: #3a7d91 !important;
  color: #ffffff !important;
}

.tm-sd-sidebar {
  background: #ffffff !important;
  border-right: 1px solid #e3eef2 !important;
}

.tm-sd-link {
  border-radius: 7px !important;
  border-left: 3px solid transparent !important;
}

.tm-sd-link:hover,
.tm-sd-link:focus-visible {
  background: #edf6f9 !important;
  color: #183640 !important;
  border-left-color: #3a7d91 !important;
}

.tm-sd-link:hover .tm-sd-count,
.tm-sd-link:focus-visible .tm-sd-count {
  background: #d8ecf2 !important;
  color: #183640 !important;
}

.tm-sd-results {
  background: #f9fcfd !important;
}

.tm-sd-card {
  border-radius: 10px !important;
  border: 1px solid #dcebef !important;
  background: #ffffff !important;
}

.tm-sd-card:hover {
  border-color: #4a90a5 !important;
  box-shadow: 0 6px 16px rgba(58, 125, 145, 0.12) !important;
}
