/* =========================================================================
   МОБИЛНИ ПОПРАВКИ
   Зарежда се последен (виж $css_files в header.php).
   Всичко е в media query – десктопът не се засяга.
   ≤ 991px – мобилно меню и панел с филтри; ≤ 767px – телефон.
   ========================================================================= */

/* Нов елемент (залепена лента „Добави в количката“ на продуктовата страница):
   извън телефон не се показва. */
.cc-sticky-buy { display: none; }


/* ------------------------------------------------------------------------
   ≤ 991px: меню, търсене, панел с филтри
   ------------------------------------------------------------------------ */
@media (max-width: 991px) {

  /* Меню: бутон ≥ 44px, фирмен светъл фон вместо розов, връзки ≥ 44px */
  .menu-toggle { flex: 0 0 44px; width: 44px; height: 44px; }

  #header .h_line_3 nav {
    background: var(--sec-color);
    border-top: 1px solid var(--border-color);
    padding: .25rem 1rem 1rem;
  }
  /* Слоган до менюто: Exo 2 (--sec-font) вместо Russo One – по-тесен и по-четлив
     на малък екран; 14px / 700 се побира на 2 реда от 320px нагоре */
  #header .h_line_3 .h3-tagline {
    font-family: var(--sec-font);
    font-size: .875rem;
    font-weight: 700;
    line-height: 1.3;
  }

  #header .h_line_3 nav ul { gap: 0; }
  #header .h_line_3 nav ul li a {
    display: block;
    min-height: 44px;
    padding: .7rem .25rem;
    line-height: 1.5;
  }
  #header .h_line_3 nav ul li + li a { border-top: 1px solid var(--border-color); }

  /* Търсене: поле и бутон ≥ 44px */
  .col-cc > form.search-form { padding: 0 4px 0 8px; }
  .search-field { min-height: 44px; }
  .search-submit { min-width: 44px; min-height: 44px; padding: 0; justify-content: center; }

  /* Бутон „Покажи филтрите“ – да изглежда като бутон */
  html body #toggle-filter.btn-2 {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    min-height: 44px;
    padding: 0 1rem;
    background: #fff;
    color: var(--main-color);
    border: 1px solid var(--main-color);
    border-radius: 6px;
    font-family: var(--sec-font);
    font-weight: 600;
  }

  /* Панел с филтри: „Покажи резултатите“ винаги видим най-долу */
  html body #klimaticy-sidebar .sf-apply {
    position: sticky;
    bottom: 0;
    z-index: 5;
    margin-top: .5rem;
    padding: .75rem 0 .25rem;
    background: #F1F6FF;
    border-top: 1px solid #DCE4F5;
  }

  /* iOS Safari приближава екрана при фокус на поле с шрифт < 16px */
  html body #klimaticy-sidebar input:not([type="checkbox"]):not([type="radio"]),
  html body #klimaticy-sidebar select,
  html body #klimaticy-sidebar textarea { font-size: 16px; }

  /* Контакти: редът „Съгласен съм с Политика за поверителност“ беше с забрана за
     пренасяне (white-space: nowrap) и на таблет (768–820px) беше по-широк от
     колоната – разширяваше формата и я режеше вдясно. */
  #contacts-page #contact_form .privacy-col label { white-space: normal; min-width: 0; }
}


/* ------------------------------------------------------------------------
   ≤ 767px: телефон
   ------------------------------------------------------------------------ */
@media (max-width: 767px) {

  /* Заглавия: line-height 60px правеше огромна дупка при пренасяне */
  h1.title { line-height: 1.25; }

  /* Полета за подредба/страниране ≥ 16px (без приближаване в iOS) */
  .form-select-sm,
  .form-control-sm { font-size: 16px; }

  /* Хедър: по-компактен – лого и търсене на един ред, по-тясна телефонна лента
     (преди заемаше ~31% от височината на екрана) */
  #header.clearfix #header-line-1 .h_line_1 .container span.font.h-tel { padding: .6rem 0; }
  #header.clearfix #header-line-1 .h_line_1 .container span.font.h-tel strong { font-size: 1.75rem; }
  /* .container в селектора е нужен – header.css има `.container .row-cst { gap: 0 }` и иначе печели */
  #header .h_line_2 .container .row-cst { flex-direction: row; align-items: center; gap: 14px; }
  /* Иконите (любими/количка) вдясно с отстъп от търсачката; на страниците без икони
     (Количка/Плащане) контейнерът е празен и не оставя празно място – търсачката
     стига до десния ръб, подравнена с бутона на менюто */
  #header-icons { padding-left: 0; gap: 0; }
  #header-icons .headet-ico { margin-left: 14px; }
  #header .h_line_2 .col-aa { flex: 0 0 72px; max-width: 72px; padding-right: 0; }
  #header .h_line_2 .col-bb { display: none; } /* празна колона (заглавията в нея са скрити), заемаше място между логото и търсенето */
  #header .h_line_2 .col-cc { flex: 1 1 0; width: auto; min-width: 0; }
  #header #header-line-1 .h_line_2 .col-cc { margin-top: 0; }

  /* „Сервиз“: ценоразписът и въпросите като карти – без хоризонтален скрол,
     цената вече не се отрязва вдясно */
  body.page-template-tmp-Service .table-responsive { overflow-x: visible; }
  body.page-template-tmp-Service .table-responsive > table,
  body.page-template-tmp-Service .table-responsive > table > tbody { display: block; width: 100%; border: 0; }
  body.page-template-tmp-Service .table-responsive > table tr {
    display: block;
    margin-bottom: .75rem;
    border: 1px solid var(--border-color);
  }
  body.page-template-tmp-Service .table-responsive > table th,
  body.page-template-tmp-Service .table-responsive > table td {
    display: block;
    width: 100% !important;
    border: 0;
  }
  body.page-template-tmp-Service .table-responsive > table th { border-bottom: 1px solid var(--border-color); }
  body.page-template-tmp-Service .table-responsive > table td > :last-child { margin-bottom: 0; }

  /* „Други“: вложеният .row без контейнер излизаше извън екрана (+12px скрол) */
  #other-products-list .col-md-12 > .row { margin-left: 0; margin-right: 0; }
  #other-products-list .col-md-12 > .row > .col-12 { padding-left: 0; padding-right: 0; }
  #other-products-list .col-md-12 { padding-left: .75rem !important; padding-right: .75rem !important; }

  /* Breadcrumb: да се пренася на няколко реда. На продукта беше на един ред с
     скрит хоризонтален скрол и името на продукта се губеше вдясно. */
  .breadcrumb { flex-wrap: wrap; row-gap: .25rem; }
  html body nav[aria-label="breadcrumb"] { overflow-x: visible; }
  html body nav[aria-label="breadcrumb"] .breadcrumb { flex-wrap: wrap; white-space: normal; row-gap: .25rem; }
  html body nav[aria-label="breadcrumb"] .breadcrumb-item { white-space: normal; flex: 0 1 auto; }

  /* ---- Тап-цели ≥ 44px ---- */

  /* Филтър на началната страница: чекбоксове и етикети */
  #filters-form .form-check {
    display: flex;
    align-items: center;
    gap: .5rem;
    min-height: 44px;
    margin-right: 0;
    padding-left: 0;
  }
  #filters-form .form-check .form-check-input {
    float: none;
    flex: 0 0 24px;
    width: 24px;
    height: 24px;
    margin: 0;
  }

  /* „Включен монтаж“ (количка, продукт) и аксесоари */
  .installation-toggle,
  .aks-toggle { flex: 0 0 22px; width: 22px; height: 22px; margin: 0 .5rem 0 0; }
  .installation-label,
  .cart-standing { display: flex; align-items: center; min-height: 44px; }

  /* Футър: връзките са на ~19px височина и опрени една в друга */
  footer .cont-hover-line a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }

  /* Карти: бутоните долу */
  .shop-card .btns .btn { min-height: 44px; }

  /* Карти: показването на характеристиките (hover) не е очевидно на тъчскрийн */
  .shop-card.card-air-conditioning .cc-imgbox { position: relative; }
  .shop-card.card-air-conditioning .cc-imgbox::after {
    content: "Докоснете за характеристики";
    position: absolute;
    left: 6px;
    bottom: 4px;
    padding: 2px 8px;
    background: rgba(255, 255, 255, .92);
    border: 1px solid var(--border-color);
    color: #555;
    font-family: var(--sec-font);
    font-size: .72rem;
    font-weight: 600;
    line-height: 1.4;
    pointer-events: none;
  }

  /* Продукт: „Сравни“, „Бърза поръчка“, любими */
  .prices p a,
  .prices .favorite-toggle {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 .5rem;
  }

  /* Поръчка: разстояние между полетата, по-големи полета и етикети */
  #checkout-form .row > [class*="col-md-"] + [class*="col-md-"] { margin-top: .75rem; }
  #checkout-form label { display: block; margin-bottom: .25rem; font-weight: 600; }
  #checkout-form .form-control { min-height: 44px; }

  /* Продукт: залепена лента „Добави в количката“ (създава се от скрипт в
     single-air_conditioners.php, показва се след като основният бутон е
     останал над екрана) */
  body.single-air_conditioners { padding-bottom: 64px; }
  .cc-sticky-buy {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1030;
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem .75rem calc(.6rem + env(safe-area-inset-bottom, 0px));
    background: #fff;
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -4px 14px rgba(0, 0, 0, .12);
    transform: translateY(110%);
    transition: transform .25s ease;
  }
  .cc-sticky-buy.is-visible { transform: none; }
  .cc-sticky-buy__price {
    font-family: var(--sec-font);
    font-size: 1.25rem;
    font-weight: 700;
    white-space: nowrap;
  }
  .cc-sticky-buy .btn { flex: 1 1 auto; min-height: 44px; }

  /* Количка (чекмедже): докато е отворено, страницата отзад не се скролира
     (иначе целият интерфейс „бяга“ при плъзгане), а скролът в чекмеджето не се
     прехвърля към страницата, когато стигне края */
  html:has(#top-cart-cnt.cart-visible),
  body:has(#top-cart-cnt.cart-visible) { overflow: hidden; }
  #top-cart-cnt #cart-container { overscroll-behavior: contain; }
  #cart-overlay { touch-action: none; }

  /* Чекмедже: „Включен монтаж“ (и аксесоарите) на цял ред под името/количеството/
     цената, вместо да се пренасят в тясната колона на името */
  #top-cart-cnt .cart-item .ci-main { display: contents; }
  #top-cart-cnt .cart-item .ci-main > a { grid-column: 1; grid-row: 1; min-width: 0; }
  #top-cart-cnt .cart-item > input.cart-qty { grid-column: 2; grid-row: 1; }
  #top-cart-cnt .cart-item > .ci-price { grid-column: 3; grid-row: 1; }
  #top-cart-cnt .cart-item > button.remove-from-cart { grid-column: 4; grid-row: 1; }
  #top-cart-cnt .cart-item .installation-label { grid-column: 1 / -1; grid-row: 2; white-space: nowrap; }
  #top-cart-cnt .cart-item .accessories-list { grid-column: 1 / -1; grid-row: 3; }

  /* Страница „Количка“: „Включен монтаж“ (и аксесоарите) центрирани като останалото
     в картата; цените с една стъпка по-малки (24px → 20px) */
  #page-shopping-cart .shopping-cart .cart-table .row.cart-row .cart-title label.installation-label {
    justify-content: center;
    text-align: center;
  }
  #page-shopping-cart .shopping-cart .cart-table .row.cart-row .cart-title .accessories-list .accessory-item { justify-content: center; }
  #page-shopping-cart .shopping-cart .cart-table .cart-row > .cart-price,
  #page-shopping-cart .shopping-cart .cart-table .cart-row > .cart-item-total { font-size: 1.25rem; }
  #page-shopping-cart .shopping-cart .cart-table .cart-row > .cart-item-total::before { font-size: 1.65rem; }

  /* Страница „Количка“, суми: Цена / Монтаж / Аксесоари на един ред, „Общо“ болд
     отдолу, всичко (и бутонът „Поръчай“) центрирано. Редът се пренася само ако
     екранът е изключително тесен. */
  #page-shopping-cart .shopping-cart .cart-total { justify-content: center !important; }
  #page-shopping-cart .shopping-cart .cart-total .text-right {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: baseline;
    column-gap: .5rem;
    row-gap: .25rem;
    text-align: center;
  }
  #page-shopping-cart .shopping-cart .cart-total .text-right p { margin: 0; font-size: .9375rem; white-space: nowrap; }
  #page-shopping-cart .shopping-cart .cart-table .cart-total > div p strong { font-size: inherit; }
  #page-shopping-cart .shopping-cart .cart-total .text-right p:last-child {
    flex: 0 0 100%;
    margin-top: .5rem;
    padding-top: .5rem;
    border-top: 1px solid var(--border-color);
    font-size: 1.25rem;
    font-weight: 700;
  }
}

@media (max-width: 359px) {
  #page-shopping-cart .shopping-cart .cart-total .text-right { column-gap: .35rem; }
  #page-shopping-cart .shopping-cart .cart-total .text-right p { font-size: .8125rem; }
  #page-shopping-cart .shopping-cart .cart-total .text-right p:last-child { font-size: 1.125rem; }
}
