.catalog-page, .search-page {
    --search-accent: var(--primary);
    --search-action: var(--primary-action);
    --search-action-hover: var(--primary-action-hover);
    --search-border: #e1e5df;
    --search-background: #f6f7f5;
}

.product-card,
.search-product-shell {
    min-width: 0;
    position: relative;
    border: 1px solid var(--search-border);
    border-radius: .75rem !important;
    background: #fff;
    box-shadow: none !important;
    transition: border-color .15s ease;
}

.search-product-shell {
    overflow: hidden;
    min-height: 112px;
}

.product-card:hover,
.product-card:focus-within,
.search-product-shell:hover,
.search-product-shell:focus-within {
    border-color: var(--search-accent);
}

.product-title {
    color: #263746;
    font-size: 1rem;
    line-height: 1.35;
    min-height: 2.7rem;
    overflow-wrap: anywhere;
}

.product-card .badge,
.product-list-view .badge {
    max-width: 100%;
    white-space: normal;
}

.product-image-wrapper {
    position: relative;
    background: #fff;
    cursor: pointer;
    overflow: hidden;
}

.product-card .product-image-wrapper {
    height: 170px;
}

.product-image-wrapper img {
    width: 100%;
    height: 100%;
    background: #fff;
}

.product-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(38, 55, 30, .06);
    opacity: 0;
    transition: opacity .15s ease;
    z-index: 15;
}

.product-overlay i {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border-radius: 50%;
    color: var(--theme-accent, var(--search-action, var(--primary-action)));
    background: #fff;
    font-size: 1rem;
}

.product-image-wrapper:hover .product-overlay,
.product-image-wrapper:focus-within .product-overlay {
    opacity: 1;
}

.open-article-modal,
.open-article-modal img {
    background: #fff !important;
}

:is(.search-content-wrapper, .catalog-products) .badge {
    font-weight: 600;
    letter-spacing: 0;
}

:is(.search-content-wrapper, .catalog-products) .bg-danger { background: #dc3545 !important; }
:is(.search-content-wrapper, .catalog-products) .bg-success { background: var(--success) !important; }
:is(.search-content-wrapper, .catalog-products) .bg-info { background: var(--expected-delivery-color) !important; }
:is(.search-content-wrapper, .catalog-products) .bg-warning { background: var(--warning) !important; }
:is(.search-content-wrapper, .catalog-products) .bg-primary { background: var(--search-action) !important; }

:is(.search-content-wrapper, .catalog-products) .search-open-filters .badge {
    color: var(--theme-accent, var(--search-action, var(--primary-action)));
    background: #fff !important;
}

/* ============================================
   BOTONES
   ============================================ */
:is(.search-content-wrapper, .catalog-products) .btn-primary {
    border: 1px solid var(--search-action);
    border-radius: .6rem;
    color: #fff;
    background: var(--search-action);
    box-shadow: none;
    transition: background-color .15s ease, border-color .15s ease;
}

:is(.search-content-wrapper, .catalog-products) .btn-primary:hover,
:is(.search-content-wrapper, .catalog-products) .btn-primary:active {
    border-color: var(--search-action-hover);
    background: var(--search-action-hover);
}

:is(.search-content-wrapper, .catalog-products) .add-to-cart-btn,
:is(.search-content-wrapper, .catalog-products) .add-box-to-cart-btn,
:is(.search-content-wrapper, .catalog-products) .show-similar-btn,
:is(.search-content-wrapper, .catalog-products) .tramos-link {
    min-height: 44px;
}

:is(.search-page, .catalog-page) .similar-add-btn,
:is(.search-page, .catalog-page) .similar-add-box-btn,
:is(.search-page, .catalog-page) #modal-add-to-cart,
:is(.search-page, .catalog-page) #modal-add-box-to-cart {
    min-height: 44px;
    border-radius: .65rem;
    box-shadow: none;
    transform: none;
    transition: background-color .15s ease, border-color .15s ease;
}

:is(.search-page, .catalog-page) .add-to-cart-btn,
:is(.search-page, .catalog-page) .similar-add-btn,
:is(.search-page, .catalog-page) #modal-add-to-cart {
    border: 1px solid var(--search-action);
    color: #fff;
    background: var(--search-action);
    box-shadow: none;
}

:is(.search-page, .catalog-page) .add-to-cart-btn:hover,
:is(.search-page, .catalog-page) .add-to-cart-btn:active,
:is(.search-page, .catalog-page) .similar-add-btn:hover,
:is(.search-page, .catalog-page) .similar-add-btn:active,
:is(.search-page, .catalog-page) #modal-add-to-cart:hover,
:is(.search-page, .catalog-page) #modal-add-to-cart:active {
    border-color: var(--search-action-hover);
    background: var(--search-action-hover);
    box-shadow: none;
    transform: none;
}

:is(.search-page, .catalog-page) .add-box-to-cart-btn,
:is(.search-page, .catalog-page) .similar-add-box-btn,
:is(.search-page, .catalog-page) #modal-add-box-to-cart {
    border: 1px solid #c7dca9;
    color: var(--search-action-hover);
    background: #eef5e3;
    box-shadow: none;
}

:is(.search-page, .catalog-page) .add-box-to-cart-btn:hover,
:is(.search-page, .catalog-page) .add-box-to-cart-btn:active,
:is(.search-page, .catalog-page) .similar-add-box-btn:hover,
:is(.search-page, .catalog-page) .similar-add-box-btn:active,
:is(.search-page, .catalog-page) #modal-add-box-to-cart:hover,
:is(.search-page, .catalog-page) #modal-add-box-to-cart:active {
    border-color: var(--theme-accent, var(--search-action, var(--primary-action)));
    background: #e1edcf;
    transform: none;
}

:is(.search-content-wrapper, .catalog-products) .show-similar-btn,
:is(.search-content-wrapper, .catalog-products) .tramos-link {
    border: 1px solid var(--search-border);
    color: #42533d;
    background: #fff;
    box-shadow: none;
}

:is(.search-content-wrapper, .catalog-products) .show-similar-btn:hover,
:is(.search-content-wrapper, .catalog-products) .show-similar-btn:active,
:is(.search-content-wrapper, .catalog-products) .tramos-link:hover {
    border-color: var(--theme-accent, var(--search-action, var(--primary-action)));
    color: var(--search-action-hover);
    background: var(--search-background);
}

:is(.search-page, .catalog-page) .similar-add-btn:focus-visible,
:is(.search-page, .catalog-page) .similar-add-box-btn:focus-visible,
:is(.search-page, .catalog-page) #modal-add-to-cart:focus-visible,
:is(.search-page, .catalog-page) #modal-add-box-to-cart:focus-visible {
    outline: 2px solid var(--search-action);
    outline-offset: 3px;
}

/* ============================================
   CONTROLES DE CANTIDAD
   ============================================ */
.product-card>.p-3 {
    padding: .85rem !important;
}

.product-card>.p-3>.border-bottom {
    padding: .5rem .65rem !important;
    border: 1px solid #e7ece7 !important;
    border-radius: .7rem;
    background: #f8faf8;
}

.product-card .articleCountInput,
.search-product-shell .articleCountInput {
    min-width: 0;
}

.product-card .add-to-cart-btn,
.search-product-shell .add-to-cart-btn {
    border-radius: .7rem;
}

.product-card .add-box-to-cart-btn,
.product-card .show-similar-btn,
.product-card .tramos-link,
.search-product-shell .add-box-to-cart-btn,
.search-product-shell .show-similar-btn,
.search-product-shell .tramos-link {
    border-radius: .65rem;
}

.product-quantity-control {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    overflow: hidden;
    background: var(--search-background);
    border: 1px solid var(--search-border);
    border-radius: .7rem;
}

.product-quantity-control button {
    min-height: 44px;
    border: 0;
    color: var(--primary);
    background: transparent;
}

.product-quantity-control button:hover { color: #fff; background: var(--search-action); }
.product-quantity-control button:disabled { color: #a9b5af; background: #e8eeeb; cursor: not-allowed; }
.product-quantity-control label { margin: 0; padding: .25rem; border-right: 1px solid var(--search-border); border-left: 1px solid var(--search-border); text-align: center; }
.product-quantity-control label span { display: block; color: #64746c; font-size: .65rem; font-weight: 700; text-transform: uppercase; }
.product-quantity-control .articleCountInput { width: 100%; padding: 0; border: 0; outline: 0; background: transparent; box-shadow: none; text-align: center; font-size: 1rem; font-weight: 700; }

.search-product-shell>div:last-child {
    border-left: 1px solid #e5eee8;
}

.search-product-pricing {
    border-right: 1px solid var(--search-border);
    border-left: 1px solid var(--search-border);
    background: #fff;
}

.search-product-actions {
    background: var(--search-background);
}

.cart-info-badge {
    border: 1px solid #b8dfc9 !important;
    background: #eef9f2 !important;
}

.cart-info-badge::before {
    color: #315b42;
    font-size: .78rem;
    font-weight: 700;
    content: 'En tu pedido:';
}

.cart-info-badge .badge {
    margin-left: auto;
    font-size: .9rem !important;
}

.cart-info-badge .badge::after {
    content: ' uds.';
}

.cart-info-badge .cart-reduce-btn {
    width: 2rem;
    height: 2rem;
    padding: 0 !important;
    border-radius: 50%;
}

.catalog-products { background: var(--search-background); }
.product-card .add-box-to-cart-btn .text-white { color: inherit !important; }
.catalog-products .product-card :is(.add-to-cart-btn, .add-box-to-cart-btn, .tramos-link) { padding: .5rem; font-size: .85rem; letter-spacing: .2px; }
.catalog-products .product-card .add-to-cart-btn i { font-size: .9rem; }
.catalog-products .product-card :is(button, input):focus-visible,
.catalog-page .product-quantity-control:has(:focus-visible) { outline: 2px solid var(--search-action); outline-offset: 2px; }
@media (forced-colors: active) {
    .catalog-products .product-card :is(button, input):focus-visible,
    .catalog-page .product-quantity-control:has(:focus-visible) { outline-color: Highlight; }
}
@media (max-width: 576px) {
    .product-title { font-size: .95rem; min-height: auto; }
    .product-card .product-image-wrapper { height: 150px; }
}

.product-card .fw-600 { font-weight: 600; }

.add-box-to-cart-btn,
.similar-add-box-btn {
    min-width: 0;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.35;
}

.catalog-page button:focus,
.catalog-page a:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.catalog-page .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(25, 135, 84, 0.25);
}
