/* ALADDIN: свои стили поверх темы. Подключается после custom-style.css в frontend/layouts/app.blade.php и zig/src/templates/layout_top.html;
   после правки поднять номер ?v= в обоих местах, иначе браузеры возьмут старую копию. */

/* Таблицы в описании товара на телефоне: ячейки друг под другом, а не две узкие колонки */
@media (max-width: 767.98px) {
    .aiz-editor-data table,
    .aiz-editor-data tbody,
    .aiz-editor-data tr,
    .aiz-editor-data td,
    .aiz-editor-data th {
        display: block;
        width: 100% !important;
        height: auto !important;
    }
    .aiz-editor-data thead {
        display: none;
    }
    .aiz-editor-data tr {
        padding: 8px 0;
        border-bottom: 1px solid rgba(128, 128, 128, .25);
    }
    .aiz-editor-data td,
    .aiz-editor-data th {
        padding: 2px 0;
        border: 0;
    }
}
/* «Похожие товары» на телефоне: цена мельче, старая цена отдельной строкой — без наезда на соседнюю карточку */
@media (max-width: 575.98px) {
    .related-product-container {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }
    .related-product-container .carousel-box .pr-3 {
        padding-right: 8px !important;
    }
    .related-product-container .carousel-box .fw-700.fs-14 {
        font-size: 13px !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .related-product-container .carousel-box .fw-700.fs-14 del {
        display: block;
        margin-left: 0 !important;
        font-size: 12px;
    }
}

/* Карточки товаров: фото в квадрате одного размера, целиком и по центру (не выше/ниже соседей),
   под фото — название (2 строки), цена, зачёркнутая старая цена */
.aiz-card-box > .position-relative.img-fit.overflow-hidden {
    aspect-ratio: 1 / 1;
    width: 100%;
    height: auto !important;
    background: #fff;
}
.aiz-card-box .image-hover-effect,
.img.image-hover-effect > a {
    display: block;
    width: 100% !important;
    height: 100% !important;
}
.aiz-card-box img.product-main-image,
.aiz-card-box img.product-hover-image,
.img.image-hover-effect img.product-main-image {
    width: 100%;
    height: 100% !important;
    max-height: none;
    object-fit: contain;
    background: #fff;
}
.aiz-card-box .fs-14.d-flex.justify-content-center {
    flex-direction: column-reverse;
    align-items: center;
}
.aiz-card-box .fs-14.d-flex.justify-content-center del {
    margin-right: 0 !important;
    font-size: 12px;
}

/* Страница товара, блоки «Продавец» и «Бренд»: логотип не вписывается в квадрат 48×48, а уменьшается пропорционально —
   рамка по ширине логотипа (не больше 40 % блока), высота 48 px, ничего не вылезает за край */
.store-logo-container.w-48px {
    width: auto !important;
    min-width: 48px;
    max-width: 40%;
    padding: 4px 6px;
}
.store-logo-container img,
.store-logo-container img.img-fit {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Таймер акции кольцами (.aiz-count-down-circle; кольца рисует AIZ.plugins.countDownCircle в aiz-core.js, viewBox 0..100):
   ровные кольца без обрезанной обводки; размер — по ширине блока, на страницах распродаж до 110 px (.aladdin-cd-lg) */
.aiz-count-down-circle #time {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 12px;
}
.aiz-count-down-circle #time .circle {
    position: relative;
    flex: 0 1 auto;
    width: 56px;
    height: auto;
    aspect-ratio: 1 / 1;
}
.aladdin-cd-lg #time {
    width: 100%;
}
.aladdin-cd-lg #time .circle {
    width: calc((100% - 30px) / 4);
    max-width: 110px;
}
.aiz-count-down-circle #time .circle svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    transform: rotate(-90deg);
}
.aiz-count-down-circle #time .circle svg circle {
    fill: none;
    stroke: #eceff1;
    stroke-width: 5;
    transform: none;
}
.aiz-count-down-circle #time .circle svg circle:nth-child(2) {
    stroke: var(--primary);
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    transition: stroke-dashoffset .4s ease;
}
.aiz-count-down-circle #time .circle > div {
    position: absolute;
    inset: 0;
    margin: 0 !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.1;
    color: #1b1b28;
}
.aiz-count-down-circle #time .circle > div br {
    display: none;
}
.aiz-count-down-circle #time .circle > div span {
    position: static;
    transform: none;
    margin-top: 2px;
    font-size: 9px;
    font-weight: 500;
    letter-spacing: .04em;
    text-transform: none;
    color: #6d6e70;
}
/* цифры и подписи — по размеру кольца */
.aiz-count-down-circle #time .circle {
    container-type: inline-size;
}
.aiz-count-down-circle #time .circle > div {
    font-size: max(13px, 26cqw);
}
.aiz-count-down-circle #time .circle > div span {
    font-size: max(10px, 13cqw);
}

/* Страница «Все категории» (/categories): ровная сетка — плитки разделов одного размера,
   подразделы карточками одной ширины и одной высоты в ряду, названия в одну строку */
.aladdin-cat-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 32px;
}
.aladdin-cat-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 128px;
    padding: 10px;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    color: #333 !important;
    text-align: center;
    transition: border-color .2s, box-shadow .2s;
}
.aladdin-cat-tile:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .08);
    text-decoration: none;
}
.aladdin-cat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 52px;
    width: 52px;
    height: 52px;
}
.aladdin-cat-icon img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
.aladdin-cat-tile-name {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.aladdin-cat-section {
    margin-bottom: 24px;
    padding: 20px;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    scroll-margin-top: 90px;
}
.aladdin-cat-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    color: #333 !important;
}
.aladdin-cat-head:hover {
    text-decoration: none;
    color: var(--primary) !important;
}
.aladdin-cat-head h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: inherit;
}
.aladdin-cat-groups {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}
.aladdin-cat-group {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 14px 16px;
    background: #f7f8fa;
    border-radius: 6px;
}
.aladdin-cat-group-title {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 700;
    color: #333 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.aladdin-cat-group ul {
    margin: 0;
    padding: 0;
    list-style: none;
}
.aladdin-cat-group li a {
    display: block;
    padding: 3px 0;
    font-size: 13px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.aladdin-cat-group-title:hover,
.aladdin-cat-group li a:hover,
.aladdin-cat-more:hover {
    color: var(--primary) !important;
    text-decoration: none;
}
.aladdin-cat-more {
    margin-top: auto;
    padding-top: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary) !important;
}
@media (max-width: 1199.98px) {
    .aladdin-cat-groups { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 991.98px) {
    .aladdin-cat-groups { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 575.98px) {
    .aladdin-cat-tiles {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
        margin-bottom: 20px;
    }
    .aladdin-cat-tile {
        height: 116px;
        gap: 6px;
        padding: 8px 4px;
    }
    .aladdin-cat-tile-name { font-size: 12px; }
    .aladdin-cat-section { padding: 14px; margin-bottom: 16px; }
    .aladdin-cat-groups { grid-template-columns: minmax(0, 1fr); gap: 8px; }
}