/*
 * Custom code goes here.
 * A template should always ship with an empty custom.css
 */

/* ── iqitsearch ─────────────────────────────────────────────────────────── */
.autocomplete-suggestion .search-brand {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
    line-height: 1.2;
    margin-bottom: 1px;
}
.autocomplete-suggestion + .autocomplete-suggestion {
    border-top: 1px solid #e8e8e8;
}
.autocomplete-suggestions {
    max-height: 420px;
}

/* ── Дерево категорий (ps_categorytree) ──────────────────────────────── */
.block-categories {
    background: #fff;
    border: 1px solid #e3e3e3;
    border-radius: 4px;
    padding: 1rem;
}
.block-categories .categ-header {
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
    border-bottom: 2px solid #e3e3e3;
}
.block-categories .categ-header-back {
    display: block;
    font-size: 0.7rem;
    color: #999;
    text-decoration: none !important;
    letter-spacing: 0.02em;
    margin-bottom: 0.2rem;
    transition: color 0.15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.block-categories .categ-header-back:hover { color: #1a7aba; }
.block-categories .categ-header-title {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    color: #2e2323;
    text-decoration: none !important;
    letter-spacing: 0.03em;
    line-height: 1.3;
    transition: color 0.15s;
}
.block-categories .categ-header-title:hover { color: #1a7aba; }
.block-categories ul.tree { list-style: none; padding: 0; margin: 0; }
.block-categories ul.tree li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: 0;
    margin: 0;
}
.block-categories ul.tree a {
    flex: 1;
    min-width: 0;
    order: 1;
    display: block;
    padding: 0.3rem 0.4rem 0.3rem 0;
    color: #2e2323;
    font-size: 0.875rem;
    text-decoration: none !important;
    line-height: 1.4;
    transition: color 0.15s;
    border-radius: 3px;
}
.block-categories ul.tree a:hover { color: #1a7aba; }
.block-categories ul.tree a.selected { color: #1a7aba; font-weight: 600; }
.block-categories ul.tree li > ul { order: 3; flex-basis: 100%; }
.block-categories ul.tree ul {
    list-style: none;
    padding: 0;
    margin: 0 0 0 0.75rem;
    border-left: 1px solid #e3e3e3;
}
.block-categories ul.tree ul a { font-size: 0.8125rem; padding-left: 0.5rem; color: #555; }
.block-categories ul.tree ul ul a { font-size: 0.8rem; color: #636363; }
.block-categories ul.tree span.grower {
    position: static;
    order: 2;
    flex-shrink: 0;
    width: 1.4rem;
    height: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: #f4f4f4;
    border: 1px solid #d6d6d6;
    border-radius: 3px;
    color: #695c52;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
    user-select: none;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.block-categories ul.tree span.grower:hover {
    background: #1a7aba;
    border-color: #1a7aba;
    color: #fff;
}
.block-categories ul.tree span.grower.OPEN::before  { content: '−'; }
.block-categories ul.tree span.grower.CLOSE::before { content: '+'; }
.block-categories ul.tree > li + li { border-top: 1px solid #f0f0f0; }

/* ── Контакты / мессенджеры ──────────────────────────────────────────── */
.contact-rich .part { display: flex; }
.messenger-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 200px;
}
.ms-btn {
    display: flex;
    align-items: center;
    padding: 8px 15px;
    border-radius: 4px;
    color: #fff !important;
    text-decoration: none !important;
    font-size: 14px;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.1);
    transition: 0.3s;
}
.ms-btn i { margin-right: 10px; width: 20px; text-align: center; }
.ms-vk:hover  { background: #0077FF; border-color: #0077FF; }
.ms-tg:hover  { background: #26A5E4; border-color: #26A5E4; }
.ms-max:hover { background: linear-gradient(135deg,#667eea 0%,#764ba2 100%); border-color: transparent; }

/* ── Футер ───────────────────────────────────────────────────────────── */
#footer-container-main, #checkout-footer { padding-top: 0; }
#footer-copyrights { color: #ccc; }
#footer-container-main > .container {
    border-top: 1px solid hsla(0,0%,63%,.25);
    padding-top: 80px;
}
#footer .footer-style-3 .block-newsletter > h5 {
    display: block;
    font-size: 2rem;
    margin-bottom: 2rem;
}
.block-iqitcontactpage hr { border-color: transparent; }

/* ── Разное ──────────────────────────────────────────────────────────── */
#iqithtmlandbanners-block-6 > h5 { display: none; }
.nav-tabs { border: none; }
@media (max-width: 1400px) { main { margin: 0 auto; } }

/* Фон страниц категорий / поиска */
#category #wrapper, #category .breadcrumb,
#module-iqitsearch-searchiqit #wrapper,
#module-iqitsearch-searchiqit .breadcrumb { background: #f4f4f4; }

/* Логотип в шапке (десктоп) */
.logo { max-width: 95px; max-height: 60px; }

/* ── Страница товара ──────────────────────────────────────────────────── */
.js-product-actions {
    border: 1px solid #d6d6d6;
    padding: 15px;
    border-radius: 4px;
    background: #f8f8f8;
}
.product_p_price_container,
.product-additional-info { border-top: none; padding-top: 0; }
#product-details { scroll-margin-top: 100px; }
#product .product-miniature { border: 1px solid #ccc; }
.product_header_container { padding-bottom: 0; }

@media (min-width: 768px) {
    #product .col-md-3 { flex: 0 0 27%; max-width: 27%; }
    #product .col-md-4 { flex: 0 0 31.33%; max-width: 31.33%; }
}

/* Артикул / бренд на странице товара */
.product-reference_top, #product_manufacturer { display: inline-block; margin-bottom: 10px; }
.product-reference_top label, #product_manufacturer label { font-weight: bold; margin: 0; }
.product-reference_top span { margin-right: 20px; }

/* ── Подкатегории в листинге ─────────────────────────────────────────── */
.product-list-subcategories .row { padding-left: 15px; padding-right: 15px; }
.product-list-subcategories .subcategory-image {
    display: grid;
    border-radius: 2px;
    border-bottom: 1px solid #ccc;
    margin: 2px;
    background: #fff;
    padding: 6px 2px;
}
.product-list-subcategories .col-6 { padding: 0; }

/* ── Блоки секций ────────────────────────────────────────────────────── */
.block-section {
    padding: 20px 30px;
    border: 1px solid rgba(0,0,0,.125);
}
.crossselling-products { padding: 0; border: none; }
.product-ppb-section { padding-left: 15px; padding-right: 15px; width: 100%; }
.product-ppb-section h4.section-title { padding-left: 30px; }
.ppb-table tbody tr:nth-child(even) { background-color: #f8f8f8; }
.ppb-table td { padding: 10px; vertical-align: middle; }
.ppb-table tbody tr:hover { background-color: #e9e9e9; }

/* ── Карточка товара ─────────────────────────────────────────────────── */
.product-miniature {
    container-type: inline-size;
    display: flex;
    flex-direction: column;
    height: auto; 
    background: #fff;
    border-radius: 4px;
    border-bottom: 1px solid #ccc;
}
.product-description { display: flex; flex-direction: column; flex: 1; }

/* Артикул в карточке */
.product-reference {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
    font-size: 12px;
}
.btn-copy-reference {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    margin: 0;
    display: inline-flex;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    line-height: 1;
}
.product-miniature:hover .btn-copy-reference,
.product-container:hover .btn-copy-reference,
.card-product:hover .btn-copy-reference { opacity: 0.6; visibility: visible; }
.btn-copy-reference:hover { opacity: 1 !important; }
.btn-copy-reference i.material-icons { font-size: 14px; }

/* ── Блок наличие + кнопка «В корзину» ──────────────────────────────── */
.product-quantity-a {
    margin-top: auto;
    padding: 8px 52px 8px 8px;
    /* border-top: 1px solid #e5e5e5; */
    /* background: #fff; */
    position: relative;
}
.product-quantity-a .stock-list,
.product-quantity-a .pl_availability_stock {
    font-size: 12px;
    white-space: normal;
    overflow-wrap: break-word;
    margin: 0;
}
.product-add-cart {
    position: absolute;
    right: 8px;
    top: -18px;
}
.product-add-cart form { display: flex; align-items: center; gap: 6px; margin: 0; }
.input-group-add-cart { display: flex; align-items: center; gap: 5px; }

/* Поле количества скрыто в карточках листинга, доступно на странице товара */
.product-miniature .input-group-add-cart .input-qty { display: none; }

/* Кнопка «В корзину» — круг с иконкой */
.btn-product-list {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid #0c121c;
    background: transparent;
    color: #0c121c;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s, color 0.2s;
}
.btn-product-list:hover:not(:disabled) {
    background: #0c121c;
    color: #fff;
}
.btn-product-list .btn-text { display: none; }
.btn-product-list .spinner-icon { font-size: 14px; }
.btn-product-list:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Статусы наличия ─────────────────────────────────────────────────── */
.pl_availability_stock span,
.stock-list:has(link[href*="InStock"]) span  { color: #2c7a2c !important; }
.stock-list:has(link[href*="PreOrder"]) span  { color: #e67e22 !important; }
.stock-list:has(link[href*="OutOfStock"]) span { color: #7f8c8d !important; }

/* ── Container queries — адаптация карточки по ширине ────────────────── */
@container (max-width: 180px) {
    .product-quantity-a { flex-wrap: wrap; }
    .product-quantity-a .stock-list,
    .product-quantity-a .pl_availability_stock { width: 100%; flex: auto; }
    .product-add-cart { min-width: auto; width: 100%; }
    .input-group-add-cart { justify-content: flex-end; }
}

/* ── Логотип в одну строку с nav на мобилке ──────────────────────────── */
#mobile-header .col-mobile-logo {
    position: absolute;
    width: 25vw;
    max-width: 110px;
    height: auto;
    aspect-ratio: 95 / 60;
    top: 8px;
    left: 10px;
    z-index: 1;
}
@media (max-width: 991px) {
    .header-nav .left-nav,
    .header-nav .center-nav,
    .header-nav #iqithtmlandbanners-block-2 { display: none !important; }
    .header-nav .container {
        box-sizing: border-box;
        padding-left: calc(25vw + 15px);
    }
    .header-nav .right-nav { margin-left: auto !important; }
}

/* ── Горизонтальный скролл ───────────────────────────────────────────── */
html, body { overflow-x: hidden; }

@media (max-width: 767px) {
    /* theme.css задаёт margin:-15px для этого ряда явно */
    .mobile-buttons-bar .row-mobile-buttons {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    /* Swiper-карусели Elementor */
    .swiper-container,
    .swiper-container-wrapper,
    .swiper-container-wrapper.swiper-overflow {
        overflow: hidden !important;
        max-width: 100% !important;
    }

    /* VK feed */
    .vkfeed-carousel__viewport { overflow: hidden; max-width: 100%; }
}
