/* ========================================
   Mega Menu Styles
   ======================================== */

/* Mega Menu Container */
.cmb-mega-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    z-index: 9999;
    display: none;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    overflow: hidden;
    visibility: hidden;
}

.cmb-mega-menu-overlay.active {
    display: flex;
    visibility: visible;
}

.cmb-mega-menu-overlay.show {
    transform: translateX(0);
    visibility: visible;
}

/* Mega Menu Header */
.cmb-mega-menu-header {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 2px solid #e5e5e5;
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.cmb-mega-menu-back {
    background: none;
    border: none;
    padding: 8px 12px;
    margin-right: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #000;
    transition: background-color 0.2s;
    border-radius: 4px;
}

.cmb-mega-menu-back:hover {
    background-color: #f5f5f5;
}

.cmb-mega-menu-title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    flex: 1;
    text-align: center;
    padding-right: 50px;
    color: #000;
}

.cmb-mega-menu-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 20px;
}

/* Mega Menu Products Grid */
.cmb-mega-menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Mega Menu Product Card */
.cmb-mega-product-card {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
}

.cmb-mega-product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-color: #d0d0d0;
}

.cmb-mega-product-image {
    width: 100%;
    height: 150px;
    background: #f9f9f9;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.cmb-mega-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cmb-mega-product-image .cmb-product-placeholder {
    width: 60px;
    height: 60px;
    opacity: 0.3;
    color: #999;
}

.cmb-mega-product-info {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.cmb-mega-product-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    color: #000;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 2.8em;
}

.cmb-mega-product-price {
    font-size: 16px;
    font-weight: 700;
    color: #0073aa;
    margin-top: auto;
}

.cmb-mega-product-price del {
    font-size: 12px;
    color: #999;
    font-weight: normal;
    margin-right: 6px;
}

.cmb-mega-product-sku {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
}

/* Mega Menu List View (Alternative) */
.cmb-mega-menu-list-view {
    list-style: none;
    margin: 0;
    padding: 0;
}

.cmb-mega-menu-list-view .cmb-mega-product-card {
    flex-direction: row;
    margin-bottom: 12px;
}

.cmb-mega-menu-list-view .cmb-mega-product-image {
    width: 120px;
    height: 120px;
    flex-shrink: 0;
}

.cmb-mega-menu-list-view .cmb-mega-product-info {
    padding: 16px;
    justify-content: center;
}

.cmb-mega-menu-list-view .cmb-mega-product-title {
    -webkit-line-clamp: 3;
    min-height: auto;
}

/* Mega Menu Category Filter (if needed) */
.cmb-mega-menu-filters {
    padding: 16px 20px;
    border-bottom: 1px solid #e5e5e5;
    background: #f9f9f9;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.cmb-mega-filter-btn {
    padding: 6px 12px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.cmb-mega-filter-btn:hover,
.cmb-mega-filter-btn.active {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
}

/* Mega Menu Stats */
.cmb-mega-menu-stats {
    padding: 12px 20px;
    background: #f9f9f9;
    border-bottom: 1px solid #e5e5e5;
    font-size: 13px;
    color: #666;
    text-align: center;
}

/* Responsive Design */
@media (max-width: 768px) {
    .cmb-mega-menu-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }
    
    .cmb-mega-product-image {
        height: 120px;
    }
    
    .cmb-mega-product-title {
        font-size: 13px;
    }
    
    .cmb-mega-product-price {
        font-size: 14px;
    }
    
    .cmb-mega-menu-title {
        font-size: 18px;
    }
    
    .cmb-mega-menu-content {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .cmb-mega-menu-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .cmb-mega-product-image {
        height: 100px;
    }
    
    .cmb-mega-product-info {
        padding: 10px;
    }
    
    .cmb-mega-product-title {
        font-size: 12px;
        min-height: 2.4em;
    }
    
    .cmb-mega-product-price {
        font-size: 13px;
    }
}

/* Loading State for Mega Menu */
.cmb-mega-menu-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    flex-direction: column;
    gap: 16px;
}

.cmb-mega-menu-loading .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.cmb-mega-menu-loading-text {
    color: #666;
    font-size: 14px;
}

/* Empty State */
.cmb-mega-menu-empty {
    padding: 60px 20px;
    text-align: center;
    color: #999;
}

.cmb-mega-menu-empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.cmb-mega-menu-empty-text {
    font-size: 16px;
    margin-bottom: 8px;
}

.cmb-mega-menu-empty-subtext {
    font-size: 13px;
    color: #999;
}

/* Mega Menu Badge */
.cmb-mega-menu-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #0073aa;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    border-radius: 3px;
    margin-left: 8px;
    vertical-align: middle;
}

/* Animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cmb-mega-product-card {
    animation: fadeInUp 0.3s ease-out;
}

.cmb-mega-product-card:nth-child(1) { animation-delay: 0.05s; }
.cmb-mega-product-card:nth-child(2) { animation-delay: 0.1s; }
.cmb-mega-product-card:nth-child(3) { animation-delay: 0.15s; }
.cmb-mega-product-card:nth-child(4) { animation-delay: 0.2s; }
.cmb-mega-product-card:nth-child(5) { animation-delay: 0.25s; }
.cmb-mega-product-card:nth-child(6) { animation-delay: 0.3s; }
