/* Product card — variant dropdown + Add / Buy Now */

.nest-product-variant-picker {
    width: 100%;
    margin-bottom: 8px;
}

.nest-product-variant-picker .nest-product-variant-select {
    width: 100%;
    max-width: 100%;
    min-height: 36px;
    padding: 6px 28px 6px 10px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.3;
    color: var(--color-heading, #253d4e);
    border: 1px solid #ececec;
    border-radius: 8px;
    background-color: #fff;
    box-shadow: none;
}

.nest-product-variant-picker .nest-product-variant-select:focus {
    border-color: var(--color-brand, #3bb77e);
    outline: 0;
    box-shadow: 0 0 0 2px rgba(var(--color-brand-rgb, 59, 183, 126), 0.15);
}

.product-cart-wrap .product-card-bottom {
    flex-direction: column;
    align-items: stretch !important;
    gap: 6px;
}

.product-cart-wrap .product-card-bottom .product-price {
    width: 100%;
}

.product-cart-wrap .product-card-bottom .nest-product-actions {
    width: 100%;
}

.product-cart-wrap .product-card-bottom,
.product-list .nest-product-actions-wrap {
    align-items: center;
}

.product-cart-wrap .nest-product-actions,
.nest-product-actions-wrap .nest-product-actions {
    display: flex;
    align-items: stretch;
    gap: 8px;
    flex-shrink: 0;
    width: 100%;
}

.product-cart-wrap .nest-product-actions .nest-btn,
.nest-product-actions-wrap .nest-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none !important;
    white-space: nowrap;
    border: none;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    box-sizing: border-box;
}

.product-cart-wrap .nest-product-actions .nest-btn:active,
.nest-product-actions-wrap .nest-btn:active {
    transform: scale(0.97);
}

/* Add — cart icon, theme brand */
.nest-btn--add.nest-btn--icon-only {
    flex: 0 0 44px;
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    background: #fff;
    color: var(--color-brand, #3bb77e);
    border: 1.5px solid var(--color-brand, #3bb77e) !important;
    box-shadow: 0 1px 3px rgba(var(--color-brand-rgb, 59, 183, 126), 0.12);
}

.nest-btn--add.nest-btn--icon-only:hover,
.nest-btn--add.nest-btn--icon-only:focus {
    background: rgba(var(--color-brand-rgb, 59, 183, 126), 0.1);
    color: var(--color-brand, #3bb77e);
    border-color: var(--color-brand, #3bb77e) !important;
    box-shadow: 0 3px 10px rgba(var(--color-brand-rgb, 59, 183, 126), 0.22);
    transform: translateY(-1px);
}

.nest-btn--add .nest-btn__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    margin: 0;
    background: transparent;
    color: inherit;
}

.nest-btn--add .nest-btn__icon i {
    font-size: 20px;
    line-height: 1;
    display: block;
}

/* Buy Now — theme brand */
.nest-btn--buy {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0 14px;
    border-radius: 10px;
    background: var(--color-brand, #3bb77e);
    color: #fff !important;
    box-shadow: 0 2px 8px rgba(var(--color-brand-rgb, 59, 183, 126), 0.35);
}

.nest-btn--buy:hover,
.nest-btn--buy:focus {
    color: #fff !important;
    background: var(--color-brand-2, #29a56a);
    box-shadow: 0 4px 14px rgba(var(--color-brand-rgb, 59, 183, 126), 0.45);
    transform: translateY(-1px);
}

.nest-btn__label {
    display: inline-block;
    letter-spacing: 0.01em;
}

/* Legacy overrides */
.product-cart-wrap .product-card-bottom .add-cart .nest-btn--add.add,
.product-cart-wrap .add-cart .action-btn.add {
    position: static;
    display: inline-flex;
    padding: 0;
    background: #fff;
    font-size: 0;
    transform: none;
    color: var(--color-brand, #3bb77e);
}

.product-cart-wrap .add-cart .buy-now-button.btn {
    padding: 0 14px;
    height: 44px;
    line-height: 44px;
    border: none;
    border-radius: 10px;
}

.product-cart-wrap .add-cart .buy-now-button.btn-primary {
    background: var(--color-brand, #3bb77e);
    color: #fff;
}

.product-cart-wrap .add-cart .buy-now-button.btn-primary:hover {
    background: var(--color-brand-2, #29a56a);
    color: #fff;
}

/* Desktop grid cards: price above buttons (no overlap) */
@media (min-width: 768px) {
    .nest-products-grid .nest-product-card .product-content-wrap {
        padding: 0 10px 12px !important;
    }

    .nest-products-grid .nest-product-card .product-card-bottom {
        display: flex !important;
        flex-direction: column !important;
        flex-wrap: nowrap !important;
        align-items: stretch !important;
        gap: 8px !important;
        width: 100%;
    }

    .nest-products-grid .nest-product-card .product-card-bottom .product-price {
        flex: none !important;
        width: 100% !important;
        min-width: 0 !important;
        padding-top: 0 !important;
    }

    .nest-products-grid .nest-product-card .product-card-bottom .product-price span {
        font-size: 14px;
        line-height: 1.2;
        word-break: break-word;
    }

    .nest-products-grid .nest-product-card .product-card-bottom .nest-product-actions {
        flex: none !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }

    .nest-products-grid .nest-product-card .nest-btn--add.nest-btn--icon-only {
        flex: 0 0 36px;
        width: 36px;
        min-width: 36px;
        height: 36px;
        min-height: 36px;
    }

    .nest-products-grid .nest-product-card .nest-btn--buy {
        min-height: 36px;
        height: 36px;
        font-size: 11px;
        padding: 0 8px;
    }

    .nest-products-grid .nest-product-card .add-cart .buy-now-button.btn {
        height: 36px;
        line-height: 36px;
        font-size: 11px;
    }
}

/* ——— Desktop: columns from admin (--nest-per-row on grid) ——— */
@media (min-width: 992px) {
    .nest-products-grid {
        display: flex !important;
        flex-wrap: wrap !important;
        margin-left: -8px !important;
        margin-right: -8px !important;
    }

    .nest-products-grid > .nest-product-col {
        flex: 0 0 var(--nest-col-width, 25%) !important;
        width: var(--nest-col-width, 25%) !important;
        max-width: var(--nest-col-width, 25%) !important;
        padding-left: 8px !important;
        padding-right: 8px !important;
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    .nest-products-grid {
        display: flex !important;
        flex-wrap: wrap !important;
        margin-left: -8px !important;
        margin-right: -8px !important;
    }

    .nest-products-grid > .nest-product-col {
        flex: 0 0 33.333% !important;
        width: 33.333% !important;
        max-width: 33.333% !important;
        padding-left: 8px !important;
        padding-right: 8px !important;
    }
}

/* ——— Mobile: 2 products per row (categories-style, clean) ——— */
@media (max-width: 767.98px) {
    .nest-products-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .nest-products-grid > .nest-product-col {
        flex: none !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin-bottom: 0 !important;
    }

    .nest-products-grid .nest-product-card.product-cart-wrap {
        height: auto !important;
        margin-bottom: 0 !important;
        border: 1px solid #eef0f2;
        border-radius: 12px;
        overflow: hidden;
        background: #fff;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
        display: flex;
        flex-direction: column;
    }

    .nest-products-grid .nest-product-card .product-img-action-wrap {
        margin-bottom: 0;
        padding: 8px 8px 0;
        position: relative;
    }

    .nest-products-grid .nest-product-card .product-img-action-wrap .product-img {
        border-radius: 10px;
        overflow: hidden;
        height: auto;
        max-height: none;
        aspect-ratio: 1;
        min-height: 0;
        background: #f8f9fa;
        border: 1px solid #eee;
        padding: 8px;
        box-sizing: border-box;
    }

    .nest-products-grid .nest-product-card .product-img-action-wrap .product-img img {
        width: 100%;
        height: 100%;
        max-height: none;
        object-fit: contain;
        object-position: center;
    }

    .nest-products-grid .nest-product-card .product-img-action-wrap .product-img a {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 100%;
        min-height: 100px;
    }

    .nest-products-grid .nest-product-card .product-img-action-wrap .hover-img {
        display: none !important;
    }

    .nest-products-grid .nest-product-card .product-badges span {
        font-size: 9px !important;
        padding: 4px 8px !important;
        line-height: 1.1;
    }

    .nest-products-grid .nest-product-card .product-content-wrap {
        padding: 8px 10px 10px;
        display: flex;
        flex-direction: column;
        flex: 1;
        gap: 0;
    }

    .nest-products-grid .nest-product-card .product-category {
        margin-bottom: 2px;
        font-size: 10px;
        line-height: 1.2;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .nest-products-grid .nest-product-card .product-category a {
        font-size: 10px;
        color: #6c757d;
    }

    .nest-products-grid .nest-product-card .product-rate-cover,
    .nest-products-grid .nest-product-card .text-truncate .font-small {
        display: none !important;
    }

    .nest-products-grid .nest-product-card .product-content-wrap h2 {
        font-size: 13px;
        line-height: 1.3;
        margin: 0 0 6px;
        min-height: 0 !important;
        font-weight: 600;
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .nest-products-grid .nest-product-card .product-content-wrap h2 a {
        color: #253d4e;
    }

    .nest-products-grid .nest-product-card .product-card-bottom {
        display: flex !important;
        flex-direction: column;
        gap: 8px;
        margin-top: auto;
        padding-top: 8px;
        border-top: 1px solid #f0f0f0;
        width: 100%;
    }

    .nest-products-grid .nest-product-card .product-card-bottom .product-price {
        flex: none;
        width: 100%;
        padding-top: 0;
        margin: 0;
        line-height: 1.2;
    }

    .nest-products-grid .nest-product-card .product-card-bottom .product-price span {
        font-size: 15px;
        font-weight: 700;
        color: var(--color-brand, #3bb77e);
        display: block;
    }

    .nest-products-grid .nest-product-card .product-card-bottom .product-price .old-price {
        font-size: 11px;
        display: block;
        margin-top: 2px;
    }

    .nest-products-grid .nest-product-card .product-card-bottom .nest-product-actions {
        flex: none;
        width: 100%;
        max-width: none;
        min-width: 0;
        gap: 8px;
    }

    .nest-products-grid .nest-product-card .nest-btn--add.nest-btn--icon-only {
        flex: 0 0 40px;
        width: 40px;
        min-width: 40px;
        height: 40px;
        min-height: 40px;
        border-radius: 10px;
        border-width: 1.5px !important;
    }

    .nest-products-grid .nest-product-card .nest-btn--add .nest-btn__icon i {
        font-size: 18px;
    }

    .nest-products-grid .nest-product-card .nest-btn--buy {
        min-height: 40px;
        height: 40px;
        font-size: 12px;
        padding: 0 12px;
        border-radius: 10px;
        font-weight: 700;
    }

    .nest-products-grid .nest-product-card .nest-btn--buy .nest-btn__label {
        font-size: 12px;
    }

    .nest-products-grid .nest-product-card .add-cart .buy-now-button.btn {
        height: 40px;
        line-height: 40px;
        font-size: 12px;
        padding: 0 12px;
    }

    .nest-products-grid .nest-product-card .product-action-1 {
        display: none;
    }
}

/* List view */
.nest-product-actions-wrap .nest-product-actions {
    max-width: 280px;
}

@media (max-width: 575.98px) {
    .nest-product-actions-wrap .nest-product-actions {
        max-width: none;
    }
}

.nest-btn.button-loading {
    opacity: 0.7;
    pointer-events: none;
}
