/* ===== Продуктов грид и елементи ===== */

/* Телефони ≤ 768px */
@media (max-width: 768px) {

  /* Грид с продукти – 2 колони */
  .products {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
    padding: 10px 12px 40px;
  }

  .product {
    padding: 12px;
  }

  .product h3 {
    font-size: 15px;
    line-height: 1.25;
  }

  .product .price {
    font-size: 14px;
  }

  .product input,
  .product button {
    font-size: 14px;
  }
}

/* Малки телефони ≤ 480px */
@media (max-width: 480px) {

  /* Грид с продукти – 1–2 тесни колони */
  .products {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    padding: 10px 10px 36px;
  }

  .modal-content {
    width: min(92vw, 520px);
    padding: 22px;
  }
}

/* === Центриране и визия на продуктови карти и снимки === */
.product {
  display: flex;
  flex-direction: column;
  align-items: center; /* центрира хоризонтално */
  justify-content: flex-start;
}

.product img {
  width: 80%;
  height: auto; /* без фиксирана височина */
  aspect-ratio: 3 / 4; /* стабилни карти */
  object-fit: contain; /* показвай снимката цялата */
  border-radius: 6px;
  background-color: #111;
  margin-bottom: 15px;
  transition: transform 0.2s ease-in-out;
  cursor: pointer;
}

.product img:hover {
  transform: scale(1.02);
}

/* Защита от стари правила в други файлове/медии */
@media (max-width: 480px) {
  .product img {
    height: auto !important;
    object-fit: contain !important;
    max-height: 260px; /* ограничение на височина */
  }
}

/* ===== Попъп описание – подравняване като началната страница ===== */
#modal-product .modal-content #popup-desc {
  text-align: justify;
  text-justify: inter-word;
  text-align-last: left;
  line-height: 1.6;
  hyphens: auto;
  -webkit-hyphens: auto;
  -ms-hyphens: auto;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

/* Червен цвят само за опцията „Пподаръкоция“ в десктоп селекта */
#sort-select option[value="promo"]{
  color:#ff3b3b;
  font-weight:700;
}

/* Когато е избрана „Пподаръкоция“, оцвети самия select */
#sort-select.is-promo{
  color:#ff3b3b;
  font-weight:700;
}

/* мобилните sort бутони са дефинирани основно в za-deteto.html */
/* подсилваме само следното за всеки случай */
.mobile-sort .sort-btn.promo-btn {
  color:#ff3b3b;
  border:1px solid #ff3b3b;
  font-weight:700;
}

/* Хедър мобилно поведение (за продуктови страници) */
@media (max-width: 900px){
  header{
    position: fixed;
    top:0;
    left:0;
    right:0;
    z-index: 9999;
  }

  body{
    padding-top: 70px;
  }

  header{
    display:flex;
    align-items:center;
    justify-content:space-between;
    flex-wrap:wrap;
  }

  header .logo{
    position:absolute;
    left:50%;
    transform:translateX(-50%);
    top:6px;
  }

  header .site-logo{
    max-height:60px;
  }

  header nav{
    width:100%;
    margin-top:56px;
    display:flex;
    gap:12px;
    justify-content:flex-end;
    flex-wrap:wrap;
  }
}
/* Контейнерът на инфо-попъпите (Доставка, Плащане, За нас, Контакти) */
.modal-content.info-modal-content {
    max-width: 700px;
    text-align: left; /* насилваме да не е center */
    line-height: 1.5;

    max-height: 80vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

/* Заглавието */
.modal-content.info-modal-content h2 {
    text-align: center;
    color: #003366; /* дръж го един и същи цвят навсякъде */
    font-size: 1.6rem;
    font-weight: 600;
    margin-bottom: 20px;
}

/* Абзаците */
.modal-content.info-modal-content p {
    text-align: fustify; /* или left, ако искаш варианта от снимка 1 */
    line-height: 1.5;
    margin: 0 16px 16px 16px; /* въздух между абзаците и отстрани */
    white-space: normal;
    color: #fff;
}

/* Бутон "Затвори" */
.modal-content.info-modal-content button {
    display: block;
    margin: 24px auto 0; /* център */
}


/* Global search dropdown (used on category pages) */
.search-wrap{ position: relative; }
#search-results{
  position:absolute;
  top:calc(100% + 6px);
  left:0;
  right:0;
  z-index:9999;
  background:#e4c274;
  border:1px solid #333;
  border-radius:8px;
  max-height:320px;
  overflow-y:auto;
  text-align:left;
  display:none;
}
#search-results .sr-item{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px;
  border-bottom:1px solid rgba(0,0,0,0.12);
}
#search-results .sr-item:hover{ background:rgba(0,0,0,0.06); }
#search-results .sr-item img{
  width:40px; height:40px;
  object-fit:contain;
  border-radius:6px;
  background:rgba(255,255,255,0.35);
}
#search-results .sr-empty{
  text-align:center;
  padding:14px;
  color:#111111;
  opacity:0.75;
}
