/**
 * Product card footer: Qty + Add to Cart
 * Full-width solid primary button · bigger rounded qty · modern eCommerce UX
 */

/* Footer container */
.product-card-footer {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 8px;
    margin-top: 10px;
    padding: 0;
    border: none;
    min-height: 40px;
    flex-wrap: nowrap;
}

.product-card-footer.p-cart {
    flex-wrap: nowrap;
}

/* ══════════════════════════════════════════════════
   ADD-TO-CART BUTTON — full-width, solid primary
══════════════════════════════════════════════════ */
.pc-atc-btn {
    flex: 1;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 38px;
    padding: 0 12px;
    border-radius: 10px;
    border: none;
    background: var(--theme-color, #362a89);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.18s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 2px 8px rgba(54, 42, 137, 0.18);
}

.pc-atc-btn svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.pc-atc-btn:hover {
    background: var(--theme-color-dark, #2a1f6e);
    box-shadow: 0 6px 20px rgba(54, 42, 137, 0.30);
    transform: translateY(-2px);
}

.pc-atc-btn:hover svg {
    transform: scale(1.12);
}

.pc-atc-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(54, 42, 137, 0.15);
}

/* ── "Added ✓" state ── */
.pc-atc-btn.pc-added {
    background: #16a34a;
    color: #fff;
    pointer-events: none;
    box-shadow: 0 2px 10px rgba(22, 163, 74, 0.25);
}

.pc-atc-btn.pc-added svg {
    display: none;
}

/* Loading spinner state */
.pc-atc-btn.loadingcart {
    pointer-events: none;
    opacity: 0.75;
}

.pc-atc-btn.loadingcart::after {
    content: '';
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: pc-btn-spin 0.6s linear infinite;
    margin-left: 4px;
}

@keyframes pc-btn-spin {
    to {
        transform: rotate(360deg);
    }
}

/* In compact cards (8-box / vertical), hide the qty control — show button only */
.product-box-8 .qty-control,
.product-verticle .qty-control {
    display: none !important;
}

.product-box-8 .pc-atc-btn,
.product-verticle .pc-atc-btn {
    width: 100%;
}

/* ══════════════════════════════════════════════════
   QUANTITY CONTROL — bigger rounded ± buttons
══════════════════════════════════════════════════ */
.qty-control {
    display: flex;
    align-items: center;
    gap: 0;
    flex-shrink: 0;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    background: #f8fafc;
}

.qty-btn {
    width: 32px;
    height: 34px;
    min-width: 32px;
    padding: 0;
    border: none;
    background: transparent;
    color: #334155;
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease;
    -webkit-user-select: none;
    user-select: none;
}

.qty-btn:hover {
    background: rgba(54, 42, 137, 0.08);
    color: var(--theme-color, #362a89);
}

.qty-btn:active {
    background: rgba(54, 42, 137, 0.14);
}

/* Disabled state for minus at qty=1 */
.qty-btn.qty-disabled,
.qty-btn[disabled] {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.qty-input {
    width: 36px;
    min-width: 36px;
    height: 34px;
    padding: 0 2px;
    border: none;
    border-left: 1.5px solid #e2e8f0;
    border-right: 1.5px solid #e2e8f0;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    background: #fff;
    color: #0f172a;
    -moz-appearance: textfield;
    appearance: textfield;
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.qty-input:focus {
    outline: none;
    border-color: var(--theme-color, #362a89);
    box-shadow: 0 0 0 2px rgba(54, 42, 137, 0.1);
}

/* Add to Cart button in footer (legacy .btn-add-cart class) */
.product-card-footer .btn-add-cart {
    flex: 1;
    min-width: 0;
    height: 40px;
    min-height: 40px;
    padding: 0 16px;
    border-radius: 10px;
    font-weight: 500;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid var(--d-grey);
    background: var(--d-grey) !important;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: filter 0.2s, box-shadow 0.2s;
}

.product-card-footer .btn-add-cart:hover {
    filter: brightness(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}

.product-card-footer .btn-add-cart .btn-add-cart-label {
    display: none;
}

.product-card-footer .btn-add-cart .icon-cart,
.product-card-footer .btn-add-cart .baskt {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
}

/* Buy Now in same footer row */
.product-card-footer .footer-btn.p-buy-now {
    height: 40px;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 10px;
    font-weight: 500;
    font-size: 14px;
    flex-shrink: 0;
}

.p-conditional_div:has(.product-card-footer) {
    min-height: 0;
    height: auto;
}

.p-conditional_div .product-card-footer.p-cart {
    align-items: center;
}

/* ══════════════════════════════════════════════════
   CART BADGE BOUNCE ANIMATION
══════════════════════════════════════════════════ */
.cart-counter-span {
    transition: transform 0.3s ease;
}

.cart-counter-span.cart-badge-bounce {
    animation: cartBadgeBounce 0.5s ease;
}

@keyframes cartBadgeBounce {
    0% {
        transform: scale(1);
    }

    30% {
        transform: scale(1.5);
    }

    50% {
        transform: scale(0.9);
    }

    70% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

/* ══════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════ */
@media (max-width: 576px) {
    .product-card-footer {
        flex-direction: column;
        flex-wrap: nowrap;
        gap: 6px;
        margin-top: 8px;
    }

    /* On mobile: ATC button full width */
    .pc-atc-btn {
        width: 100%;
        height: 42px;
        font-size: 13.5px;
        border-radius: 10px;
        padding: 0 12px;
    }

    /* On mobile: qty control full width row */
    .product-card-footer .qty-control {
        width: 100%;
        justify-content: center;
    }

    .product-card-footer .footer-btn.p-buy-now {
        display: none;
    }

    /* Larger touch targets on mobile */
    .qty-btn {
        width: 40px;
        height: 40px;
        min-width: 40px;
        font-size: 20px;
    }

    .qty-input {
        height: 40px;
        width: 50px;
        min-width: 50px;
        font-size: 14px;
    }
}

@media (max-width: 380px) {
    .qty-control .qty-input {
        width: 40px;
        min-width: 40px;
    }

    .qty-btn {
        width: 34px;
        height: 34px;
        min-width: 34px;
        font-size: 18px;
    }

    .qty-input {
        height: 34px;
    }

    .product-card-footer .btn-add-cart,
    .product-card-footer .footer-btn.p-buy-now {
        height: 38px;
        min-height: 38px;
    }
}