/* Auto Orders Cart and Button Styles */

/* Cart Overlay */
.auto-orders-cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
    z-index: 999998;
}

.auto-orders-cart-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Cart Container */
.auto-orders-cart {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: #fff;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease-in-out;
    z-index: 999999;
}

.auto-orders-cart.active {
    right: 0;
}

body.auto-orders-cart-open {
    overflow: hidden;
}

/* Cart Inner Structure */
.auto-orders-cart-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.auto-orders-cart-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.auto-orders-cart-header h2 {
    margin: 0;
    font-size: 1.5em;
}

.auto-orders-cart-header .close-cart {
    cursor: pointer;
    color: black;
    background: none;
    border: none;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auto-orders-cart-header .close-cart svg {
    width: 24px;
    height: 24px;
}

.auto-orders-cart-header .close-cart:hover {
    opacity: 0.7;
}

.auto-orders-cart-header .close-cart span {
    line-height: 1;
    display: block;
}

.auto-orders-cart-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.auto-orders-cart-footer {
    padding: 20px;
    border-top: 1px solid #eee;
    background: #f9f9f9;
}
.auto-orders-cart-footer .cart-total {
    margin-bottom: 10px;
}

.proceed-auto-order {
    width: 100%;
    text-align: center;
}

@media (max-width: 480px) {
    .auto-orders-cart {
        width: 100%;
        right: -100%;
    }
}

/* Button Styles */
.add-to-auto-orders-button {
    transition: all 0.2s ease-in-out;
    cursor: pointer;
    position: relative;
    background-color: #000 !important;
}

.add-to-auto-orders-button:hover {
    opacity: 0.85;
}

.add-to-auto-orders-button:active {
    transform: translateY(1px);
}

.add-to-auto-orders-button.disabled,
.add-to-auto-orders-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.add-to-auto-orders-button.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 10px;
    width: 16px;
    height: 16px;
    margin-top: -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: button-loading-spinner 0.6s linear infinite;
}

@keyframes button-loading-spinner {
    to {
        transform: rotate(360deg);
    }
}

/* Cart Loading State */
.cart-items.loading {
    position: relative;
    min-height: 100px;
}

.cart-items.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top-color: #000;
    border-radius: 50%;
    animation: cart-loading-spinner 0.8s linear infinite;
}

@keyframes cart-loading-spinner {
    to {
        transform: rotate(360deg);
    }
}

/* Cart Products List */
.auto-order-products {
    list-style: none;
    margin: 0;
    padding: 0;
}
.auto-order-products .remove-product {
    background-color: #000;
}

.auto-order-product {
    display: flex;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #eee;
}

.auto-order-product:last-child {
    border-bottom: none;
}

.product-image {
    width: 60px;
    height: 60px;
    margin-right: 15px;
    flex-shrink: 0;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.product-info {
    flex: 1;
}

.product-name {
    font-weight: 500;
    color: #333;
    text-decoration: none;
    margin-bottom: 5px;
}

.product-details {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #666;
    font-size: 0.9em;
}

.auto-orders-cart-content .product-quantity {
    color: #999;
}

.product-subtotal {
    font-weight: 500;
    color: #333;
}

.remove-product {
    background: none;
    border: none;
    color: #999;
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
    margin-left: 10px;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.remove-product:hover {
    background-color: #f5f5f5;
} 


.auto-order-link .link {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--e-global-color-secondary);
}
.auto-order-link .checkbox {
    display: flex;
    justify-content: start;
    align-items: center;
    background-color: currentColor;
    padding: 2px;
    width: 42px;
    height: 24px;
    border-radius: 50px;
}
.auto-order-link .checkbox::before {
    content: '';
    display: inline-block;
    border-radius: 50%;
    height: 100%;
    aspect-ratio: 1;
    background-color: #fff;
}
.auto-order-link .label::after {
    content: ' выключен';
}
.auto-order-link._active .checkbox {
    justify-content: end;
    background-color: var(--e-global-color-primary);
}
.auto-order-link._active .label::after {
    content: ' включён';
}
.top-bar-right:has(.auto-order-link) + .top-bar-right {
    display: none;
}
.top-bar-right:has(.custom-html-widget:empty) {
    display: none;
}
@media (min-width: 993px) {
    .auto-order-link:has(+ .shoptimizer-myaccount) {
        display: none;
    }
}

@media (max-width: 992px) {
    .auto-order-link .checkbox {
        flex-direction: column;
        width: 18px;
        height: 30px;
    }
    .auto-order-link .checkbox::before {
        height: auto;
        width: 100%;
    }
    .auto-order-link .label {
        display: flex;
        text-transform: lowercase;
        flex-direction: column;
        line-height: 1;
    }
    .site-header .auto-order-link {
        position: absolute;
        top: 50%;
        translate: 0 -50%;
        right: 60px;
        font-size: 14px;
    }
    .site-header:has(.auto-order-link) .shoptimizer-myaccount {
        display: none;
        align-items: center;
        margin-right: 120px;
        z-index: 2;
    }
}
@media (max-width:380px) {
    .site-header:has(.auto-order-link) .shoptimizer-myaccount {
        margin-right: 100px;
        z-index: 2;
    }
}
@media (max-width:330px) {
    .site-header .auto-order-link {
        display: none;
    }
    .site-header:has(.auto-order-link) .shoptimizer-myaccount {
        margin-right: 0px;
        z-index: 2;
    }
}
@media (min-width: 993px) {
    .shoptimizer-myaccount .auto-order-link {
        display: none;
    }
}
