/* 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: 1170px;
  max-height: min(80vh, 690px);
  background: #ffffff;
  border: 1px solid #b9d2e8;
  border-top: 3px solid #3885b4;
  border-radius: 0 0 10px 10px;
  box-shadow: 0 20px 48px rgba(13, 38, 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: #eef4fa;
  border-bottom: 1px solid #d8e5f2;
  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: #dbeafe;
  color: #1e40af;
  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: #2b7db9;
  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: #185787;
  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 #e2ebf5;
  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 #8ab8dc;
  background: #ffffff;
  color: #144b7a;
  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: #2b7db9;
  border-color: #2b7db9;
  color: #ffffff;
}

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

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

.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: #e0f2fe;
}

/* 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: #f7fafd;
  border-right: 1px solid #dce7f3;
  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 #2b7db9 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: #2b7db9 !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: #e0f2fe !important;
}

.tm-sd-link-meta {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #e2ecf6;
  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 #dce5ef;
  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: #2b7db9;
  box-shadow: 0 8px 20px rgba(24, 87, 135, 0.14);
  transform: translateY(-1px);
}

.tm-sd-badge-sale {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #e11d48;
  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: #185787;
}

.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 #dce7f3;
    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;
  }
}
