/**
 * Mobile Menu Styles
 *
 * Includes dynamic thumbnail-based layouts for category submenus:
 * - Grid layout (all categories have thumbnails)
 * - Mixed grid layout (some categories have thumbnails)
 * - Text-only layout (no categories have thumbnails)
 */

/* =========================================================================
 * Category Grid Layout (Thumbnail-based)
 * ========================================================================= */

/**
 * Grid Layout Container
 * 3-column responsive grid for categories with thumbnails
 */
.category-grid-layout {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 12px 0;
}
/* Mobile Dropdown Menu - Two Column Layout */
.mobile-dropdown-menu {
    width: 100%;
    height: 89vh;
    background: #fff;
    overflow: hidden;
}

.menu-container {
    display: flex;
    height: 100%;
}

/* ============ 左側菜單 ============ */
.menu-left {
    width: 25%;
    background: #f7f7f7;
    overflow-y: auto;
    border-right: 1px solid #e0e0e0;
}

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

.main-menu-item {
    padding: 16px 15px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
    font-size: 14px;
    color: #333;
    background: #f7f7f7;
}

.main-menu-item:hover {
    background: #fff;
}

.main-menu-item.active {
    background: #fff;
    font-weight: 600;
    border-left: 3px solid #60cac8;
    padding-left: 12px;
}

.main-menu-item .arrow-right {
    font-size: 18px;
    color: #999;
    font-style: normal;
}

/* ============ 右側內容 ============ */
.menu-right {
    width: 75%;
    overflow-y: auto;
    padding: 20px;
    background: #fff;
}

.submenu-content {
    display: none;
}

.submenu-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* 子菜單標題 */
.submenu-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 0 0 15px 0;
}

/* 子菜單列表 */
.submenu-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.submenu-list li {
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

.submenu-list a {
    color: #555;
    text-decoration: none;
    font-size: 14px;
    display: block;
    transition: color 0.2s;
}

.submenu-list a:hover {
    color: #60cac8;
}

/* ============ 產品分類層級 ============ */
.category-section {
    margin-bottom: 25px;
}

.category-section:last-child {
    margin-bottom: 0;
}

/* 父分類標題 */
.category-parent-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #60cac8;
}

.category-parent-title a {
    color: #333;
    text-decoration: none;
}

.category-parent-title a:hover {
    color: #60cac8;
}

/* 子分類列表 */
.category-child-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.child-item {
    margin-bottom: 12px;
}

.child-item > a {
    color: #333;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    display: block;
    padding: 5px 0;
}

.child-item > a:hover {
    color: #60cac8;
}

/* 子子分類列表 */
.category-grandchild-list {
    list-style: none;
    padding: 0 0 0 15px;
    margin: 5px 0 0 0;
}

.grandchild-item {
    margin-bottom: 5px;
}

.grandchild-item a {
    color: #666;
    text-decoration: none;
    font-size: 13px;
    display: block;
    padding: 3px 0;
    position: relative;
    padding-left: 12px;
}

.grandchild-item a:before {
    content: "--";
    position: absolute;
    left: 0;
    color: #999;
}

.grandchild-item a:hover {
    color: #60cac8;
}

/* ============ 響應式設計 ============ */
@media (max-width: 480px) {
    .menu-left {
        width: 25%;
    }
    
    .menu-right {
        width: 75%;
        padding: 15px 12px;
    }
    
    .main-menu-item {
        padding: 14px 12px;
        font-size: 13px;
    }
    
    .submenu-title,
    .category-parent-title {
        font-size: 15px;
    }
    
    .submenu-list a,
    .child-item > a {
        font-size: 13px;
    }
    
    .grandchild-item a {
        font-size: 12px;
    }
}

/* 自定義滾動條 */
.menu-left::-webkit-scrollbar,
.menu-right::-webkit-scrollbar {
    width: 6px;
}

.menu-left::-webkit-scrollbar-track,
.menu-right::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.menu-left::-webkit-scrollbar-thumb,
.menu-right::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.menu-left::-webkit-scrollbar-thumb:hover,
.menu-right::-webkit-scrollbar-thumb:hover {
    background: #999;
}
/**
 * Grid Item
 * Individual category item in the grid
 */
.category-grid-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    text-decoration: none;
    color: inherit;
    transition: opacity 0.2s ease;
}

.category-grid-item:hover,
.category-grid-item:active {
    opacity: 0.7;
}

/**
 * Category Thumbnail
 * Image container with aspect ratio preservation
 */
.category-thumbnail {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 8px;
    background-color: #f5f5f5;
    margin-bottom: 8px;
}

.category-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/**
 * Category Title
 * Text label below thumbnail or standalone for no-thumbnail items
 */
.category-title {
    font-size: 13px;
    line-height: 1.3;
    color: #333;
    word-break: break-word;
}

/* =========================================================================
 * Mixed Grid Layout (Some thumbnails, some text-only)
 * ========================================================================= */

/**
 * No-Thumbnail Items in Mixed Layout
 * Items without thumbnails display title only, centered vertically
 */
.category-grid-item.no-thumbnail {
    justify-content: center;
    padding: 12px 8px;
    background-color: #f9f9f9;
    border-radius: 8px;
    min-height: 80px;
}

.category-grid-item.no-thumbnail .category-title {
    font-size: 14px;
    font-weight: 500;
}

/* =========================================================================
 * Responsive Adjustments
 * ========================================================================= */

/**
 * Small mobile screens (< 360px)
 * Reduce gap and font size for very small screens
 */
@media (max-width: 359px) {
    .category-grid-layout {
        gap: 8px;
    }

    .category-title {
        font-size: 12px;
    }

    .category-grid-item.no-thumbnail {
        min-height: 70px;
        padding: 8px 6px;
    }
}

/**
 * Larger mobile screens (> 480px)
 * Increase spacing and font size for better readability
 */
@media (min-width: 480px) {
    .category-grid-layout {
        gap: 16px;
    }

    .category-title {
        font-size: 14px;
    }

    .category-thumbnail {
        margin-bottom: 10px;
    }

    .category-grid-item.no-thumbnail {
        min-height: 90px;
        padding: 14px 10px;
    }
}

/* =========================================================================
 * Traditional Text-Only Layout (Backward Compatibility)
 * ========================================================================= */

/**
 * Category Child List
 * Traditional vertical list layout when no thumbnails are present
 */
.category-child-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.category-child-list .child-item {
    margin-bottom: 8px;
}

.category-child-list .child-item > a {
    display: block;
    padding: 10px 12px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    transition: background-color 0.2s ease;
}

.category-child-list .child-item > a:hover,
.category-child-list .child-item > a:active {
    background-color: #f5f5f5;
}

/**
 * Grandchild Categories
 * Nested subcategories under child categories
 */
.category-grandchild-list {
    list-style: none;
    padding-left: 16px;
    margin-top: 8px;
}

.category-grandchild-list .grandchild-item {
    margin-bottom: 6px;
}

.category-grandchild-list .grandchild-item > a {
    display: block;
    padding: 8px 10px;
    color: #666;
    text-decoration: none;
    font-size: 13px;
    transition: background-color 0.2s ease;
}

.category-grandchild-list .grandchild-item > a:hover,
.category-grandchild-list .grandchild-item > a:active {
    background-color: #f5f5f5;
}

/* =========================================================================
 * Category Section Container
 * ========================================================================= */

.category-section {
    margin-bottom: 24px;
}

.category-parent-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e0e0e0;
}

.category-parent-title a {
    color: #333;
    text-decoration: none;
}

.category-parent-title a:hover,
.category-parent-title a:active {
    color: #000;
}

/* =========================================================================
 * Standalone Footer Menu Styles
 * ========================================================================= */

/**
 * Footer Menu Container
 * 扁平化設計，用於頁尾導航
 */
.mmm-footer-menu {
    width: 100%;
    padding: 0;
}

/* Grid Layout (Default for footer) */
.mmm-footer-menu-grid {
    display: grid;
    gap: 40px;
    grid-template-columns: repeat(4, 1fr);
}

.mmm-footer-menu-grid.columns-1 {
    grid-template-columns: 1fr;
}

.mmm-footer-menu-grid.columns-2 {
    grid-template-columns: repeat(2, 1fr);
}

.mmm-footer-menu-grid.columns-3 {
    grid-template-columns: repeat(3, 1fr);
}

.mmm-footer-menu-grid.columns-4 {
    grid-template-columns: repeat(4, 1fr);
}

.mmm-footer-menu-grid.columns-5 {
    grid-template-columns: repeat(5, 1fr);
}

.mmm-footer-menu-grid.columns-6 {
    grid-template-columns: repeat(6, 1fr);
}

/* List Layout (Alternative) */
.mmm-footer-menu-list .footer-menu-section {
    margin-bottom: 30px;
}

.mmm-footer-menu-list .footer-menu-section:last-child {
    margin-bottom: 0;
}

/* Footer Menu Section */
.footer-menu-section {
    display: flex;
    flex-direction: column;
}

/* Footer Menu Title */
.footer-menu-title {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 12px 0;
    padding: 0;
    color: #333;
    text-transform: none;
    border: none;
}

.footer-menu-title a {
    color: inherit;
    text-decoration: none;
}

/* Footer Menu Links List */
.footer-menu-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.footer-menu-links li {
    margin: 0;
    padding: 0;
}

.footer-menu-links a {
    color: #666;
    text-decoration: none;
    font-size: 13px;
    line-height: 1.5;
    transition: color 0.2s ease;
    display: inline-block;
}

.footer-menu-links a:hover {
    color: #333;
}

/* Responsive: Tablet */
@media (max-width: 1024px) {
    .mmm-footer-menu-grid.columns-4,
    .mmm-footer-menu-grid.columns-5,
    .mmm-footer-menu-grid.columns-6 {
        grid-template-columns: repeat(3, 1fr);
        gap: 30px;
    }
}

/* Responsive: Mobile */
@media (max-width: 768px) {
    .mmm-footer-menu-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }

    .footer-menu-title {
        font-size: 13px;
        margin-bottom: 10px;
    }

    .footer-menu-links {
        gap: 6px;
    }

    .footer-menu-links a {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .mmm-footer-menu-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}
