/* ==========================================================================
   1. ГЛОБАЛЬНЫЕ ПЕРЕМЕННЫЕ И ОБЕРТКА ШАПКИ
   ========================================================================== */
:root {
    --ih-bg-main: #ffffff;
    --ih-bg-soft: #f8fafc;
    --ih-text-primary: #0f172a; /* Slate 900 */
    --ih-text-secondary: #64748b; /* Slate 500 */
    --ih-accent: #e11d48; /* Малиново-красный акцент */
    --ih-border: #e2e8f0;
    --ih-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --ih-radius-lg: 24px;
    --ih-radius-md: 16px;
    --ih-radius-sm: 12px;
}

.ih-mega-module-wrapper {
    position: relative;
    display: block;
    width: 100%;
    font-family: var(--ih-font);
    box-sizing: border-box;
}

/* Строка навигации (меню + кнопка Все сервисы) */
.ih-nav-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.ih-main-menu {
    display: flex;
    align-items: center;
    gap: 24px;
}

/* Пункт меню */
.ih-menu-item-wrap {
    position: static;
}

.ih-main-link {
    color: #000000;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none !important;
    padding: 24px 0;
    display: inline-block;
    transition: color 0.2s ease;
}

.ih-main-link:hover {
    color: var(--ih-accent);
}

/* ==========================================================================
   ПРАВАЯ ГРУППА ДЕЙСТВИЙ (ПРОМО-КНОПКИ И ВСЕ СЕРВИСЫ)
   ========================================================================== */
.ih-right-actions-wrap {
    display: flex;
    align-items: center;
    gap: 14px; /* Отступ между доп. кнопками и кнопкой "Все сервисы" */
}

.ih-extra-buttons-group {
    display: flex;
    align-items: center;
    gap: 10px; /* Отступ между самими промо-кнопками */
}

/* Стиль черных закругленных кнопок-плашек (как на скрине Promotii / Noutati) */
.ih-extra-btn {
    background-color: #000000 !important; /* Насыщенный черный */
    color: #ffffff !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    padding: 8px 16px !important;
    border-radius: 6px !important; /* Четкие скругленные углы */
    text-decoration: none !important;
    display: inline-block !important;
    transition: opacity 0.2s ease, transform 0.15s ease !important;
    letter-spacing: -0.01em;
}

.ih-extra-btn:hover {
    opacity: 0.85 !important; /* Мягкое угасание при наведении */
    transform: translateY(-1px);
    color: #ffffff !important;
}

/* Кнопка "Все сервисы" */
.ih-megamenu-trigger {
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 700;
    color: #000000;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: background-color 0.2s, border-color 0.2s;
    outline: none;
}

.ih-menu-item-wrap:hover .ih-megamenu-trigger {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
}

.ih-burger-icon {
    width: 20px;
    height: 20px;
    color: currentColor;
}

/* ==========================================================================
   2. ВЫПАДАЮЩИЕ ПАНЕЛИ (CSS HOVER И 100% ШИРИНА ЭКРАНА)
   ========================================================================== */
.ih-megamenu-drawer {
    position: absolute;
    top: 100%;
    left: 50%;
    width: 100vw;
    background-color: var(--ih-bg-main) !important;
    border-top: 1px solid var(--ih-border);
    border-bottom: 1px solid var(--ih-border);
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.18);
    box-sizing: border-box;
    
    /* Скрыто в пассивном состоянии */
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(-10px);
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), 
                transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), 
                visibility 0.25s;
    z-index: 99999;
}

/* Плавный показ меню при наведении на обертку .ih-menu-item-wrap */
.ih-menu-item-wrap:hover .ih-megamenu-drawer {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Контейнер внутри меню */
.ih-megamenu-content {
    max-width: 1440px;
    margin: 0 auto;
    padding: 40px 24px;
    display: grid;
    background-color: var(--ih-bg-main) !important;
    gap: 24px;
    box-sizing: border-box;
}

/* Разделители колонок */
.ih-mega-col {
    border-right: 1px solid var(--ih-border);
    padding-right: 24px;
}

.ih-mega-col:last-child,
.ih-mega-products-container {
    border-right: none;
    padding-right: 0;
}

/* ==========================================================================
   3. ГИБКАЯ НАСТРОЙКА СЕТОК В ЗАВИСИМОСТИ ОТ КОЛИЧЕСТВА КОЛОНОК
   ========================================================================== */
   
/* Выпадающее меню Сервисов (Всегда 4 колонки: 1 список + 3 карточки) */
.ih-services-style .ih-megamenu-content {
    grid-template-columns: 260px repeat(3, 1fr);
}

/* 3 колонки: Меню (240px) | Аксессуары (240px) | Модуль товаров (Остальная ширина) */
.ih-product-style.ih-cols-3 .ih-megamenu-content {
    grid-template-columns: 240px 240px 1fr;
}

/* 2 колонки: Меню (260px) | Модуль товаров (Остальная ширина) */
.ih-product-style.ih-cols-2 .ih-megamenu-content {
    grid-template-columns: 260px 1fr;
}

/* 1 колонка: Если активна только колонка Моделей */
.ih-product-style.ih-cols-1 .ih-megamenu-content {
    grid-template-columns: 1fr;
    max-width: 360px;
}

/* ==========================================================================
   4. СТИЛИЗАЦИЯ СПИСКОВ И ТЕКСТА (ЦВЕТА ЖЕСТКО ЗАФИКСИРОВАНЫ)
   ========================================================================== */
.ih-mega-title {
    font-size: 18px !important;
    font-weight: 700 !important;
    color: var(--ih-text-primary) !important;
    margin: 0 0 16px 0 !important;
    text-transform: none !important;
    letter-spacing: -0.01em;
}

.ih-mega-menu-list ul {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ih-mega-menu-list ul li a {
    font-size: 14.5px !important;
    color: var(--ih-text-secondary) !important;
    text-decoration: none !important;
    font-weight: 500 !important;
    transition: color 0.15s ease, transform 0.15s ease;
    display: inline-block;
}

.ih-mega-menu-list ul li a:hover {
    color: var(--ih-accent) !important;
    transform: translateX(4px);
}

/* Стили заголовков карточек промо */
.ih-card-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 18px !important;
    font-weight: 700 !important;
    color: var(--ih-text-primary) !important;
    margin-bottom: 20px;
}

.ih-arrow {
    width: 16px;
    height: 16px;
    color: var(--ih-text-primary);
    transition: transform 0.2s;
}

.ih-mega-card:hover .ih-arrow {
    transform: translateX(4px);
    color: var(--ih-accent);
}

/* Картинки внутри сервисов */
.ih-card-img-wrap {
    width: 100%;
    height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.ih-card-img-wrap img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* ==========================================================================
   5. СЕТКА И КАРТОЧКИ ТОВАРОВ (НОВИНКИ VIRTUEMART)
   ========================================================================== */
.ih-mega-products-container {
    display: flex;
    flex-direction: column;
}

/* Сетка товаров строго в 3 колонки */
.ih-mega-products-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 20px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Стилизация отдельной карточки товара */
.ih-product-card {
    text-decoration: none !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    background-color: #ffffff !important;
    padding: 12px !important;
    border-radius: var(--ih-radius-sm) !important;
    transition: transform 0.2s ease !important;
    box-sizing: border-box !important;
}

.ih-product-card:hover {
    transform: translateY(-4px) !important;
}

/* Обертка изображения товара */
.ih-prod-img-wrap {
    width: 100% !important;
    height: 160px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin-bottom: 12px !important;
    overflow: hidden !important;
    background: transparent !important;
}

.ih-prod-img-wrap img {
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
}

/* Заголовок товара */
.ih-prod-title {
    font-size: 13.5px !important;
    font-weight: 600 !important;
    color: var(--ih-text-primary) !important;
    margin: 0 0 8px 0 !important;
    line-height: 1.4 !important;
    height: 38px !important;
    overflow: hidden !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    text-transform: none !important;
}

/* Блок цены */
.ih-prod-price-block {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    justify-content: center !important;
}

.ih-prod-price {
    font-size: 15px !important;
    font-weight: 700 !important;
    color: var(--ih-text-primary) !important;
}

.ih-prod-oldprice {
    font-size: 13px !important;
    color: var(--ih-text-secondary) !important;
    text-decoration: line-through !important;
    font-weight: 500 !important;
}

/* Карточки Сервисов */
.ih-mega-card {
    text-decoration: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* ==========================================================================
   6. ЗАЩИТНЫЙ КОРРЕКТОР ДЛЯ ВСТРОЕННЫХ СТРУКТУР (ДЛЯ СОВМЕСТИМОСТИ)
   ========================================================================== */
.ih-embedded-module-wrap {
    width: 100%;
    box-sizing: border-box;
}

.ih-embedded-module-wrap .vmproduct,
.ih-embedded-module-wrap .product-fields,
.ih-embedded-module-wrap .products-grid,
.ih-embedded-module-wrap .row,
.ih-embedded-module-wrap .virtuemart {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 20px !important;
    justify-content: space-between !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    width: 100% !important;
    box-shadow: none !important;
}

.ih-embedded-module-wrap .product,
.ih-embedded-module-wrap .vm-product-container,
.ih-embedded-module-wrap .product-container,
.ih-embedded-module-wrap .spacer {
    background-color: var(--ih-bg-main) !important;
    border: none !important;
    box-shadow: none !important;
    text-align: center !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    width: 33.333% !important;
    padding: 10px !important;
    border-radius: var(--ih-radius-md) !important;
    transition: transform 0.2s ease !important;
    box-sizing: border-box !important;
}

.ih-embedded-module-wrap .product:hover,
.ih-embedded-module-wrap .spacer:hover {
    transform: translateY(-3px) !important;
}

.ih-embedded-module-wrap img,
.ih-embedded-module-wrap .vm-product-media-container img {
    max-width: 100% !important;
    max-height: 160px !important;
    height: 160px !important;
    object-fit: contain !important;
    margin-bottom: 12px !important;
    background: transparent !important;
}

.ih-embedded-module-wrap .product-price,
.ih-embedded-module-wrap .PricesalesPrice,
.ih-embedded-module-wrap .price-sales,
.ih-embedded-module-wrap .PricebasePriceVariant {
    font-size: 15px !important;
    font-weight: 700 !important;
    color: var(--ih-text-primary) !important;
    display: inline-block !important;
    margin-top: 4px !important;
}

.ih-embedded-module-wrap .PricebasePrice,
.ih-embedded-module-wrap .price-crossed,
.ih-embedded-module-wrap .price-old {
    font-size: 13px !important;
    color: var(--ih-text-secondary) !important;
    text-decoration: line-through !important;
    margin-left: 8px !important;
    font-weight: 500 !important;
}

.ih-embedded-module-wrap .addtocart-area,
.ih-embedded-module-wrap .addtocart-bar,
.ih-embedded-module-wrap .vm-details-button,
.ih-embedded-module-wrap .compare-button {
    display: none !important;
}

/* ==========================================================================
   7. АДАПТИВНОСТЬ ПОД МОБИЛЬНЫЕ УСТРОЙСТВА
   ========================================================================== */
@media (max-width: 1024px) {
    .ih-megamenu-content {
        grid-template-columns: 1fr !important;
        gap: 32px;
        padding: 30px 20px;
    }
    .ih-mega-products-grid {
        grid-template-columns: 1fr !important;
    }
    .ih-embedded-module-wrap .vmproduct,
    .ih-embedded-module-wrap .row {
        flex-direction: column !important;
    }
    .ih-embedded-module-wrap .product,
    .ih-embedded-module-wrap .spacer {
        width: 100% !important;
        border-bottom: 1px solid var(--ih-border) !important;
        padding-bottom: 15px !important;
    }
    .ih-mega-col {
        border-right: none;
        border-bottom: 1px solid var(--ih-border);
        padding-right: 0;
        padding-bottom: 24px;
    }
    .ih-mega-col:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }
    .ih-card-img-wrap {
        height: 160px;
    }
}