/* ============================================================
   Inline Add-to-Cart Quantity Selector
   Matches the reference: [■ 🗑] ──── [  1 un ▲  ] ──── [■ +]
   Three separate elements with gaps between them.
   ============================================================ */

/* Wrapper — sits at the bottom of a product card */
.atc-btn-wrapper {
    padding: 10px 0 0;
    position: relative;
    z-index: 3;
}

/* ── Add Button (default state) ───────────────────────────── */
.atc-add-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 36px;
    border: none;
    border-radius: 10px;
    background: var(--web-primary);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .3px;
    cursor: pointer;
    transition: background .2s ease, transform .1s ease, opacity .25s ease;
    user-select: none;
}

.atc-add-btn:hover {
    background: var(--web-primary);
    filter: brightness(0.9);
}

.atc-add-btn:active {
    transform: scale(.97);
}

.atc-add-btn.atc-hidden {
    display: none;
}

/* ── Quantity Control (revealed after add) ────────────────── */
.atc-qty-control {
    display: none;
    align-items: center;
    justify-content: center;
    width: 100%;
    gap: 6px;
    animation: atcFadeIn .25s ease;
}

.atc-qty-control.atc-visible {
    display: flex;
}

@keyframes atcFadeIn {
    from { opacity: 0; transform: scale(.92); }
    to   { opacity: 1; transform: scale(1); }
}

/* ── Shared button base (delete / plus) ───────────────────── */
.atc-qty-delete,
.atc-qty-plus {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    min-width: 36px;
    border: none;
    border-radius: 10px;
    background: var(--web-primary);
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    transition: background .18s ease, transform .1s ease;
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
}

.atc-qty-delete:hover,
.atc-qty-plus:hover {
    background: var(--web-primary);
    filter: brightness(0.9);
}

/* Delete state — red background when qty=1 (trash icon) */
.atc-qty-delete.atc-is-delete {
    background: #d32f2f;
}
.atc-qty-delete.atc-is-delete:hover {
    background: #b71c1c;
}

.atc-qty-delete:active,
.atc-qty-plus:active {
    transform: scale(.92);
}

.atc-qty-delete i,
.atc-qty-plus i {
    font-size: 16px;
    line-height: 1;
}

/* ── Center pill — quantity display ───────────────────────── */
.atc-qty-display {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 36px;
    background: #f0f1f2;
    border: 1px solid #e2e3e5;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    color: #1a3c24;
    white-space: nowrap;
    user-select: none;
    padding: 0 14px;
    line-height: 1;
}

/* Small upward triangle indicator inside the pill */
.atc-qty-display::after {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-bottom: 5px solid var(--web-primary);
    margin-left: 2px;
    flex-shrink: 0;
}

/* ── Disabled / loading state ─────────────────────────────── */
.atc-btn-wrapper.atc-loading .atc-add-btn,
.atc-btn-wrapper.atc-loading .atc-qty-delete,
.atc-btn-wrapper.atc-loading .atc-qty-plus {
    pointer-events: none;
    color: transparent !important;
    position: relative;
}

.atc-btn-wrapper.atc-loading .atc-add-btn i,
.atc-btn-wrapper.atc-loading .atc-qty-delete i,
.atc-btn-wrapper.atc-loading .atc-qty-plus i {
    opacity: 0;
}

.atc-btn-wrapper.atc-loading .atc-add-btn::after,
.atc-btn-wrapper.atc-loading .atc-qty-delete::after,
.atc-btn-wrapper.atc-loading .atc-qty-plus::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    margin: auto;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: atc-spin 0.6s linear infinite;
}

@keyframes atc-spin {
    to { transform: rotate(360deg); }
}

/* ── Out of stock override ────────────────────────────────── */
.atc-btn-wrapper.atc-out-of-stock .atc-add-btn {
    background: #b0b0b0;
    cursor: not-allowed;
    pointer-events: none;
}

/* ── Horizontal card adaptations (_product-card-1 / _product-card-2) */
.flash_deal_product .atc-btn-wrapper {
    padding: 10px 0 0;
}

.flash_deal_product .atc-add-btn {
    height: 32px;
    font-size: 13px;
    border-radius: 10px;
}

.flash_deal_product .atc-qty-control {
    gap: 5px;
}

.flash_deal_product .atc-qty-delete,
.flash_deal_product .atc-qty-plus {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 10px;
    font-size: 14px;
}

.flash_deal_product .atc-qty-display {
    height: 32px;
    font-size: 12px;
    padding: 0 10px;
}

/* ── Responsive adjustments ───────────────────────────────── */
@media (max-width: 575px) {
    .atc-add-btn {
        height: 32px;
        font-size: 13px;
        border-radius: 10px;
    }
    .atc-qty-control {
        gap: 4px;
    }
    .atc-qty-delete,
    .atc-qty-plus {
        width: 32px;
        height: 32px;
        min-width: 32px;
        border-radius: 10px;
    }
    .atc-qty-display {
        height: 32px;
        font-size: 12px;
        padding: 0 10px;
    }
}
