/**
 * Mini-cart styling for Camper Jack Service theme
 * Following Camper Jack Service style specifications
 */

/* Mini-cart sidebar */
.mini-cart-sidebar {
    position: fixed;
    top: 0;
    right: -350px;
    width: 350px;
    height: 100vh;
    background-color: #ffffff;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    transition: right 0.3s ease-in-out;
    overflow-y: auto;
    padding: 20px;
}

/* Improved responsiveness for small screens */
@media (max-width: 480px) {
    .mini-cart-sidebar {
        width: 85%;
        right: -85%;
    }
}

.mini-cart-sidebar.active {
    right: 0;
}

.mini-cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(54, 54, 54, 0.7);
    z-index: 999;
    display: none;
}

.mini-cart-overlay.active {
    display: block;
}

/* Mini-cart header */
.mini-cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.mini-cart-header h3 {
    font-size: 18px;
    font-weight: bold;
    color: #000000;
    margin: 0;
}

.mini-cart-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    color: #4a4a4a;
    transition: color 0.2s ease;
}

.mini-cart-close:hover {
    color: #ff8c00;
}

/* Mini-cart items */
.woocommerce-mini-cart {
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
    max-height: calc(100vh - 250px);
    overflow-y: auto;
}

.woocommerce-mini-cart-item {
    position: relative;
    padding: 15px 35px 15px 0;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 10px;
    transition: background-color 0.2s ease;
}

.woocommerce-mini-cart-item:hover {
    background-color: #f5f5f5;
}

.woocommerce-mini-cart-item a:not(.remove) {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #000000;
    font-weight: normal;
    font-size: 14px;
}

.woocommerce-mini-cart-item img {
    width: 60px;
    height: auto;
    margin-right: 12px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.woocommerce-mini-cart-item .remove {
    position: absolute;
    top: 15px;
    right: 0;
    color: #4a4a4a;
    font-size: 18px;
    line-height: 1;
    text-decoration: none;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.woocommerce-mini-cart-item .remove:hover {
    color: #ff6b35;
}

.woocommerce-mini-cart-item .quantity {
    font-size: 14px;
    color: #4a4a4a;
    display: block;
    margin-top: 5px;
}

.woocommerce-mini-cart-item .price {
    display: block;
    font-weight: bold;
    font-size: 16px;
    color: #ff8c00;
    margin-top: 5px;
}

/* Part compatibility indicator */
.part-compatibility {
    font-size: 12px;
    color: #4a4a4a;
    padding: 4px 8px;
    background-color: #f5f5f5;
    border-radius: 4px;
    margin-top: 8px;
    display: inline-block;
}

.part-compatibility.compatible {
    color: #4CAF50;
    background-color: rgba(76, 175, 80, 0.1);
}

.part-compatibility.incompatible {
    color: #F44336;
    background-color: rgba(244, 67, 54, 0.1);
}

/* Mini-cart total */
.woocommerce-mini-cart__total {
    display: flex;
    justify-content: space-between;
    font-weight: bold;
    padding: 15px 0;
    margin: 15px 0;
    border-top: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
    font-size: 16px;
}

.woocommerce-mini-cart__total .amount {
    color: #ff8c00;
}

/* Mini-cart actions */
.mini-cart-actions {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mini-cart-actions .button {
    text-transform: uppercase;
    font-weight: 500;
    font-size: 16px;
    letter-spacing: 0.5px;
    padding: 12px 16px;
    border-radius: 4px;
    text-align: center;
    transition: all 0.3s ease;
    display: block;
    width: 100%;
}

.mini-cart-actions .checkout-button {
    background-color: #ff8c00;
    color: white;
    border: none;
}

.mini-cart-actions .checkout-button:hover {
    background-color: #ff6b35;
}

.mini-cart-actions .view-cart-button {
    background-color: white;
    color: #ff8c00;
    border: 1px solid #ff8c00;
}

.mini-cart-actions .view-cart-button:hover {
    background-color: rgba(255, 140, 0, 0.1);
}

/* Hide WooCommerce default buttons */
.woocommerce-mini-cart__buttons {
    display: none !important;
}

/* Cart button count */
.cart-button {
    position: relative;
}

.cart-button .cart-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #ff8c00;
    color: white;
    font-size: 12px;
    font-weight: bold;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    position: absolute;
    top: -8px;
    right: -8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Empty cart message */
.woocommerce-mini-cart__empty-message {
    text-align: center;
    color: #4a4a4a;
    padding: 30px 0;
    font-size: 16px;
}

/* Add styles for the removing item spinner */
.item-removing-spinner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    border-radius: 4px;
}

.item-removing-spinner:after {
    content: "";
    width: 24px;
    height: 24px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #ff8c00;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Shipping information */
.mini-cart-shipping-info {
    font-size: 12px;
    color: #4a4a4a;
    text-align: center;
    margin-top: 15px;
    padding: 10px;
    background-color: #f5f5f5;
    border-radius: 4px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .woocommerce-mini-cart-item {
        padding: 12px 30px 12px 0;
    }
    
    .woocommerce-mini-cart-item img {
        width: 50px;
    }
    
    .mini-cart-actions .button {
        padding: 10px 14px;
        font-size: 14px;
    }
}

/* Animation for cart items */
.woocommerce-mini-cart-item.new-item {
    animation: highlightItem 2s ease;
}

@keyframes highlightItem {
    0% { background-color: rgba(255, 140, 0, 0.2); }
    100% { background-color: transparent; }
}

/* Ensure mini-cart items have position relative for the spinner positioning */
.woocommerce-mini-cart-item {
    position: relative;
} 