/**
 * Petrono Custom Tabbed Mega Menu Styles
 * File: assets/css/mega-menu.css
 */

/* -------------------------------------------
   رپر دکمه دسته‌بندی در هدر وودمارت
------------------------------------------- */
.petrono-header-cat-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    height: 100%;
}

/* دکمه بازکننده منو */
.petrono-cat-trigger-btn {
    display: inline-flex;
    align-items: center;
    flex-direction: row; /* قرارگیری آیکون در سمت راست متن در حالت RTL */
    gap: 10px;
    background: transparent !important;
    color: #242424;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    transition: color 0.2s ease;
    user-select: none;
}

.petrono-cat-trigger-btn:hover {
    color: #ed164b;
}

/* آیکون ۴ نقطه‌ای هدر (گرید ۲×۲) */
.petrono-cat-icon {
    display: grid;
    grid-template-columns: repeat(2, 6px);
    grid-gap: 3px;
    align-items: center;
    justify-content: center;
}

.petrono-cat-icon i {
    width: 6px;
    height: 6px;
    background-color: #64748b;
    border-radius: 2px;
    display: block;
    transition: background-color 0.2s ease;
}

.petrono-cat-trigger-btn:hover .petrono-cat-icon i {
    background-color: #ed164b;
}

/* پنل بازشونده دراپ‌داون در هدر */
.petrono-cat-dropdown-panel {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 99999;
    width: 1180px;
    max-width: 90vw;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
    border-radius: 14px;
    background: #ffffff;
    pointer-events: none;
    margin-top: 6px;
}

/* پل ارتباطی نامرئی جهت حفظ هاور هنگام حرکت موس */
.petrono-cat-dropdown-panel::before {
    content: '';
    position: absolute;
    top: -12px;
    right: 0;
    width: 100%;
    height: 12px;
}

/* نمایش پنل هنگام هاور روی دکمه */
.petrono-header-cat-wrapper:hover .petrono-cat-dropdown-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

/* -------------------------------------------
   کانتینر اصلی مگامنو
------------------------------------------- */
.petrono-mega-menu-wrapper {
    display: flex;
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid #f1f5f9;
    min-height: 440px;
    direction: rtl;
    text-align: right;
    box-sizing: border-box;
    width: 100%;
    overflow: hidden;
}

.petrono-mega-menu-wrapper *,
.petrono-mega-menu-wrapper *::before,
.petrono-mega-menu-wrapper *::after {
    box-sizing: border-box;
}

/* -------------------------------------------
   ستون سمت راست (تب‌ها و دسته‌بندی‌ها)
------------------------------------------- */
.petrono-mega-menu-wrapper .petrono-mm-tabs {
    width: 290px;
    flex-shrink: 0;
    list-style: none;
    padding: 12px 0;
    margin: 0;
    background: #f8fafc;
    border-left: 1px solid #e2e8f0;
}

.petrono-mega-menu-wrapper .petrono-mm-tabs .petrono-tab-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    cursor: pointer;
    font-size: 13.5px;
    color: #334155;
    font-weight: 500;
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    user-select: none;
}

/* آیکون تب */
.petrono-mega-menu-wrapper .petrono-tab-item .petrono-tab-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-left: 12px;
    flex-shrink: 0;
    color: #64748b;
    transition: all 0.2s ease;
}

.petrono-mega-menu-wrapper .petrono-tab-item .petrono-tab-icon svg {
    width: 100%;
    height: 100%;
    display: block;
    stroke: currentColor;
}

/* هاور و تب فعال */
.petrono-mega-menu-wrapper .petrono-mm-tabs .petrono-tab-item:hover,
.petrono-mega-menu-wrapper .petrono-mm-tabs .petrono-tab-item.active {
    background: #ffffff;
    color: #ed164b;
    font-weight: 700;
}

.petrono-mega-menu-wrapper .petrono-mm-tabs .petrono-tab-item:hover .petrono-tab-icon,
.petrono-mega-menu-wrapper .petrono-mm-tabs .petrono-tab-item.active .petrono-tab-icon {
    color: #ed164b;
    transform: scale(1.12);
}

.petrono-mega-menu-wrapper .petrono-mm-tabs .petrono-tab-item.active::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    background: #ed164b;
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
}

/* -------------------------------------------
   ناحیه محتوا و زیردسته‌ها (سمت چپ)
------------------------------------------- */
.petrono-mega-menu-wrapper .petrono-mm-content-area {
    flex: 1;
    padding: 26px 30px;
    background: #ffffff;
    overflow-y: auto;
    max-height: 520px;
}

/* اسکرول‌بار ظریف */
.petrono-mega-menu-wrapper .petrono-mm-content-area::-webkit-scrollbar {
    width: 5px;
}
.petrono-mega-menu-wrapper .petrono-mm-content-area::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 10px;
}

.petrono-mega-menu-wrapper .petrono-tab-content {
    display: none;
    animation: petronoFadeIn 0.22s ease forwards;
}

.petrono-mega-menu-wrapper .petrono-tab-content.active {
    display: block;
}

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

/* هدر بالای هر تب */
.petrono-mega-menu-wrapper .petrono-tab-header {
    margin-bottom: 20px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 12px;
}

.petrono-mega-menu-wrapper .petrono-tab-header .petrono-col-title {
    font-weight: 800;
    color: #013066;
    font-size: 14.5px;
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    transition: color 0.2s ease;
}

.petrono-mega-menu-wrapper .petrono-tab-header .petrono-col-title:hover {
    color: #ed164b;
}

.petrono-mega-menu-wrapper .petrono-tab-header .petrono-col-title .arrow {
    color: #ed164b;
    font-size: 16px;
    margin-right: 8px;
    display: inline-block;
    transition: transform 0.2s ease;
}

.petrono-mega-menu-wrapper .petrono-tab-header .petrono-col-title:hover .arrow {
    transform: translateX(-4px);
}

/* چیدمان ۴ ستونه زیردسته‌ها */
.petrono-mega-menu-wrapper .petrono-cols-4-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.petrono-mega-menu-wrapper .petrono-menu-col {
    display: flex;
    flex-direction: column;
}

/* تیترهای گروه‌های فرعی */
.petrono-mega-menu-wrapper .petrono-menu-col a.petrono-sub-heading {
    font-weight: 700;
    color: #013066;
    font-size: 13px;
    margin-top: 14px;
    margin-bottom: 6px;
    padding: 3px 0;
    text-decoration: none;
    display: block;
    transition: color 0.2s ease;
}

.petrono-mega-menu-wrapper .petrono-menu-col a.petrono-sub-heading:first-child {
    margin-top: 0;
}

.petrono-mega-menu-wrapper .petrono-menu-col a.petrono-sub-heading:hover {
    color: #ed164b;
}

/* آیتم‌ها و گریدهای محصول */
.petrono-mega-menu-wrapper .petrono-menu-col a.petrono-sub-item {
    font-size: 12.5px;
    font-weight: 400;
    color: #64748b;
    text-decoration: none;
    padding: 4px 0 4px 8px;
    line-height: 1.6;
    transition: all 0.2s ease;
    display: block;
}

.petrono-mega-menu-wrapper .petrono-menu-col a.petrono-sub-item:hover {
    color: #ed164b;
    padding-right: 4px;
}

/* -------------------------------------------
   ریسپانسیو (موبایل و تبلت)
------------------------------------------- */
@media (max-width: 991px) {
    .petrono-cat-dropdown-panel {
        width: 100%;
        max-width: 100vw;
    }
    .petrono-mega-menu-wrapper {
        flex-direction: column;
        border-radius: 8px;
    }
    .petrono-mega-menu-wrapper .petrono-mm-tabs {
        width: 100%;
        border-left: none;
        border-bottom: 1px solid #e2e8f0;
        display: flex;
        overflow-x: auto;
        padding: 6px 10px;
    }
    .petrono-mega-menu-wrapper .petrono-mm-tabs .petrono-tab-item {
        white-space: nowrap;
        padding: 10px 14px;
    }
    .petrono-mega-menu-wrapper .petrono-mm-tabs .petrono-tab-item.active::after {
        top: auto;
        bottom: 0;
        right: 0;
        width: 100%;
        height: 3px;
    }
    .petrono-mega-menu-wrapper .petrono-cols-4-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    .petrono-mega-menu-wrapper .petrono-mm-content-area {
        padding: 18px;
        max-height: 380px;
    }
}

@media (max-width: 576px) {
    .petrono-mega-menu-wrapper .petrono-cols-4-grid {
        grid-template-columns: 1fr;
    }
}
