/**
 * Add-to-cart loading, success state, view-cart link.
 */

/* Top progress bar */
.dt-cart-progress {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 10050;
    height: 3px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.dt-cart-progress.is-active {
    opacity: 1;
}

.dt-cart-progress__bar {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--main-color-two, #fbbf24), var(--main-color-one, #2563eb));
    transition: width 0.35s ease;
    animation: dt-cart-progress-pulse 1.2s ease-in-out infinite;
}

.dt-cart-progress.is-active .dt-cart-progress__bar {
    width: 72%;
}

@keyframes dt-cart-progress-pulse {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.65;
    }
}

/* Toast */
.dt-cart-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(12px);
    z-index: 10051;
    padding: 12px 20px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: #334155;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.2);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    text-align: center;
    white-space: nowrap;
}

.dt-cart-toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.dt-cart-toast.is-success {
    background: #059669;
}

.dt-cart-toast.is-error {
    background: #dc2626;
}

/* Header phone → contact */
.top-header-call-link {
    color: inherit;
    transition: opacity 0.2s ease;
}

.top-header-call-link:hover {
    opacity: 0.88;
    color: inherit;
}

/* Loading spinner on buttons (WC .loading — theme disables default WC CSS) */
.add_to_cart_button.loading,
.add_to_cart_button.dt-ajax-busy,
.single_add_to_cart_button.loading,
.single_add_to_cart_button.dt-ajax-busy {
    position: relative;
    pointer-events: none;
}

.product-header-btn .add_to_cart_button.loading,
.product-header-btn .add_to_cart_button.dt-ajax-busy {
    color: transparent !important;
}

.product-header-btn .add_to_cart_button.loading i,
.product-header-btn .add_to_cart_button.dt-ajax-busy i {
    visibility: hidden;
}

.add_to_cart_button.loading::after,
.add_to_cart_button.dt-ajax-busy::after,
.single_add_to_cart_button.loading::after,
.single_add_to_cart_button.dt-ajax-busy::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: dt-cart-spin 0.65s linear infinite;
}

.product-header-btn .add_to_cart_button.loading::after,
.product-header-btn .add_to_cart_button.dt-ajax-busy::after {
    border-color: rgba(37, 99, 235, 0.2);
    border-top-color: var(--main-color-one, #2563eb);
}

.single_add_to_cart_button.loading,
.single_add_to_cart_button.dt-ajax-busy {
    color: rgba(255, 255, 255, 0.15) !important;
}

.single_add_to_cart_button.loading i,
.single_add_to_cart_button.dt-ajax-busy i {
    opacity: 0.15;
}

@keyframes dt-cart-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Added state — loop card icon */
.product-header-btn .add_to_cart_button.added,
.product-header-btn .add_to_cart_button.dt-in-cart {
    background: #059669 !important;
    color: #fff !important;
}

.product-header-btn .add_to_cart_button.added i,
.product-header-btn .add_to_cart_button.dt-in-cart i {
    visibility: visible;
    color: #fff;
}

/* Loop cards — WC injects a text link; we use the icon button instead */
.product-header-btn .added_to_cart {
    display: none !important;
}

.product-header-btn a.dt-view-cart-btn,
.product-header-btn a.dt-view-cart-btn:hover {
    background: #059669 !important;
    color: #fff !important;
}

.product-header-btn a.dt-view-cart-btn i {
    color: #fff;
}

/* View cart — single product (matches add-to-cart button) */
form.cart .added_to_cart.dt-cart-view-link {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: 10px;
    padding: 10px 50px !important;
    border-radius: 0.375rem;
    border: 2px solid var(--main-color-green, #059669);
    background: #fff;
    color: var(--main-color-green, #059669) !important;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.5;
    text-decoration: none;
    box-shadow: none;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

form.cart .added_to_cart.dt-cart-view-link:hover {
    background: var(--main-color-green, #059669);
    border-color: var(--main-color-green, #059669);
    color: #fff !important;
    transform: none;
}

form.cart .added_to_cart.dt-cart-view-link i {
    font-size: 1.25rem;
    line-height: 1;
}

.single_add_to_cart_button.added,
.single_add_to_cart_button.dt-in-cart {
    background: #047857 !important;
}

@media (prefers-reduced-motion: reduce) {
    .dt-cart-progress__bar,
    .dt-cart-toast,
    .add_to_cart_button.loading::after,
    .single_add_to_cart_button.loading::after {
        animation: none !important;
        transition: none !important;
    }
}
