/* Захищає картку від непропорційних або надто великих фото з фідів магазинів. */
.product-image {
  position: relative;
  padding: 14px;
}

.product-image img {
  position: absolute;
  inset: 14px;
  width: calc(100% - 28px);
  height: calc(100% - 28px);
  max-width: none;
  max-height: none;
  object-fit: contain !important;
  object-position: center;
}

/* Попередній перегляд користувацького фото: показуємо весь кадр, не обрізаючи його. */
.upload img {
  object-fit: contain;
  object-position: center;
}

/* Після вибору фото перетворюємо зону завантаження на чисте прев'ю. */
#photo-panel.has-preview {
  display: grid;
  grid-template-columns: minmax(0, 320px) max-content;
  align-items: center;
  justify-content: center;
  gap: 18px;
}

/* Атрибут hidden має пріоритет, коли користувач перемикається на пошук за описом. */
#photo-panel[hidden] { display: none !important; }

/* Базовий стиль кнопок задає display:flex, тому hidden підсилюємо явно. */
nav a[hidden],
.catalog-actions button[hidden] { display: none !important; }

#photo-panel.has-preview .upload {
  width: 320px;
  min-height: 320px;
  border-style: solid;
  border-color: var(--line);
  background: #f1f2eb;
}

#photo-panel.has-preview .upload > span,
#photo-panel.has-preview .upload > strong,
#photo-panel.has-preview .upload > small {
  display: none;
}

#photo-panel.has-preview .upload img {
  padding: 12px;
  background: #f1f2eb;
}

.change-photo {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  color: var(--ink);
  padding: 11px 15px;
  font-weight: 750;
  white-space: nowrap;
}

#photo-panel.has-preview #photo-search {
  grid-column: 1 / -1;
  justify-self: center;
}

/* Окремий режим пошуку товарів, схожих на обрану картку. */
.similar-mode .heading,
.similar-mode .tabs,
.similar-mode #photo-panel,
.similar-mode #text-panel {
  display: none !important;
}

.similar-context {
  max-width: 760px;
  margin: 0 auto 18px;
  text-align: left;
}

.similar-source {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--white);
}

.similar-source-image {
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  overflow: hidden;
  border-radius: 12px;
  background: #eef0e8;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.similar-source-image img { width: 100%; height: 100%; object-fit: contain; }
.similar-source-copy .eyebrow { margin-bottom: 4px; }
.similar-source-copy h3 { margin: 0; font-size: 18px; }
.similar-source-name { margin: 3px 0 0; color: var(--muted); font-size: 14px; }
.similar-source-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 9px; }
.similar-return { display: flex; margin: 14px auto 0; border: 1px solid var(--line); border-radius: 999px; background: var(--white); padding: 9px 12px; color: var(--ink); font-weight: 750; white-space: nowrap; }

.header-actions { display: flex; align-items: center; gap: 12px; }
.telegram-link { color: #4d6f35; font-size: 14px; font-weight: 750; }
.telegram-hero { display: block; width: fit-content; margin-top: 16px; color: #d8ee45; font-size: 14px; font-weight: 750; }
.contact-email, .telegram-contact { display: block; width: fit-content; margin-top: 13px; color: #fff; font-weight: 750; }
.telegram-contact { color: var(--lime); }

/* Стримані жовті акценти на темному hero та у блоці для магазинів. */
.hero .eyebrow,
.telegram-hero { color: #e8dc82; }
.partners { background: #e8dfa0; }
.partners .eyebrow { color: #625b31; }
.partners > div > p:not(.eyebrow) { color: #4c4a37; }

.footer-legal { margin-left: auto; color: #4d6f35; font-weight: 700; }
.footer-links { display: flex; gap: 16px; margin-left: auto; color: #4d6f35; font-weight: 700; }
.similar { border: 0; background: none; color: #4d6f35; font-weight: 750; font-size: 12px; padding: 0; display: block; margin-top: 10px; text-align: left; }
.search-navigation { flex-wrap: wrap; justify-content: center; gap: 12px; }
.search-navigation .load-more { background: #edf2e5; }
.search-pages { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }
.search-pages span { color: #62706a; font-weight: 700; }
.search-pages button.active { background: var(--lime); border-color: var(--line); color: var(--ink); font-weight: 850; }
.pagination .current-page { background: var(--lime); border: 1px solid var(--line); border-radius: 999px; color: var(--ink); font-weight: 850; padding: 6px 11px; }
.sort-control { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 700; }
.sort-control select { border: 1px solid var(--line); border-radius: 9px; padding: 8px; background: var(--white); color: var(--ink); }

/* Підбір лампочки: компактні фільтри, доступні лише для наявних товарів. */
.lamp-filters {
  margin: 4px 0 22px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f1f2eb;
  text-align: left;
}

.lamp-filter-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 15px;
}

.lamp-filter-heading b { display: block; font-size: 17px; }
.lamp-filter-heading span { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; }

.lamp-filter-clear {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: #4d6f35;
  font-weight: 750;
  text-decoration: underline;
  cursor: pointer;
}

.lamp-filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px 22px;
}

.lamp-filter-group { min-width: 0; margin: 0; padding: 0; border: 0; }
.lamp-filter-group legend { margin-bottom: 7px; color: var(--muted); font-size: 13px; font-weight: 800; }
.lamp-filter-options { display: flex; flex-wrap: wrap; gap: 6px; }

.lamp-filter {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  color: var(--ink);
  padding: 7px 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.15;
  cursor: pointer;
}

.lamp-filter small { margin-left: 3px; color: var(--muted); font-size: 11px; font-weight: 700; }
.lamp-filter.active { border-color: var(--ink); background: var(--lime); }
.lamp-filter.active small { color: var(--ink); }

@media (max-width: 760px) {
  #photo-panel.has-preview { grid-template-columns: minmax(0, 1fr); }
  #photo-panel.has-preview .upload { width: min(100%, 320px); min-height: 320px; margin: 0 auto; }
  #photo-panel.has-preview .change-photo { justify-self: center; }
  .similar-source { grid-template-columns: 72px minmax(0, 1fr); gap: 11px; padding: 11px; }
  .similar-source-image { width: 72px; height: 72px; }
  .similar-source-copy h3 { font-size: 16px; }
  .similar-source-name { font-size: 12px; }
  .sort-control { justify-content: center; margin: 10px auto 0; }
  .lamp-filters { padding: 14px; }
  .lamp-filter-grid { grid-template-columns: 1fr; gap: 14px; }
  .lamp-filter-heading { align-items: flex-start; }
  .header-actions { gap: 8px; }
  .telegram-link { display: none; }
  .footer-legal, .footer-links { margin: 6px 0 0; }
}
