/* Import a clean Persian font */
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;700&display=swap');

/* === Universal Box Sizing === */
* {
    box-sizing: border-box;
}


/* === Wrapper for Button & Menu === */
.menu-wrapper {
    position: relative; /* Anchor for the absolute positioned menu */
    display: inline-block; /* Takes the size of its content */
}

/* === Category Toggle Button (MODIFIED) === */
.category-button {
    display: inline-flex;
    align-items: center;
    gap: 12px; /* Increased gap */
    padding: 16px 30px; /* Increased padding */
    font-family: 'IRANSans', sans-serif;
    font-size: 14px; /* Increased font size */
    font-weight: 700;
    color: #212529;
    background-color: #ffe000; /* Yellow color like the original screenshot */
    border: none;
    border-radius: 10px; /* Slightly larger radius */
    cursor: pointer;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}
.category-button:hover {
    background-color: #f1d720;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* === Arrow icon inside the button (NEW) === */
.button-arrow {
    transition: transform 0.3s ease;
}
.category-button.is-open .button-arrow {
    transform: rotate(180deg);
}

/* === Main Menu Container (MODIFIED FOR TOGGLE) === */
.gooyax_main-mega-menu {
    direction: rtl; /* Crucial for RTL layout */
    width: 100%;
    max-width: 1200px; /* Increased width */
    min-width: 900px;
    height: 600px; /* Increased height */
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);

    /* New properties for hiding/showing */
    position: absolute;
    top: 100%; /* Position it right below the button */
    right: 0;
    margin-top: 12px;
    z-index: 1000;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s 0.3s;
}

.gooyax_main-mega-menu.is-visible {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s 0s;
}

/* === Inner Wrapper for content clipping === */
.menu-inner-wrapper {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    direction: rtl;
    overflow: hidden;
    border-radius: inherit; /* Inherits border-radius from parent */
}

/* === Menu Pointer Arrow (NEW) === */
.menu-pointer {
    position: absolute;
    bottom: 100%;
    right: 40px; /* Adjust to align with button center */
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 10px solid #666666;
    z-index: 1002;
}




/* === Close button for mobile === */
.mobile-menu-close {
    display: none; /* Hidden on desktop */
    position: absolute;
    top: 15px;
    left: 15px;
    background: #eee;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    z-index: 1010;
}

/* === Right Column: Main Category List === */
.category-list {
    width: 240px;
    flex-shrink: 0; /* Prevents this column from shrinking */
    background-color: #f7f8fa;
    border-left: 1px solid #e0e0e0;
    overflow-y: auto; /* Add scroll if categories are too many */
}

.category-list ul {
    list-style-type: none;
    padding: 8px 0;
    margin: 0;
}

.category-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0px 0px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    border-right: 4px solid transparent;
}

.category-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    font-size: 14px;
    color: #333;
    transition: background-color 0.2s ease, color 0.2s ease;
    text-decoration: none;
    width: 100%;
}

.category-list-item img {
    width: 40px;
    height: 40px;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.category-list-item .category-link,
.category-list-item .category-link:visited {
    color: #444444; /* <-- Ø§ÛŒÙ†Ø¬Ø§ Ø±Ù†Ú¯ Ù…ØªÙ† Ø§ØµÙ„ÛŒ Ùˆ Ø¹Ø§Ø¯ÛŒ Ù„ÛŒÙ†Ú© Ø±Ø§ Ù‚Ø±Ø§Ø± Ø¯Ù‡ÛŒØ¯ */
}

.category-list-item:hover .category-link {
    background-color: #f0f2f5;
    color: #000;
}

.category-list-item:hover img {
    opacity: 1;
}

.category-list-item.active {
    border-right-color: #f97316; /* Orange accent for active item */
}

.category-list-item.active .category-link {
    background-color: #ffffff;
    font-weight: 700;
    color: #000;
}
.category-list-item.active img {
    opacity: 1;
}

/* === Left Column: Subcategory Content Area (REVISED) === */
.category-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

#dynamic-category-title {
    font-size: 20px;
    font-weight: 700;
    margin: 25px 25px 20px 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.panels-wrapper {
    flex-grow: 1;
    overflow-y: auto; /* Make ONLY this part scrollable */
    padding: 0 25px 25px;
    scrollbar-gutter: stable; /* Reserve space for scrollbar to prevent layout shift */
}

.content-panel {
    display: none; /* All panels are hidden by default */
    animation: fadeIn 0.3s ease-in-out;
}

.content-panel.active {
    display: block; /* Only the active panel is shown */
}

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

/* === Grid for Subcategories === */
.subcategory-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr); /* 5 columns for desktop */
    gap: 25px 20px;
}

.subcategory-item {
    text-align: center;
    text-decoration: none;
    color: #555;
    position: relative; /* For positioning the HOT badge */
    transition: transform 0.2s ease;
}
.subcategory-item:hover {
    transform: translateY(-4px);
}

.subcategory-item img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 10px;
    border: 1px solid #f0f0f0;
    background-color: #f7f8fa; /* Placeholder bg */
    transition: box-shadow 0.2s ease;
}
.subcategory-item:hover img {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.subcategory-item span {
    font-size: 13px;
    display: block;
}

/* === "HOT" Badge === */
.hot-badge {
    position: absolute;
    top: -4px;
    right: 0;
    background: linear-gradient(45deg, #ff4747, #ff6b6b);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    border: 1px solid #fff;
}

/* === View All Button (NEW) === */
.view-all-mobile {
    display: none; /* Hidden by default */
}
.view-all-icon-wrapper {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background-color: #f0f2f5;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px auto;
    border: 1px solid #e0e0e0;
}
.view-all-icon-wrapper svg {
    color: #555;
}

/* ============================ */
/* === RESPONSIVE STYLES FOR MOBILE === */
/* ============================ */
@media (max-width: 768px) {
    .gooyax_main-mega-menu {
        position: fixed;
        top: 0;
        right: 0;
        width: 100%;
        height: 100%;
        max-width: 100%;
        min-width: 100%;
        border-radius: 0;
        margin-top: 0;
        transform: translateX(100%);
        transition: transform 0.3s ease-in-out, visibility 0s 0.3s;
    }

    .category-list-item img {
        width: 24px;
        height: 24px;
        opacity: 0.7;
        transition: opacity 0.2s ease;
    }
    .menu-inner-wrapper {
        flex-direction: row;
    }

    .gooyax_main-mega-menu.is-visible {
        transform: translateX(0);
        transition: transform 0.3s ease-in-out, visibility 0s 0s;
    }

    .menu-pointer, .menu-pointer::before {
        display: none; /* Hide pointer on mobile */
    }

    .mobile-menu-close {
        display: block; /* Show close button on mobile */
    }

    .category-list {
        width: 110px; /* Fixed width for the main categories */
        height: 100%; /* Full height */
        border-left: 1px solid #e0e0e0; /* Separator line */
        border-bottom: none; /* Removed bottom border */
        flex-shrink: 0;
    }

    .category-list-item {
        padding: 10px 5px;
        justify-content: center;
        flex-direction: column; /* این دستور باعث می‌شود آیتم‌ها زیر هم قرار بگیرند */
        text-align: center;
        gap: 6px;
    }
    .category-list-item span {
        font-size: 12px; /* Adjusted font size for better readability */
    }
    .category-link {
        padding: 0px 0px;
        justify-content: center;
        flex-direction: column;
        text-align: center;
        gap: 6px;
    }

    .category-content {
        width: auto; /* Width will be handled by flex-grow */
        height: 100%; /* Full height */
        padding: 0;
    }

    #dynamic-category-title {
        font-size: 16px;
        padding-bottom: 10px;
        margin: 15px;
        padding-top: 45px; /* Space for close button */
    }

    .panels-wrapper {
        padding: 0 15px 15px 15px; /* Apply padding here for mobile */
    }

    .subcategory-grid {
        grid-template-columns: repeat(3, 1fr); /* Changed to 3 columns for mobile */
        gap: 20px 15px; /* Adjusted gap */
    }

    .view-all-mobile {
        display: block; /* Show on mobile */
    }

    .subcategory-item img {
        width: 100%; /* Make images responsive */
        height: auto;
        aspect-ratio: 1 / 1; /* Keep them square */
        margin-bottom: 8px;
    }

    .subcategory-item span {
        font-size: 12px; /* Adjusted font size for better readability */
    }
}
