/* ========================================
   HT Mega Menu - Product & Brands Navigation
   ======================================== */

/* Container positioning - Categories (Product) menu */
.menu-item.ht-mega-menu,
.menu-item[data-mega="categories"] {
    position: relative;
}

/* Container positioning - Brands menu */
.menu-item.ht-mega-brands,
.menu-item[data-mega="brands"] {
    position: relative;
}

.ht-mega-menu__container {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    min-width: 800px;
    max-width: 960px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(18, 39, 63, 0.15);
    border: 1px solid #e8ecf1;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    z-index: 9999;
    margin-top: 12px;
}

.ht-mega-menu__container.visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Inner container */
.ht-mega-menu__inner {
    padding: 24px 28px;
}

/* Content area */
.ht-mega-content {
    min-height: 200px;
}

.ht-mega-preview {
    display: none;
    animation: fadeIn 0.3s ease;
}

.ht-mega-preview.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Grid layout */
.ht-mega-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 20px;
}

@media (max-width: 900px) {
    .ht-mega-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 16px;
    }
}

/* Individual item */
.ht-mega-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    text-decoration: none;
    color: inherit;
    padding: 12px;
    border-radius: 12px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.ht-mega-item:hover {
    background: #f8fafc;
    border-color: var(--color-primary, #c41230);
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(196, 18, 48, 0.12);
}

/* Item image */
.ht-mega-item__img-wrap {
    width: 90px;
    height: 90px;
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ht-mega-item__img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s ease;
}

.ht-mega-item:hover .ht-mega-item__img-wrap img {
    transform: scale(1.08);
}

.ht-mega-item__placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-primary, #c41230), #ff6b6b);
    font-size: 2rem;
    font-weight: 900;
    color: #fff;
}

/* Item name */
.ht-mega-item__name {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--color-dark, #1a202c);
    line-height: 1.3;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color 0.25s ease;
}

.ht-mega-item:hover .ht-mega-item__name {
    color: var(--color-primary, #c41230);
}

/* Empty state */
.ht-mega-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--color-gray-500, #64748b);
}

.ht-mega-empty p {
    margin: 0;
    font-size: 0.95rem;
}

/* Arrow indicator for Product (Categories) menu */
.menu-item.ht-mega-menu > a::after,
.menu-item[data-mega="categories"] > a::after {
    content: '▼';
    font-size: 0.65em;
    margin-left: 6px;
    opacity: 0.6;
    transition: transform 0.25s ease;
}

.menu-item.ht-mega-menu.hovered > a::after,
.menu-item[data-mega="categories"].hovered > a::after {
    opacity: 1;
    transform: rotate(180deg);
}

/* Arrow indicator for Brands menu */
.menu-item.ht-mega-brands > a::after,
.menu-item[data-mega="brands"] > a::after {
    content: '▼';
    font-size: 0.65em;
    margin-left: 6px;
    opacity: 0.6;
    transition: transform 0.25s ease;
}

.menu-item.ht-mega-brands.hovered > a::after,
.menu-item[data-mega="brands"].hovered > a::after {
    opacity: 1;
    transform: rotate(180deg);
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .ht-mega-menu__container {
        min-width: 600px;
        max-width: 800px;
        left: auto;
        right: 0;
        transform: translateX(0) translateY(-10px);
    }

    .ht-mega-menu__container.visible {
        transform: translateX(0) translateY(0);
    }
}

@media (max-width: 768px) {
    .ht-mega-menu__container {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        min-width: auto;
        transform: translateX(0);
        border-radius: 20px 20px 0 0;
        max-height: 70vh;
        overflow-y: auto;
    }

    .ht-mega-menu__container.visible {
        transform: translateX(0) translateY(0);
    }

    .ht-mega-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 14px;
    }

    .ht-mega-item__img-wrap {
        width: 80px;
        height: 80px;
    }
}
