/* ============================================================
   Базовые и общие стили
   ============================================================ */
[x-cloak] {
    display: none !important;
}

/* ============================================================
   Навигация (меню "Каталог", вертикальное меню)
   ============================================================ */
.navbar .dropdown-mega {
    position: static;
}
.dropdown-mega .dropdown-menu {
    width: 100%;
    padding: 1rem;
    border-radius: 0;
    border-top: 2px solid #0d6efd;
    margin-top: 0;
}
.dropdown-mega .dropdown-item {
    padding: 0.5rem 1rem;
}
.dropdown-mega .dropdown-item i {
    margin-right: 8px;
    width: 24px;
    text-align: center;
}
.dropdown-mega .dropdown-submenu {
    position: relative;
}
.dropdown-mega .dropdown-submenu > .dropdown-menu {
    top: 0;
    left: 100%;
    margin-top: 0;
    border-radius: 0;
    min-width: 200px;
    border: 1px solid #dee2e6;
}
.dropdown-mega .dropdown-submenu:hover > .dropdown-menu {
    display: block;
}
.dropdown-mega .dropdown-submenu .dropdown-item {
    padding-left: 1.5rem;
}

.nav-link.text-dark:hover {
    color: #0d6efd !important;
}
.nav-link.text-dark:hover i {
    color: #0d6efd;
}

/* Вертикальное меню категорий (sidebar) */
.categories-sidebar {
    background: #f8f9fa;
    border-radius: 0.25rem;
    padding: 0;
}
.categories-sidebar .list-group-item {
    border: none;
    border-bottom: 1px solid #e9ecef;
    padding: 0.75rem 1.25rem;
}
.categories-sidebar .list-group-item:last-child {
    border-bottom: none;
}
.categories-sidebar .list-group-item a {
    text-decoration: none;
    color: #212529;
    display: flex;
    align-items: center;
}
.categories-sidebar .list-group-item a i {
    margin-right: 10px;
    font-size: 1.2rem;
}
.categories-sidebar .list-group-item a:hover {
    color: #0d6efd;
}
.categories-sidebar .subcategory-list {
    list-style: none;
    padding-left: 2rem;
    margin-top: 0.5rem;
}
.categories-sidebar .subcategory-list li {
    margin-bottom: 0.3rem;
}
.categories-sidebar .subcategory-list li a {
    font-size: 0.9rem;
    color: #495057;
}
.categories-sidebar .subcategory-list li a:hover {
    color: #0d6efd;
}

/* ============================================================
   Главная страница (баннер, слайдеры)
   ============================================================ */
.main-slider {
    position: relative;
    margin-bottom: 2rem;
}
.main-slider .carousel-item img {
    height: 400px;
    object-fit: cover;
    filter: brightness(0.6);
}
.main-slider .carousel-caption {
    top: 50%;
    transform: translateY(-50%);
    bottom: auto;
    text-align: center;
}
.main-slider .carousel-caption h1 {
    font-size: 4rem;
    font-weight: 700;
    letter-spacing: 4px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}
.main-slider .carousel-caption h1 .highlight {
    color: #ff7b00;
}
.main-slider .carousel-caption p {
    font-size: 1.8rem;
    font-weight: 300;
    letter-spacing: 2px;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
}

/* ============================================================
   Карточки товаров (списки, слайдеры, категории)
   ============================================================ */
.product-card {
    height: 100%;
    transition: box-shadow 0.2s;
}
.product-card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}
.product-card .card-body {
    display: flex;
    flex-direction: column;
}
.product-card form {
    margin-top: auto;
}

/* Контейнер изображения в карточке */
.product-card .product-image-link {
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #f8f9fa;
}
.product-card .product-card-img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    flex-shrink: 0;
    -webkit-user-drag: none;
}

/* Обрезка длинных названий категорий */
.category-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    height: 3em;
    line-height: 1.5em;
    margin-bottom: 0.5rem;
}

/* Контейнер для изображения в карточке категории (на странице категории) */
.card-img-center {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #f8f9fa;
    height: 150px;
    width: 100%;
}
.card-img-center img {
    max-height: 100%;
    max-width: 100%;
    width: auto;
    height: auto;
    display: block;
    object-fit: contain;
    -webkit-user-drag: none;
}

/* ============================================================
   Swiper (слайдеры)
   ============================================================ */
.swiper-button-next,
.swiper-button-prev {
    background: rgba(255, 255, 255, 0.9) !important;
    border-radius: 50% !important;
    width: 44px !important;
    height: 44px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
    transition:
        background 0.2s,
        transform 0.2s !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}
.swiper-button-next:hover,
.swiper-button-prev:hover {
    background: #ffffff !important;
    transform: scale(1.08);
}
.swiper-button-next::after,
.swiper-button-prev::after {
    font-size: 18px !important;
    font-weight: 700 !important;
    color: #333 !important;
}

/* Скрытие стрелок, показ при наведении */
.category-swiper .swiper-button-next,
.category-swiper .swiper-button-prev,
.product-swiper .swiper-button-next,
.product-swiper .swiper-button-prev {
    opacity: 0;
    transition: opacity 0.3s ease;
}
.category-swiper:hover .swiper-button-next,
.category-swiper:hover .swiper-button-prev,
.product-swiper:hover .swiper-button-next,
.product-swiper:hover .swiper-button-prev {
    opacity: 1;
}

/* Стили для слайдера товаров */
.product-slide-link {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    height: 200px;
    width: 100%;
}
.product-slide-img {
    max-height: 100%;
    max-width: 100%;
    width: 100%;
    height: auto;
    object-fit: cover;
    -webkit-user-drag: none;
}

/* Стили для слайдера категорий */
.category-slide-card {
    border: none;
    background: transparent;
}
.category-slide-link {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    height: 200px;
    width: 100%;
}
.category-slide-img {
    max-height: 100%;
    max-width: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    -webkit-user-drag: none;
}

/* ============================================================
   Галерея товара (страница продукта)
   ============================================================ */
.product-gallery {
    width: 100%;
    display: flex;
    flex-direction: column;
    background: #ffffff;
}
.product-gallery img {
    max-width: 100%;
    max-height: 300px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
    -webkit-user-drag: none;
}
.product-gallery .product-thumb__addit {
    display: flex;
    gap: 4px;
    margin-top: 10px;
    width: 100%;
}
.product-gallery .product-thumb__addit-item {
    flex: 1;
    height: 3px;
    background: #ccc;
    border-radius: 1px;
    cursor: pointer;
    transition: background-color 0.2s;
}
.product-gallery .product-thumb__addit-item.active {
    background: #ff5800;
}

/* Главное изображение */
.product-main-image .main-image-container {
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    overflow: hidden;
    cursor: grab;
}
.product-main-image .main-image-container:active {
    cursor: grabbing;
}
.product-main-image .main-image-container img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
    display: block;
    pointer-events: auto;
}

/* Миниатюры */
.thumb-scroll-container {
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    padding-bottom: 5px;
    cursor: grab;
}
.thumb-scroll-container:active {
    cursor: grabbing;
}
.thumb-scroll-wrapper {
    display: flex;
    gap: 6px;
}
.product-main-image .product-thumb__addit-item {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: border-color 0.2s;
    flex-shrink: 0;
}
.product-main-image .product-thumb__addit-item.active {
    border-color: #ff5800;
}

/* Запрет перетаскивания */
.main-image-container img,
.lightbox-image,
.product-thumb__addit-item,
.lightbox-thumb-item {
    -webkit-user-drag: none;
}

/* ============================================================
   Лайтбокс
   ============================================================ */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(32, 32, 32, 0.92);
    z-index: 9999;
    display: block;
}
.lightbox-image-wrapper {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 85vw;
    max-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lightbox-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.2);
    border: none;
    color: white;
    font-size: 36px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding-bottom: 10px;
    transition:
        background 0.2s,
        transform 0.2s;
}
.lightbox-close:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}
.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    padding-bottom: 10px;
    background: rgba(0, 0, 0, 0.2);
    border: none;
    color: white;
    font-size: 48px;
    width: 60px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
    z-index: 10000;
    border-radius: 8px;
}
.lightbox-prev {
    left: 20px;
}
.lightbox-next {
    right: 20px;
}
.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(0, 0, 0, 0.8);
}
.lightbox-footer {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    max-width: 90vw;
}
.lightbox-thumbnails {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 5px;
}
.lightbox-thumb-item {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color 0.2s;
}
.lightbox-thumb-item.active {
    border-color: #ff5800;
}

/* ============================================================
   Изображения-заглушки
   ============================================================ */
.no-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background-color: #f8f9fa;
    display: block;
}
.no-image-wrapper {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    width: 100%;
    background-color: #f6f6f6;
    min-height: 200px;
}
.no-image-wrapper .no-image-large {
    max-width: 100%;
    max-height: 400px;
    width: auto;
    height: auto;
    object-fit: contain;
    background-color: transparent;
}

/* ============================================================
   Пагинация
   ============================================================ */
.pagination {
    gap: 0.25rem;
    margin-top: 1rem;
    margin-bottom: 0;
}
.pagination .page-link {
    padding: 0.375rem 0.75rem;
    font-size: 0.9rem;
    line-height: 1.5;
}
@media (max-width: 576px) {
    .pagination {
        gap: 0.15rem;
    }
}

/* ============================================================
   Селекты и формы (в частности для фильтров)
   ============================================================ */
.input-group {
    width: auto !important;
}
.input-group .form-select {
    width: auto !important;
    min-width: 70px;
}
.input-group .input-group-text {
    background: #f8f9fa;
    border-right: 0;
}
.input-group .form-select {
    border-left: 0;
}

/* ============================================================
   Бейдж корзины
   ============================================================ */
.cart-badge {
    font-size: 0.6rem;
    padding: 0.3rem 0.4rem;
    position: absolute;
    top: 2px;
    right: 3px;
    min-width: 0.8rem;
    line-height: 1;
}

/* ============================================================
   Статусы заказов (общие)
   ============================================================ */
.badge {
    font-size: 0.9rem;
    padding: 0.15em 0.35em;
    border-radius: 0.5rem;
}

/* ============================================================
   Подвал
   ============================================================ */
.footer {
    background: #212529;
    color: #f8f9fa;
    padding: 3rem 0 1rem;
}
.footer h3 {
    color: #ff7b00;
    font-size: 1.4rem;
    margin-bottom: 1.2rem;
}
.footer p {
    font-size: 0.95rem;
    line-height: 1.6;
}
.footer a {
    color: #adb5bd;
    text-decoration: none;
}
.footer a:hover {
    color: #ff7b00;
    text-decoration: underline;
}
.footer .copyright {
    border-top: 1px solid #495057;
    padding-top: 1.5rem;
    margin-top: 2rem;
    text-align: center;
    font-size: 0.9rem;
    color: #adb5bd;
}

/* ============================================================
   Адаптивность (медиа-запросы)
   ============================================================ */
@media (max-width: 576px) {
    .card-img-center {
        height: 120px;
    }
}
@media (max-width: 768px) {
    .card-img-center {
        height: 140px;
    }
}

/* ===== Каталог – колонки и подкатегории ===== */

/* Разрешаем выход подменю за пределы родительских контейнеров */
.dropdown-mega .dropdown-menu,
.dropdown-mega .dropdown-menu .container,
.dropdown-mega .dropdown-menu .row,
.catalog-column {
    overflow: visible !important;
}

.catalog-column {
    overflow: visible !important;
}

/* Названия корневых категорий – перенос, без обрезки */
.catalog-column .dropdown-item {
    white-space: normal;
    word-wrap: break-word;
    overflow: visible;
    max-width: 100%;
    padding-right: 0.5rem;
}

/* Явное позиционирование родителя */
.catalog-submenu {
    position: relative !important;
}

/* Сетка подкатегорий – адаптивное число колонок */
.submenu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.25rem 0.5rem;
}
.submenu-item {
    white-space: normal;
    word-wrap: break-word;
    word-break: break-word;
    padding: 0.25rem 0.5rem;
    font-size: 0.9rem;
    overflow: visible;
    min-width: 0;
}
.submenu-item img,
.submenu-item i {
    margin-right: 6px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

/* Подменю – принудительно скрыто, показываем при наведении */
.catalog-submenu .submenu-dropdown,
.catalog-submenu .submenu-dropdown.show {
    display: none !important;
    position: absolute;
    top: 0;
    left: 100%;
    margin-top: 0;
    z-index: 1050;
    background: #fff !important;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
    border: 1px solid #dee2e6 !important;
    padding: 0.5rem !important;
    min-width: 200px !important;
    max-width: min(600px, 80vw) !important;
    max-height: 70vh !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}
.catalog-submenu:hover > .submenu-dropdown,
.catalog-submenu:hover > .submenu-dropdown.show {
    display: block !important;
}

/* Если справа мало места – показываем слева */
.catalog-submenu.submenu-right .submenu-dropdown {
    left: auto;
    right: 100%;
    transform: none;
}

/* Адаптив для колонок подкатегорий */
@media (max-width: 768px) {
    .submenu-grid {
        grid-template-columns: 1fr; /* одна колонка на телефонах */
    }
    .catalog-submenu .submenu-dropdown {
        max-width: 90vw;
        min-width: 200px;
        max-height: 50vh;
    }
}
@media (min-width: 992px) and (max-width: 1200px) {
    .submenu-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    }
}

/* ===== Sticky Footer ===== */
html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh; /* минимум на всю высоту окна */
}

main {
    flex: 1 0 auto; /* растягивается, занимая всё свободное место */
}

.footer {
    flex-shrink: 0; /* не сжимается */
    /* остальные стили остаются как есть */
}
