/* Icon Grid Module v1.6.0 - Frontend Styles */

/* Base wrap and grid */
.igm-wrap {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.igm-grid {
    display: flex !important;
    flex-wrap: wrap !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* Base item style */
.igm-item {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-decoration: none !important;
    padding: 10px 6px !important;
    border-radius: 8px !important;
    transition: all .3s !important;
    box-sizing: border-box !important;
    min-width: 0 !important;
    position: relative !important;
    overflow: hidden !important;
}

.igm-item img {
    transition: filter .3s, transform .3s !important;
    border-radius: 10px !important;
}

.igm-item span {
    transition: color .3s !important;
}

/* ==================== Hover Effects ==================== */
.igm-grid[data-hover="1"] .igm-item::before {
    content: "" !important;
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 3px !important;
    background: linear-gradient(90deg, #2271b1, #2ed573) !important;
    transform: scaleX(0) !important;
    transition: transform .3s !important;
}

.igm-grid[data-hover="1"] .igm-item:hover::before {
    transform: scaleX(1) !important;
}

.igm-grid[data-hover="1"] .igm-item:hover {
    background: rgba(0, 0, 0, .04) !important;
}

.igm-grid[data-hover="1"] .igm-item:hover img {
    filter: brightness(1.1) !important;
}

/* ==================== Ripple Effect ==================== */
.igm-ripple .igm-item {
    overflow: hidden !important;
}

.igm-ripple .igm-item::after {
    content: "" !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    width: 0 !important;
    height: 0 !important;
    border-radius: 50% !important;
    background: rgba(34, 113, 177, .2) !important;
    transform: translate(-50%, -50%) !important;
    transition: width .6s, height .6s !important;
    pointer-events: none !important;
}

.igm-ripple .igm-item:active::after {
    width: 200% !important;
    height: 200% !important;
}

/* ==================== Rotate Effect ==================== */
.igm-rotate .igm-item:hover img {
    transform: rotate(8deg) scale(1.05) !important;
}

/* ==================== Badge Styles ==================== */
.igm-badge {
    display: inline-block !important;
    padding: 2px 6px !important;
    border-radius: 10px !important;
    font-size: 10px !important;
    font-weight: bold !important;
    color: #fff !important;
    line-height: 1.2 !important;
    position: absolute !important;
    top: -6px !important;
    right: -6px !important;
    z-index: 2 !important;
}

.igm-badge-hot { background: #ff4757 !important; }
.igm-badge-new { background: #ffa502 !important; }
.igm-badge-recommend { background: #2ed573 !important; }
.igm-badge-vip { background: #9b59b6 !important; }

/* ==================== Style 1: Default ==================== */
.igm-style-default .igm-item {
    background: #fff !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .08) !important;
}

.igm-style-default .igm-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, .12) !important;
}

/* ==================== Style 2: Card ==================== */
.igm-style-card .igm-item {
    background: #fff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 12px !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .05) !important;
}

.igm-style-card .igm-item:hover {
    border-color: #2271b1 !important;
    box-shadow: 0 4px 20px rgba(34, 113, 177, .15) !important;
}

.igm-style-card .igm-item img {
    border-radius: 8px !important;
}

/* ==================== Style 3: Flat ==================== */
.igm-style-flat .igm-item {
    background: transparent !important;
    border-radius: 8px !important;
}

.igm-style-flat .igm-item:hover {
    background: rgba(34, 113, 177, .08) !important;
}

.igm-style-flat .igm-item img {
    border-radius: 6px !important;
}

/* ==================== Style 4: Gradient Border ==================== */
.igm-style-gradient .igm-item {
    background: linear-gradient(#fff, #fff) padding-box,
                linear-gradient(135deg, #667eea, #764ba2) border-box !important;
    border: 2px solid transparent !important;
    border-radius: 12px !important;
    padding: 12px 8px !important;
}

.igm-style-gradient .igm-item:hover {
    background: linear-gradient(#f8fafc, #f1f5f9) padding-box,
                linear-gradient(135deg, #667eea, #764ba2) border-box !important;
}

.igm-style-gradient .igm-item img {
    border-radius: 6px !important;
}

/* ==================== Style 5: Modern ==================== */
.igm-style-modern .igm-item {
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8ec 100%) !important;
    border-radius: 16px !important;
    padding: 16px 8px !important;
}

.igm-style-modern .igm-item:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
}

.igm-style-modern .igm-item:hover span {
    color: #fff !important;
}

.igm-style-modern .igm-item img {
    border-radius: 50% !important;
    padding: 8px !important;
    background: #fff !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .1) !important;
}

.igm-style-modern .igm-item:hover img {
    background: rgba(255, 255, 255, .2) !important;
}

/* ==================== Dark Mode ==================== */
@media (prefers-color-scheme: dark) {
    .igm-dark-mode .igm-item {
        background: #1e1e1e !important;
        border-color: #333 !important;
    }

    .igm-dark-mode .igm-item:hover {
        background: #2a2a2a !important;
    }

    .igm-dark-mode .igm-item span {
        color: #e0e0e0 !important;
    }

    .igm-dark-mode .igm-empty {
        color: #888 !important;
    }

    .igm-dark-mode.igm-style-default .igm-item {
        background: #2a2a2a !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, .3) !important;
    }

    .igm-dark-mode.igm-style-card .igm-item {
        background: #2a2a2a !important;
        border-color: #444 !important;
    }

    .igm-dark-mode.igm-style-modern .igm-item {
        background: linear-gradient(135deg, #2a2a2a 0%, #333 100%) !important;
    }
}

/* ==================== Empty State ==================== */
.igm-empty {
    text-align: center !important;
    color: #999 !important;
    padding: 20px !important;
    font-size: 14px !important;
}

/* ==================== RiPro-V5 Compatibility ==================== */
[class*="igm-"] > *,
.igm-wrap,
.igm-grid,
.igm-item,
.igm-item * {
    max-width: none !important;
    width: auto !important;
    min-width: 0 !important;
    flex-shrink: 0 !important;
}

/* Force override theme styles */
.igm-wrap * {
    box-sizing: border-box !important;
}

/* ==================== Responsive ==================== */
@media (max-width: 768px) {
    .igm-item {
        padding: 8px 4px !important;
    }
    
    .igm-style-modern .igm-item img {
        width: 48px !important;
        height: 48px !important;
    }
}

@media (max-width: 480px) {
    .igm-item {
        padding: 6px 2px !important;
    }
    
    .igm-style-modern .igm-item {
        padding: 12px 4px !important;
    }
    
    .igm-style-modern .igm-item img {
        width: 40px !important;
        height: 40px !important;
        padding: 4px !important;
    }
}