/* ==========================================================================
   Product action icons & popovers
   ========================================================================== */

/* Reset legacy home.css .item-button / .item-icons rules */
.product-card__actions .item-icons,
.product-card__actions .product-card__actions-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.product-card__actions .item-icons li,
.product-card__actions .product-card__actions-item {
    padding: 0;
    margin: 0;
    flex: 0 0 auto;
    color: inherit;
}

.product-card__actions .item-button.product-card__action-btn,
.product-card__actions .product-card__action-btn.item-button {
    border-radius: 8px;
}

.product-card__actions {
    width: 100%;
}

.product-card__actions-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.product-card__actions-item {
    padding: 0;
    margin: 0;
}

.product-card__action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    gap: 0;
    width: 36px;
    min-width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    background: #fff;
    color: #484848;
    font-size: 15px;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    pointer-events: all;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.product-card__action-btn:hover,
.product-card__action-btn:focus-visible {
    outline: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.product-card__action-btn--sale {
    color: #b45309;
    background: #fffbeb;
    border-color: #fde68a;
}

.product-card__action-btn--sale:hover,
.product-card__action-btn--sale:focus-visible {
    background: #fef3c7;
    border-color: #fbbf24;
    color: #92400e;
}

.product-card__action-btn--info {
    color: #1d4ed8;
    background: #eff6ff;
    border-color: #bfdbfe;
}

.product-card__action-btn--info:hover,
.product-card__action-btn--info:focus-visible {
    background: #dbeafe;
    border-color: #93c5fd;
    color: #1e40af;
}

.product-card__actions .item-button.product-card__action-btn,
.product-card__actions .product-card__action-btn.item-button {
    width: 36px;
    height: 36px;
}

.product-card__actions .item-button.product-card__action-btn--vat,
.product-card__actions .product-card__action-btn--vat.item-button {
    width: 36px;
    min-width: 36px;
    height: 36px;
    padding: 0;
}

.product-card__action-btn--vat.active {
    background: #ecfdf5;
    border-color: #6ee7b7;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.15);
}

.product-card__action-vat-icon {
    display: block;
    width: 22px !important;
    height: 22px !important;
    max-width: 22px !important;
    max-height: 22px !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    object-fit: contain;
}

/* Owl carousel + legacy card rules must not stretch action icons */
.owl-carousel .owl-item .product-card__actions img,
.product-card .product-card__actions img {
    width: auto !important;
    max-width: 24px !important;
    max-height: 24px !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

.owl-carousel .owl-item .product-card__action-vat-icon,
.product-card .product-card__action-vat-icon {
    width: 22px !important;
    height: 22px !important;
    max-width: 22px !important;
    max-height: 22px !important;
}

.product-card__actions .product-card__action-btn--vat {
    width: 36px;
    min-width: 36px;
    padding: 0;
}

.product-card__action-label {
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.product-card__actions--labeled .product-card__action-btn {
    width: auto;
    min-width: auto;
    height: 38px;
    padding: 0 12px;
}

.product-card__actions--labeled .product-card__actions-list {
    gap: 10px;
}

/* Product card placement */
.product-card .product-card__actions-list,
.product-card .item-icons {
    margin: 8px 0 4px;
    justify-content: center;
}

.product-card__footer .product-card__actions-list,
.product-card__footer .item-icons {
    margin: 8px 0;
}

/* Product detail placement */
.product-detail__actions .product-card__actions-list,
.product-detail__actions .item-icons {
    margin: 0;
    justify-content: flex-start;
}

.product-detail__actions .product-card__actions--labeled .product-card__action-btn {
    height: 40px;
    padding: 0 14px;
}

.product-detail__actions .product-card__actions--labeled .product-card__actions-list {
    gap: 12px;
}

/* --------------------------------------------------------------------------
   Popover shell
   -------------------------------------------------------------------------- */

.popover:has(.product-sale-popover),
.popover:has(.product-description-popover) {
    border: 1px solid #ececec;
    border-radius: 12px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    max-width: min(320px, calc(100vw - 24px));
    z-index: 1080;
}

.popover:has(.product-sale-popover) .popover-arrow::before,
.popover:has(.product-description-popover) .popover-arrow::before {
    border-top-color: #ececec;
}

.popover:has(.product-sale-popover) .popover-header,
.popover:has(.product-description-popover) .popover-header {
    display: none;
}

.popover:has(.product-sale-popover) .popover-body,
.popover:has(.product-description-popover) .popover-body {
    padding: 0;
    max-height: 360px;
    overflow: auto;
}

/* --------------------------------------------------------------------------
   Sale quantity popover
   -------------------------------------------------------------------------- */

.sale-qty-popover-anchor {
    position: absolute;
    top: 0;
    left: 50%;
    width: 100%;
    height: 100%;
    transform: translateX(-50%);
    pointer-events: none;
    opacity: 0;
}

.product-sale-popover {
    padding: 12px;
    background: #fff;
}

.product-sale-popover__heading {
    margin: 0 0 10px;
    font-size: 13px;
    font-weight: 700;
    color: #191919;
    letter-spacing: 0.01em;
}

.product-sale-popover__list {
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
    min-width: 220px;
    background: transparent;
}

.product-sale-popover__item + .product-sale-popover__item {
    margin-top: 6px;
}

.product-sale-popover__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #f0f0f0;
    border-radius: 8px;
    background: #fafafa;
    color: #333;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.product-sale-popover__row:hover,
.product-sale-popover__row:focus {
    background: #fff7ed;
    border-color: #fed7aa;
    color: #9a3412;
}

.product-sale-popover__row.active {
    background: var(--color-primary, #febb16);
    border-color: var(--color-primary, #febb16);
    color: #191919;
    box-shadow: 0 2px 8px rgba(254, 187, 22, 0.35);
}

.product-sale-popover__qty {
    color: inherit;
    white-space: nowrap;
}

.product-sale-popover__arrow {
    flex-shrink: 0;
    color: #9ca3af;
    font-size: 12px;
    line-height: 1;
}

.product-sale-popover__price {
    font-weight: 700;
    color: inherit;
    white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Description popover
   -------------------------------------------------------------------------- */

.product-description-popover {
    padding: 14px;
    background: #fff;
    min-width: 240px;
    max-width: 300px;
}

.product-description-popover__title {
    margin: 0 0 8px;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
    color: #191919;
}

.product-description-popover__body {
    margin: 0;
    font-size: 13px;
    line-height: 1.55;
    color: #555;
    word-break: break-word;
}

/* --------------------------------------------------------------------------
   Mobile
   -------------------------------------------------------------------------- */

@media (max-width: 767px) {
    .product-card .product-card__action-btn,
    .product-card .item-button.product-card__action-btn,
    .product-card__actions .item-button.product-card__action-btn {
        width: 40px;
        min-width: 40px;
        height: 40px;
        font-size: 15px;
    }

    .product-card__actions .item-button.product-card__action-btn--vat,
    .product-card__actions .product-card__action-btn--vat.item-button {
        width: 40px;
        min-width: 40px;
        height: 40px;
    }

    .product-sale-popover__list {
        min-width: 200px;
    }
}
