/* ==========================================================================
   CRERP - Item Card Group / Trending Products (Exact Match to All Products)
   ========================================================================== */

.item-card-group-section,
section[data-section-template="Item Card Group"] {
    width: 100%;
    margin-top: 1.5rem;
    margin-bottom: 2.5rem;
    box-sizing: border-box;
}

/* 1. Section Header */
.item-card-group-section .item-group-header,
section[data-section-template="Item Card Group"] .item-group-header {
    display: flex !important;
    align-items: flex-end !important;
    justify-content: space-between !important;
    margin-bottom: 12px !important;
    padding-bottom: 6px !important;
    border-bottom: 1px solid #f1f5f9;
}

.item-card-group-section .title-section,
section[data-section-template="Item Card Group"] .title-section {
    margin: 0 !important;
    padding: 0 !important;
}

.item-card-group-section .section-title,
section[data-section-template="Item Card Group"] .section-title {
    font-size: 18px !important;
    font-weight: 800 !important;
    letter-spacing: -0.3px !important;
    margin: 0 !important;
    line-height: 1.25 !important;
    color: var(--coderiven-dark, #0f172a) !important;
}

.item-card-group-section .section-description,
section[data-section-template="Item Card Group"] .section-description {
    font-size: 12px !important;
    color: var(--coderiven-muted, #64748b) !important;
    margin: 2px 0 0 0 !important;
}

.item-card-group-section .btn-view-all {
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    padding: 4px 12px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    color: #1e293b !important;
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px !important;
    text-decoration: none !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04) !important;
    transition: all 0.15s ease !important;
}

.item-card-group-section .btn-view-all:hover {
    background: #f8fafc !important;
    border-color: #94a3b8 !important;
    color: #0f172a !important;
}

/* 2. Grid & Columns */
.item-card-group-section .row,
section[data-section-template="Item Card Group"] .row {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: stretch !important;
    margin-left: -4px !important;
    margin-right: -4px !important;
}

.item-card-group-section .item-card,
.item-card-group-section .row > [class*="col-"],
section[data-section-template="Item Card Group"] .item-card,
section[data-section-template="Item Card Group"] .row > [class*="col-"] {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    padding-left: 4px !important;
    padding-right: 4px !important;
    margin-bottom: 8px !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    flex: 0 0 25% !important;
    max-width: 25% !important;
    width: 25% !important;
}

@media (max-width: 991.98px) {
    .item-card-group-section .item-card,
    .item-card-group-section .row > [class*="col-"],
    section[data-section-template="Item Card Group"] .item-card,
    section[data-section-template="Item Card Group"] .row > [class*="col-"] {
        flex: 0 0 33.333333% !important;
        max-width: 33.333333% !important;
        width: 33.333333% !important;
    }
}

/* 3. Product Card Styling (Matching All-Products) */
.item-card-group-section .card,
section[data-section-template="Item Card Group"] .card,
.item-card .card {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 100% !important;
    flex: 1 1 auto !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    position: relative !important;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease !important;
}

.item-card-group-section .card:hover,
section[data-section-template="Item Card Group"] .card:hover,
.item-card .card:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.06) !important;
    border-color: #e2e8f0 !important;
}

/* 4. Card Image Area & Placeholder Centering (Strict 1:1 Aspect Ratio) */
.item-card-group-section .card-img-container,
section[data-section-template="Item Card Group"] .card-img-container,
.item-card .card-img-container {
    width: 100% !important;
    aspect-ratio: 1 / 1 !important;
    height: auto !important;
    min-height: unset !important;
    max-height: unset !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #ffffff !important;
    padding: 5px !important;
    margin: 0 !important;
    position: relative !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
}

.item-card-group-section .card-img-container a,
section[data-section-template="Item Card Group"] .card-img-container a,
.item-card .card-img-container a {
    width: 100% !important;
    height: 100% !important;
    min-height: 100% !important;
    max-height: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-decoration: none !important;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
}

.item-card-group-section .card-img,
section[data-section-template="Item Card Group"] .card-img,
.item-card .card-img {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    object-position: center !important;
    margin: 0 auto !important;
    display: block !important;
    transition: transform 0.25s ease !important;
}

.item-card-group-section .card:hover .card-img,
section[data-section-template="Item Card Group"] .card:hover .card-img,
.item-card .card:hover .card-img {
    transform: scale(1.04) !important;
}

.item-card-group-section .card-img-top.no-image,
.item-card-group-section .no-image,
section[data-section-template="Item Card Group"] .no-image,
.item-card .no-image {
    width: 100% !important;
    height: 100% !important;
    min-height: 100% !important;
    max-height: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    line-height: 1 !important;
    margin: 0 !important;
    padding: 0 !important;
    font-weight: 700 !important;
    font-size: 22px !important;
    color: #cbd5e1 !important;
    background: #ffffff !important;
    border-radius: 0 !important;
    letter-spacing: 1px !important;
}

/* 5. Floating Wishlist (Top-Right) & Cart Indicator (Top-Left) */
.item-card-group-section .like-action,
section[data-section-template="Item Card Group"] .like-action,
.item-card .like-action {
    position: absolute !important;
    top: 6px !important;
    right: 6px !important;
    left: auto !important;
    bottom: auto !important;
    z-index: 5 !important;
    width: 26px !important;
    height: 26px !important;
    border-radius: 50% !important;
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.item-card-group-section .like-action:hover,
section[data-section-template="Item Card Group"] .like-action:hover,
.item-card .like-action:hover {
    transform: scale(1.08) !important;
    border-color: #fda4af !important;
    background: #fff1f2 !important;
}

.item-card-group-section .like-action:focus-visible,
section[data-section-template="Item Card Group"] .like-action:focus-visible,
.item-card .like-action:focus-visible {
    outline: 2px solid #fda4af !important;
    outline-offset: 1px !important;
}

.item-card-group-section .like-action.like-action-wished,
section[data-section-template="Item Card Group"] .like-action.like-action-wished,
.item-card .like-action.like-action-wished {
    border-color: #fda4af !important;
    background: #fff1f2 !important;
}

.item-card-group-section .like-action.like-action-wished:hover,
section[data-section-template="Item Card Group"] .like-action.like-action-wished:hover,
.item-card .like-action.like-action-wished:hover {
    border-color: #f43f5e !important;
    background: #ffe4e6 !important;
}

.item-card-group-section .like-action svg,
.item-card-group-section .like-action use,
section[data-section-template="Item Card Group"] .like-action svg,
section[data-section-template="Item Card Group"] .like-action use,
.item-card .like-action svg,
.item-card .like-action use {
    pointer-events: none !important;
}

.item-card-group-section .like-action .wish-icon,
section[data-section-template="Item Card Group"] .like-action .wish-icon,
.item-card .like-action .wish-icon {
    width: 13px !important;
    height: 13px !important;
    stroke: #64748b !important;
    fill: none !important;
    transition: all 0.15s ease !important;
}

.item-card-group-section .like-action.like-action-wished .wish-icon,
.item-card-group-section .like-action .wish-icon.wished,
section[data-section-template="Item Card Group"] .like-action.like-action-wished .wish-icon,
.item-card .like-action.like-action-wished .wish-icon {
    stroke: #e11d48 !important;
    fill: #e11d48 !important;
}

.item-card-group-section .like-action:not(.like-action-wished) .wish-icon.not-wished,
section[data-section-template="Item Card Group"] .like-action:not(.like-action-wished) .wish-icon.not-wished,
.item-card .like-action:not(.like-action-wished) .wish-icon.not-wished {
    stroke: #64748b !important;
    fill: none !important;
}

.item-card-group-section .cart-indicator,
section[data-section-template="Item Card Group"] .cart-indicator,
.item-card .cart-indicator {
    position: absolute !important;
    top: 6px !important;
    left: 6px !important;
    right: auto !important;
    bottom: auto !important;
    z-index: 5 !important;
    background: var(--primary, #1a7ef2) !important;
    color: #ffffff !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    width: 20px !important;
    height: 20px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15) !important;
    pointer-events: none !important;
}

.item-card-group-section .cart-indicator.hidden,
section[data-section-template="Item Card Group"] .cart-indicator.hidden,
.item-card .cart-indicator.hidden {
    display: none !important;
}

/* 6. Card Body */
.item-card-group-section .card-body,
section[data-section-template="Item Card Group"] .card-body,
.item-card .card-body {
    padding: 6px 8px 8px !important;
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    justify-content: flex-start !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.item-card-group-section .product-category,
section[data-section-template="Item Card Group"] .product-category,
.item-card .product-category {
    font-size: 10px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    color: #94a3b8 !important;
    letter-spacing: 0.3px !important;
    margin-bottom: 2px !important;
}

.item-card-group-section .card-body a:not(.hidden):not(.btn-explore-link):not(.go-to-cart-link),
section[data-section-template="Item Card Group"] .card-body a:not(.hidden):not(.btn-explore-link):not(.go-to-cart-link),
.item-card .card-body a:not(.hidden):not(.btn-explore-link):not(.go-to-cart-link) {
    text-decoration: none !important;
    color: inherit !important;
    display: block !important;
    width: 100% !important;
}

.item-card-group-section .product-title,
section[data-section-template="Item Card Group"] .product-title,
.item-card .product-title {
    font-size: 12.5px !important;
    font-weight: 600 !important;
    color: #0f172a !important;
    line-height: 1.35 !important;
    min-height: 2.7em !important;
    max-height: 2.7em !important;
    height: 2.7em !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
    margin-bottom: 3px !important;
    transition: color 0.15s ease !important;
}

.item-card-group-section .card:hover .product-title,
section[data-section-template="Item Card Group"] .card:hover .product-title,
.item-card .card:hover .product-title {
    color: var(--primary, #007bff) !important;
}

/* 7. Price Section */
.item-card-group-section .product-price,
section[data-section-template="Item Card Group"] .product-price,
.item-card .product-price {
    font-size: 13.5px !important;
    font-weight: 700 !important;
    color: var(--primary, #007bff) !important;
    display: flex !important;
    align-items: baseline !important;
    flex-wrap: wrap !important;
    gap: 4px !important;
    margin-top: 4px !important;
    margin-bottom: 6px !important;
}

.item-card-group-section .striked-price,
section[data-section-template="Item Card Group"] .striked-price,
.item-card .striked-price {
    font-size: 11px !important;
    font-weight: 400 !important;
    color: #94a3b8 !important;
    text-decoration: line-through !important;
}

.item-card-group-section .product-info-green,
section[data-section-template="Item Card Group"] .product-info-green,
.item-card .product-info-green {
    font-size: 10px !important;
    font-weight: 600 !important;
    color: #059669 !important;
    background: #ecfdf5 !important;
    padding: 0 4px !important;
    border-radius: 4px !important;
}

.item-card-group-section .out-of-stock,
section[data-section-template="Item Card Group"] .out-of-stock,
.item-card .out-of-stock {
    font-size: 11px !important;
    font-weight: 600 !important;
    color: #ef4444 !important;
    display: inline-block !important;
}

/* 8. Action Buttons (Always visible, clean full-width) */
.item-card-group-section .card-body .hidden,
.item-card-group-section .card-body a.hidden,
.item-card-group-section .card-body div.hidden,
.item-card .card-body .hidden,
.item-card .card-body a.hidden,
.item-card .card-body div.hidden,
.item-card-group-section .hidden,
section[data-section-template="Item Card Group"] .hidden,
.item-card .hidden,
.item-card-group-section a.hidden,
.item-card a.hidden,
.item-card-group-section .go-to-cart-link.hidden,
.item-card .go-to-cart-link.hidden,
a.hidden,
.hidden {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    min-height: 0 !important;
    max-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    pointer-events: none !important;
    position: absolute !important;
    overflow: hidden !important;
}

.item-card-group-section a.btn-explore-link:not(.hidden),
.item-card-group-section a.go-to-cart-link:not(.hidden),
.item-card-group-section a:has(.btn-explore-variants):not(.hidden),
.item-card-group-section a:has(.go-to-cart-grid):not(.hidden),
section[data-section-template="Item Card Group"] a.btn-explore-link:not(.hidden),
section[data-section-template="Item Card Group"] a.go-to-cart-link:not(.hidden),
section[data-section-template="Item Card Group"] a:has(.btn-explore-variants):not(.hidden),
section[data-section-template="Item Card Group"] a:has(.go-to-cart-grid):not(.hidden),
.item-card a.btn-explore-link:not(.hidden),
.item-card a.go-to-cart-link:not(.hidden),
.item-card a:has(.btn-explore-variants):not(.hidden),
.item-card a:has(.go-to-cart-grid):not(.hidden) {
    margin: 0 !important;
    margin-top: auto !important;
    margin-bottom: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
    text-decoration: none !important;
    display: flex !important;
    align-items: stretch !important;
    box-sizing: border-box !important;
}

.item-card-group-section .btn-add-to-cart-list:not(.hidden),
.item-card-group-section .btn-explore-variants:not(.hidden),
.item-card-group-section .go-to-cart-grid:not(.hidden),
section[data-section-template="Item Card Group"] .btn-add-to-cart-list:not(.hidden),
section[data-section-template="Item Card Group"] .btn-explore-variants:not(.hidden),
section[data-section-template="Item Card Group"] .go-to-cart-grid:not(.hidden),
.item-card .btn-add-to-cart-list:not(.hidden),
.item-card .btn-explore-variants:not(.hidden),
.item-card .go-to-cart-grid:not(.hidden) {
    visibility: visible !important;
    opacity: 1 !important;
    margin: 0 !important;
    margin-top: auto !important;
    margin-bottom: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    border-radius: 6px !important;
    font-size: 11.5px !important;
    font-weight: 600 !important;
    padding: 4px 8px !important;
    height: 28px !important;
    min-height: 28px !important;
    max-height: 28px !important;
    width: 100% !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    transition: all 0.15s ease !important;
    cursor: pointer !important;
    text-decoration: none !important;
    display: inline-flex !important;
    box-sizing: border-box !important;
}

.item-card-group-section .btn-primary,
section[data-section-template="Item Card Group"] .btn-primary,
.item-card .btn-primary {
    background-color: var(--primary, #007bff) !important;
    border-color: var(--primary, #007bff) !important;
    color: #ffffff !important;
}

.item-card-group-section .btn-primary:hover,
.item-card-group-section .btn-primary:focus-visible,
section[data-section-template="Item Card Group"] .btn-primary:hover,
section[data-section-template="Item Card Group"] .btn-primary:focus-visible,
.item-card .btn-primary:hover,
.item-card .btn-primary:focus-visible {
    background-color: #0062cc !important;
    border-color: #005cbf !important;
    box-shadow: 0 2px 6px rgba(0, 123, 255, 0.2) !important;
    outline: 2px solid #005cbf !important;
    outline-offset: 1px !important;
}

.item-card-group-section .btn-explore-variants,
section[data-section-template="Item Card Group"] .btn-explore-variants,
.item-card .btn-explore-variants {
    background-color: #f1f5f9 !important;
    color: #334155 !important;
    border: 1px solid #cbd5e1 !important;
}

.item-card-group-section .btn-explore-variants:hover,
.item-card-group-section .btn-explore-variants:focus-visible,
section[data-section-template="Item Card Group"] .btn-explore-variants:hover,
section[data-section-template="Item Card Group"] .btn-explore-variants:focus-visible,
.item-card .btn-explore-variants:hover,
.item-card .btn-explore-variants:focus-visible {
    background-color: #e2e8f0 !important;
    color: #0f172a !important;
    outline: 2px solid #94a3b8 !important;
    outline-offset: 1px !important;
}

/* 9. Mobile Responsiveness: Strict 2 columns */
@media (max-width: 768px) {
    .item-card-group-section,
    section[data-section-template="Item Card Group"] {
        margin-top: 1rem !important;
        margin-bottom: 1.5rem !important;
    }

    .item-card-group-section .item-group-header,
    section[data-section-template="Item Card Group"] .item-group-header {
        margin-bottom: 8px !important;
        padding-bottom: 4px !important;
    }

    .item-card-group-section .section-title,
    section[data-section-template="Item Card Group"] .section-title {
        font-size: 16px !important;
    }

    .item-card-group-section .btn-view-all {
        padding: 3px 8px !important;
        font-size: 11px !important;
    }

    .item-card-group-section .row,
    section[data-section-template="Item Card Group"] .row {
        margin-left: -3px !important;
        margin-right: -3px !important;
    }

    .item-card-group-section .item-card,
    .item-card-group-section .row > [class*="col-"],
    section[data-section-template="Item Card Group"] .item-card,
    section[data-section-template="Item Card Group"] .row > [class*="col-"] {
        flex: 0 0 50% !important;
        max-width: 50% !important;
        width: 50% !important;
        min-width: 0 !important;
        padding-left: 3px !important;
        padding-right: 3px !important;
        margin-bottom: 6px !important;
        box-sizing: border-box !important;
    }

    .item-card-group-section .card-img-container,
    section[data-section-template="Item Card Group"] .card-img-container,
    .item-card .card-img-container {
        padding: 3px !important;
    }

    .item-card-group-section .no-image,
    section[data-section-template="Item Card Group"] .no-image,
    .item-card .no-image {
        font-size: 18px !important;
    }

    .item-card-group-section .card-body,
    section[data-section-template="Item Card Group"] .card-body,
    .item-card .card-body {
        padding: 4px 6px 6px !important;
    }

    .item-card-group-section .product-title,
    section[data-section-template="Item Card Group"] .product-title,
    .item-card .product-title {
        font-size: 11.5px !important;
        line-height: 1.35 !important;
        min-height: 2.7em !important;
        max-height: 2.7em !important;
        height: 2.7em !important;
        margin-bottom: 2px !important;
    }

    .item-card-group-section .product-price,
    section[data-section-template="Item Card Group"] .product-price,
    .item-card .product-price {
        font-size: 12.5px !important;
        gap: 3px !important;
        margin-bottom: 3px !important;
    }

    .item-card-group-section .btn-add-to-cart-list:not(.hidden),
    .item-card-group-section .btn-explore-variants:not(.hidden),
    .item-card-group-section .go-to-cart-grid:not(.hidden),
    section[data-section-template="Item Card Group"] .btn-add-to-cart-list:not(.hidden),
    section[data-section-template="Item Card Group"] .btn-explore-variants:not(.hidden),
    section[data-section-template="Item Card Group"] .go-to-cart-grid:not(.hidden),
    .item-card .btn-add-to-cart-list:not(.hidden),
    .item-card .btn-explore-variants:not(.hidden),
    .item-card .go-to-cart-grid:not(.hidden) {
        font-size: 11px !important;
        padding: 3px 6px !important;
        height: 25px !important;
        min-height: 25px !important;
        max-height: 25px !important;
        margin-top: auto !important;
        box-sizing: border-box !important;
    }
}
