/**
 * MG Mega Menu Styles
 *
 * @package MG_Mega_Menu
 */

/* ==================== DESKTOP VIEW: 4 COLUMN GRID ==================== */

.mgmm-desktop-view {
    display: block;
}

.mgmm-grid {
    display: flex;
    gap: 30px;
    width: 100%;
}

/* Column widths (controlled by Elementor) */
.mgmm-col {
    position: relative;
}

.mgmm-col-1 {
    flex: 0 0 20%;
    max-width: 20%;
}

.mgmm-col-2,
.mgmm-col-3,
.mgmm-col-4 {
    position: relative; /* For absolute positioning of hidden content */
}

.mgmm-col-2 {
    flex: 0 0 30%;
    max-width: 30%;
}

.mgmm-col-3 {
    flex: 0 0 25%;
    max-width: 25%;
}

.mgmm-col-4 {
    flex: 0 0 25%;
    max-width: 25%;
}

/* ==================== COLUMN 1: MAIN CATEGORIES ==================== */

.mgmm-main-category-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mgmm-main-category-item {
    padding: 5px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #333333;
    background-color: transparent;
}

.mgmm-main-category-item:hover,
.mgmm-main-category-item.mgmm-active {
    background-color: #f5f5f5;
    color: #000000;
    font-weight: 600;
}

.mgmm-category-link {
    color: inherit;
    text-decoration: none;
    flex: 1;
}

.mgmm-category-icon {
    font-size: 16px;
}

/* ==================== COLUMN 2: SUBCATEGORIES (DYNAMIC) ==================== */

.mgmm-subcategory-wrapper {
    position: relative;
    width: 100%;
    min-height: 300px; /* Prevent height collapse */
}

.mgmm-subcategory-list {
    list-style: none;
    margin: 0;
    padding: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Hidden subcategories */
.mgmm-subcategory-list:not(.mgmm-active) {
    opacity: 0;
    visibility: hidden;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
}

/* Active subcategories */
.mgmm-subcategory-list.mgmm-active {
    opacity: 1;
    visibility: visible;
    position: relative;
}

.mgmm-subcategory-item {
    padding: 5px 0;
}

.mgmm-subcategory-link {
    color: #666666;
    text-decoration: none;
    transition: color 0.3s ease;
    display: block;
}

.mgmm-subcategory-link:hover {
    color: #000000;
    text-decoration: underline;
}

/* ==================== COLUMN 3: FEATURED (固定內容) ==================== */

.mgmm-featured-wrapper {
    position: relative;
    width: 100%;
    min-height: 200px;
}

.mgmm-featured-content {
    /* 固定內容，永遠顯示 */
}

.mgmm-featured-header {
    font-size: 14px;
    font-weight: 600;
    color: #333333;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.mgmm-featured-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mgmm-featured-item {
    margin-bottom: 5px;
}

.mgmm-featured-link {
    display: block;
    color: #333333;
    text-decoration: none;
    transition: color 0.3s ease;
}

.mgmm-featured-link:hover {
    color: #000000;
    font-weight: 600;
}

/* ==================== COLUMN 4: PROMO (固定內容) ==================== */

.mgmm-promo-wrapper {
    position: relative;
    width: 100%;
    min-height: 250px;
}

.mgmm-promo-content {
    /* 固定內容，永遠顯示 */
}

.mgmm-promo-link {
    display: block;
    text-decoration: none;
    overflow: hidden;
}

.mgmm-promo-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
}

.mgmm-promo-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mgmm-promo-title {
    padding: 15px 0;
    background-color: transparent;
    text-align: left;
    font-weight: 400;
    color: #333333;
}

/* ==================== MOBILE VIEW: ACCORDION ==================== */

.mgmm-mobile-view {
    display: none;
}

.mgmm-accordion-item {
    border-bottom: 1px solid #e0e0e0;
}

.mgmm-accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    cursor: pointer;
    background-color: #ffffff;
    transition: background-color 0.3s ease;
    user-select: none;
}

.mgmm-accordion-header:hover {
    background-color: #f5f5f5;
}

.mgmm-accordion-title {
    font-size: 16px;
    font-weight: 600;
    color: #333333;
}

.mgmm-accordion-icon {
    font-size: 14px;
    color: #666666;
    transition: transform 0.3s ease;
}

.mgmm-accordion-item.mgmm-expanded .mgmm-accordion-icon {
    transform: rotate(180deg);
}

.mgmm-accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
    background-color: #fafafa;
}

.mgmm-mobile-section {
    padding: 15px 20px;
    border-top: 1px solid #e0e0e0;
}

.mgmm-mobile-section-title {
    font-size: 14px;
    font-weight: 600;
    color: #333333;
    margin: 0 0 10px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.mgmm-mobile-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mgmm-mobile-list li {
    padding: 8px 0;
}

.mgmm-mobile-list a {
    color: #666666;
    text-decoration: none;
    display: block;
}

.mgmm-mobile-list a:hover {
    color: #000000;
}

.mgmm-mobile-promo {
    padding: 15px;
}

.mgmm-mobile-promo a {
    display: block;
    border-radius: 8px;
    overflow: hidden;
}

.mgmm-mobile-promo img {
    width: 100%;
    height: auto;
    display: block;
}

.mgmm-mobile-promo span {
    display: block;
    padding: 12px;
    background-color: #ffffff;
    text-align: center;
    font-weight: 600;
    color: #333333;
}

/* ==================== ANIMATIONS ==================== */

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

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

/* ==================== RESPONSIVE DESIGN ==================== */

/* Tablet (1024px and below) */
@media (max-width: 1024px) {
    .mgmm-col-1 {
        flex: 0 0 25%;
        max-width: 25%;
    }

    .mgmm-col-2 {
        flex: 0 0 35%;
        max-width: 35%;
    }

    .mgmm-col-3,
    .mgmm-col-4 {
        flex: 0 0 20%;
        max-width: 20%;
    }

    .mgmm-promo-image {
        height: 150px;
    }
}

/* Mobile (767px and below) */
@media (max-width: 767px) {
    /* Hide desktop view */
    .mgmm-desktop-view {
        display: none !important;
    }

    /* Show mobile view */
    .mgmm-mobile-view {
        display: block !important;
    }
}

/* ==================== UTILITIES ==================== */

/* Prevent text selection during interactions */
.mgmm-mega-menu * {
    -webkit-tap-highlight-color: transparent;
}

/* Smooth transitions */
.mgmm-mega-menu a,
.mgmm-mega-menu button {
    outline: none;
}
