/* =========================================================
   Cart / Checkout UX — AFF storefront
   Preserves black/white brand language with motion & clarity
   ========================================================= */

:root {
    --aff-ink: #111;
    --aff-muted: #6b6b6b;
    --aff-line: #e8e8e8;
    --aff-soft: #f6f6f6;
    --aff-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --aff-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---- Fly-to-cart ghost ---- */
.aff-fly-ghost {
    position: fixed;
    z-index: 999999;
    width: 72px;
    height: 72px;
    border-radius: 12px;
    overflow: hidden;
    pointer-events: none;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
    transition: transform 0.85s var(--aff-ease), opacity 0.85s var(--aff-ease), width 0.85s var(--aff-ease), height 0.85s var(--aff-ease);
    background: #fff;
}
.aff-fly-ghost img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.aff-fly-ghost.is-flying {
    width: 18px;
    height: 18px;
    opacity: 0.15;
    border-radius: 50%;
}

/* ---- Cart badge pulse ---- */
@keyframes aff-badge-pop {
    0% { transform: scale(1); }
    35% { transform: scale(1.45); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); }
}
.icons-cart .cart-count.aff-pop,
.wishlist-box .count-wishlist.aff-pop {
    animation: aff-badge-pop 0.55s var(--aff-spring);
}

@keyframes aff-bag-shake {
    0%, 100% { transform: rotate(0); }
    20% { transform: rotate(-12deg); }
    40% { transform: rotate(10deg); }
    60% { transform: rotate(-6deg); }
    80% { transform: rotate(4deg); }
}
.icons-cart.aff-shake i {
    display: inline-block;
    animation: aff-bag-shake 0.55s var(--aff-ease);
}

/* ---- Add-to-cart button states ---- */
.btn-add-to-cart .product-btn.button,
.btn-add-to-cart .button,
.add-to-cart-wrap .btn-add-to-cart .button {
    position: relative;
    overflow: hidden;
    transition: transform 0.25s var(--aff-ease), background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}
.btn-add-to-cart.is-loading .product-btn.button,
.btn-add-to-cart.is-loading .button,
.quickview-popup form.cart button[type="submit"].is-loading {
    pointer-events: none;
    opacity: 0.75;
}
.btn-add-to-cart.is-loading .product-btn.button::after,
.btn-add-to-cart.is-loading .button::after,
.quickview-popup form.cart button[type="submit"].is-loading::after {
    content: "";
    position: absolute;
    inset: 0;
    margin: auto;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: aff-spin 0.7s linear infinite;
}
@keyframes aff-spin {
    to { transform: rotate(360deg); }
}
.btn-add-to-cart.is-added .product-btn.button,
.btn-add-to-cart.is-added .button {
    background: #111 !important;
    color: #fff !important;
}
.btn-add-to-cart.is-added .product-btn.button::before,
.btn-add-to-cart.is-added .button::before {
    content: "✓ ";
}

/* ---- Success toast with actions ---- */
.toast.aff-toast {
    min-width: 280px;
    max-width: 380px;
    border-radius: 14px;
    border-left: none;
    padding: 18px 22px;
    background: #111;
}
html[dir="rtl"] .toast.aff-toast,
body[dir="rtl"] .toast.aff-toast {
    right: auto;
    left: 30px;
    transform: translateX(calc(-100% - 30px));
}
html[dir="rtl"] .toast.aff-toast.active,
body[dir="rtl"] .toast.aff-toast.active {
    transform: translateX(0);
}
.toast .aff-toast-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}
.toast .aff-toast-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 999px;
    transition: transform 0.2s var(--aff-ease), background 0.2s ease;
}
.toast .aff-toast-actions a:hover {
    transform: translateY(-1px);
}
.toast .aff-toast-actions .aff-go-cart {
    background: #fff;
    color: #111;
}
.toast .aff-toast-actions .aff-go-checkout {
    background: transparent;
    color: #fff;
    border: 1px solid rgba(255,255,255,0.45);
}

/* ---- Mini cart drawer polish ---- */
.mini-cart .cart-popup {
    border-radius: 16px !important;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0,0,0,0.18) !important;
    border: 1px solid var(--aff-line);
    animation: aff-drawer-in 0.35s var(--aff-ease);
}
@keyframes aff-drawer-in {
    from { opacity: 0; transform: translateY(10px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.aff-mini-cart-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px 12px;
    border-bottom: 1px solid var(--aff-line);
}
.aff-mini-cart-head h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.aff-mini-cart-head .aff-mini-count {
    font-size: 12px;
    color: var(--aff-muted);
    background: var(--aff-soft);
    padding: 4px 10px;
    border-radius: 999px;
}
.mini-cart .cart-popup .mini-cart-item {
    transition: background 0.2s ease, transform 0.25s var(--aff-ease), opacity 0.25s ease;
}
.mini-cart .cart-popup .mini-cart-item.is-removing {
    opacity: 0;
    transform: translateX(20px);
}
.mini-cart .cart-popup .buttons {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 0 16px 16px;
}
.mini-cart .cart-popup .buttons .button {
    width: 100% !important;
    text-align: center;
    border-radius: 10px !important;
    transition: transform 0.2s var(--aff-ease), background 0.2s ease !important;
}
.mini-cart .cart-popup .buttons .button:hover {
    transform: translateY(-2px);
}
.mini-cart .cart-popup .buttons .checkout {
    background: #111 !important;
    color: #fff !important;
    border-color: #111 !important;
}
.aff-cart-progress {
    margin: 0 16px 14px;
    padding: 12px 14px;
    background: var(--aff-soft);
    border-radius: 12px;
}
.aff-cart-progress .aff-bar {
    height: 4px;
    background: #ddd;
    border-radius: 999px;
    overflow: hidden;
    margin-top: 8px;
}
.aff-cart-progress .aff-bar > span {
    display: block;
    height: 100%;
    background: #111;
    border-radius: 999px;
    transition: width 0.5s var(--aff-ease);
}
.aff-cart-progress p {
    margin: 0;
    font-size: 12px;
    color: var(--aff-muted);
}

/* ---- Overlay when mini cart open ---- */
.aff-cart-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.28);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 9990;
}
.aff-cart-backdrop.is-visible {
    opacity: 1;
    pointer-events: auto;
}

/* ---- Checkout / Cart progress steps ---- */
.aff-flow-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    max-width: 640px;
    margin: 0 auto 36px;
    padding: 0 12px;
}
.aff-flow-steps .step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    position: relative;
    z-index: 1;
}
.aff-flow-steps .step .num {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    background: #fff;
    color: #999;
    transition: all 0.35s var(--aff-ease);
}
.aff-flow-steps .step .label {
    font-size: 12px;
    color: #999;
    font-weight: 600;
    white-space: nowrap;
}
.aff-flow-steps .step.is-active .num,
.aff-flow-steps .step.is-done .num {
    background: #111;
    border-color: #111;
    color: #fff;
    box-shadow: 0 6px 16px rgba(0,0,0,0.18);
}
.aff-flow-steps .step.is-active .label,
.aff-flow-steps .step.is-done .label {
    color: #111;
}
.aff-flow-steps .step.is-done .num {
    background: #111;
}
.aff-flow-steps .connector {
    flex: 1;
    height: 2px;
    background: #e0e0e0;
    margin: 0 10px;
    margin-bottom: 22px;
    position: relative;
    overflow: hidden;
}
.aff-flow-steps .connector.is-done {
    background: #111;
}

/* ---- Cart page polish ---- */
.shop-cart .cart-totals {
    border: 1px solid var(--aff-line);
    border-radius: 16px;
    padding: 24px !important;
    background: #fff;
    box-shadow: 0 10px 30px rgba(0,0,0,0.04);
    position: sticky;
    top: 100px;
}
.shop-cart .cart-item {
    transition: opacity 0.3s ease, transform 0.3s var(--aff-ease), background 0.2s ease;
}
.shop-cart .cart-item.is-removing {
    opacity: 0;
    transform: translateX(30px);
}
.shop-cart .quantity {
    border: 1px solid var(--aff-line);
    border-radius: 10px;
    overflow: hidden;
    display: inline-flex !important;
    align-items: center;
    pointer-events: auto;
}
.shop-cart .quantity .plus,
.shop-cart .quantity .minus {
    width: 34px;
    height: 34px;
    border: 0;
    background: var(--aff-soft);
    cursor: pointer;
    transition: background 0.2s ease;
    pointer-events: auto !important;
    position: relative;
    z-index: 3;
    font-size: 18px !important;
    line-height: 34px !important;
    color: #111 !important;
}
.shop-cart .quantity .plus:hover,
.shop-cart .quantity .minus:hover {
    background: #111;
    color: #fff !important;
}
.shop-cart .quantity input.qty {
    width: 48px !important;
    min-width: 48px !important;
    height: 34px !important;
    min-height: 34px !important;
    line-height: 34px !important;
    font-size: 14px !important;
    color: #111 !important;
    padding: 0 !important;
    pointer-events: auto;
}
.shop-cart .proceed-to-checkout .checkout-button {
    display: block;
    width: 100%;
    text-align: center;
    background: #111 !important;
    color: #fff !important;
    border-radius: 12px !important;
    padding: 14px 20px !important;
    font-weight: 700;
    letter-spacing: 0.02em;
    transition: transform 0.2s var(--aff-ease), box-shadow 0.2s ease !important;
}
.shop-cart .proceed-to-checkout .checkout-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(0,0,0,0.18);
}
.shop-cart-empty {
    text-align: center;
    padding: 60px 20px;
}
.shop-cart-empty .aff-empty-icon {
    width: 88px;
    height: 88px;
    margin: 0 auto 18px;
    border-radius: 50%;
    background: var(--aff-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    animation: aff-float 2.4s ease-in-out infinite;
}
@keyframes aff-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

/* ---- Checkout polish ---- */
.shop-checkout .customer-details,
.shop-checkout .checkout-review-order {
    border: 1px solid var(--aff-line);
    border-radius: 16px;
    padding: 28px 24px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(0,0,0,0.04);
    animation: aff-fade-up 0.5s var(--aff-ease) both;
}
.shop-checkout .checkout-review-order {
    animation-delay: 0.08s;
}
@keyframes aff-fade-up {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}
.shop-checkout .billing-fields h3,
.shop-checkout .review-order-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 22px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--aff-line);
}
.shop-checkout .input-text,
.shop-checkout textarea.input-text {
    border: 1px solid var(--aff-line) !important;
    border-radius: 10px !important;
    padding: 12px 14px !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
    background: #fff !important;
}
.shop-checkout .input-text:focus,
.shop-checkout textarea.input-text:focus {
    border-color: #111 !important;
    box-shadow: 0 0 0 3px rgba(0,0,0,0.06) !important;
    outline: none;
}
.shop-checkout .payment-method {
    border: 1px solid var(--aff-line) !important;
    border-radius: 12px !important;
    padding: 14px 16px !important;
    margin-bottom: 12px !important;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s var(--aff-ease);
    background: #fff;
}
.shop-checkout .payment-method:hover {
    border-color: #bbb !important;
}
.shop-checkout .payment-method.is-selected {
    border-color: #111 !important;
    background: var(--aff-soft) !important;
    transform: translateY(-1px);
}
.shop-checkout .payment-box {
    background: transparent !important;
    padding: 10px 0 0 !important;
    animation: aff-fade-up 0.3s var(--aff-ease);
}
.shop-checkout .button.alt,
.shop-checkout .place-order .button.alt {
    background: #111 !important;
    color: #fff !important;
    border: none !important;
    border-radius: 12px !important;
    padding: 15px 24px !important;
    font-weight: 700 !important;
    letter-spacing: 0.03em;
    width: 100%;
    transition: transform 0.2s var(--aff-ease), box-shadow 0.2s ease, opacity 0.2s ease !important;
}
.shop-checkout .button.alt:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(0,0,0,0.2);
    background: #000 !important;
}
.shop-checkout .place-order .button.is-submitting {
    pointer-events: none;
    opacity: 0.7;
}
.shop-checkout .order-total h2,
.shop-checkout .cart-subtotal h2 {
    font-size: 15px;
}
.shop-checkout .order-total .total-price {
    font-size: 22px;
    font-weight: 800;
}
.shop-checkout .cart-subtotal {
    display: none; /* avoid duplicate total display; keep order-total */
}
.shop-checkout .checkout-review-order-table .order-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 14px;
    margin-top: 8px;
    border-top: 2px solid #111;
}

/* Wishlist popup motion */
.wishlist-popup {
    backdrop-filter: blur(2px);
}
.wishlist-popup .wishlist-popup-inner {
    animation: aff-drawer-in 0.35s var(--aff-ease);
}
.wishlist-popup .wishlist-popup-content-bot-inner a.wishlist-page,
.wishlist-popup .wishlist-continue {
    border-radius: 10px !important;
    transition: transform 0.2s var(--aff-ease) !important;
}
.wishlist-popup .wishlist-popup-content-bot-inner a.wishlist-page:hover,
.wishlist-popup .wishlist-continue:hover {
    transform: translateY(-2px);
}

/* Product card hover lift */
.products-entry.product-wapper {
    transition: transform 0.35s var(--aff-ease);
}
.products-entry.product-wapper:hover {
    transform: translateY(-4px);
}

@media (max-width: 767px) {
    .aff-flow-steps .step .label {
        font-size: 10px;
    }
    .aff-flow-steps .step .num {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }
    .mini-cart .cart-popup .buttons {
        grid-template-columns: 1fr;
    }
    .toast.aff-toast {
        left: 12px !important;
        right: 12px !important;
        max-width: none;
        min-width: 0;
    }
}
