/**
 * Static WooCommerce Cart
 * 
 * Styles for the localStorage-based cart system
 */

/* ==================== */
/* CART ICON CONTAINER */
/* ==================== */

.d40-static-cart-icon-container {
    position: fixed;
    top: 250px;
    right: 20px;
    background-color: #0073aa;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    z-index: 999;
    opacity: 1;
    visibility: visible;
    transition: all 0.3s ease;
}

.d40-static-cart-icon-container:hover {
    transform: scale(1.05);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}

/* Cart icon itself */
.d40-static-cart-icon {
    color: white;
    font-size: 24px;
    line-height: 1;
    position: relative;
}

/* Item count badge */
.d40-static-cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #e94b35;
    color: #fff;
    border-radius: 50%;
    min-width: 18px;
    height: 18px;
    font-size: 12px;
    line-height: 18px;
    text-align: center;
    font-weight: bold;
    display: block;
}

/* ==================== */
/* CART CONTAINER */
/* ==================== */

.d40-static-cart-container {
    position: fixed;
    top: 0;
    right: -350px;
    width: 350px;
    height: 100vh; /* Use viewport height for full height */
    max-height: 100vh;
    overflow-y: auto; /* Enable scrolling for long carts */
    background: #fff;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
    z-index: 999; /* Match our z-index standard */
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    visibility: visible;
    opacity: 1;
}

.d40-static-cart-container.active {
    right: 0;
    visibility: visible;
    opacity: 1;
}

.d40-static-cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998; /* Just below the cart container */
    display: none;
    visibility: hidden;
    opacity: 0;
    transition: all 0.3s ease;
}

.d40-static-cart-overlay.active {
    display: block;
    visibility: visible;
    opacity: 1;
}


.d40-static-cart-close {
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
}

/* Cart items container */
.d40-static-cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 15px 20px;
}

.d40-static-cart-item {
    display: flex;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.d40-static-cart-item-info {
    flex: 1;
}

.d40-static-cart-item-title {
    font-weight: 600;
    margin-bottom: 5px;
}

.d40-static-cart-item-price {
    font-size: 14px;
    color: #666;
}

/* Cart footer */
.d40-static-cart-footer {
    padding: 15px 20px;
    border-top: 1px solid #eee;
}

.d40-static-cart-subtotal {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-weight: 600;
}

/* Checkout button */
.d40-static-cart-checkout {
    background-color: #3b0072;
    color: white;
    border: none;
    padding: 12px 20px;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    width: 100%;
    cursor: pointer;
    border-radius: 3px;
    transition: background-color 0.3s ease;
}

.d40-static-cart-checkout:hover {
    background-color: #270050;
}

.d40-static-cart-checkout:disabled {
    background-color: #ddd;
    cursor: not-allowed;
}

/* Cart Loading Animation Styles */
.d40-static-cart-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    z-index: 9999;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.d40-static-cart-loading.active {
    opacity: 1;
}

.d40-static-cart-spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border-left-color: #3b0072;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

.d40-static-cart-loading-text {
    color: #333;
    font-size: 16px;
    text-align: center;
    margin-top: 10px;
    font-weight: 500;
}

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

.d40-static-cart-icon-container:hover {
    transform: scale(1.05);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}

.d40-static-cart-icon {
    color: #333;
    position: relative;
}

.d40-static-cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #e94b35;
    color: #fff;
    font-size: 11px;
    width: 18px;
    height: 18px;
    font-size: 12px;
    line-height: 18px;
    text-align: center;
    font-weight: bold;
    display: block;
}

/* Cart container styles - The slide-out cart */
.d40-static-cart-container {
    position: fixed;
    top: 0;
    right: -350px;
    width: 350px;
    height: 100%;
    background: #fff;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
    z-index: 9998;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

/* When cart is open */
.d40-static-cart-container.open {
    right: 0;
}

/* Background overlay */
.d40-static-cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9996;
    display: none;
    transition: all 0.3s ease;
}

/* Cart Header */
.d40-static-cart-container .d40-static-cart-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.d40-static-cart-container .d40-static-cart-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.d40-static-cart-close {
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}

/* Cart Items */
.d40-static-cart-items {
    padding: 20px;
    flex-grow: 1;
    overflow-y: auto;
}

.d40-static-cart-empty {
    text-align: center;
    color: #999;
    padding: 30px 0;
}

.d40-static-cart-item {
    display: flex;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.d40-static-cart-item:last-child {
    border-bottom: none;
}

.d40-static-cart-container .d40-static-cart-item-image {
    width: 80px;
    flex-shrink: 0;
}

.d40-static-cart-container .d40-static-cart-item-image img {
    width: 100%;
    height: auto;
    border-radius: 3px;
}

.d40-static-cart-container.d40-static-cart-item-details {
    padding-left: 15px;
    flex-grow: 1;
}

.d40-static-cart-container .d40-static-cart-item-details h4 {
    margin: 0 0 5px;
    font-size: 16px;
    font-weight: 500;
}

.d40-static-cart-container .d40-static-cart-item-price {
    color: #444;
    font-weight: 600;
    margin-bottom: 10px;
}

.d40-static-cart-container .d40-static-cart-item-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.d40-static-cart-container .d40-static-cart-item-controls label     {
    margin-right: 10px;
}

.d40-static-cart-container .d40-static-cart-item-qty {
    width: 50px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 5px;
}

.d40-static-cart-remove {
    margin-left: 15px;
    color: #e94b35;
    text-decoration: none;
    font-size: 13px;
}

/* Cart Footer */
.d40-static-cart-footer {
    padding: 15px 20px;
    border-top: 1px solid #eee;
    background-color: #f9f9f9;
}

.d40-static-cart-subtotal {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-weight: 600;
    font-size: 16px;
}

.d40-static-cart-checkout {
    background-color: #0073aa;
    color: #fff;
    border: none;
    padding: 12px 15px;
    width: 100%;
    text-align: center;
    border-radius: 3px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.2s ease;
}

.d40-static-cart-checkout:hover {
    background-color: #005177;
}

.d40-static-cart-checkout:disabled {
    background-color: #ddd;
    cursor: not-allowed;
}

/* Overlay */
.d40-static-cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.d40-static-cart-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Checkout iframe */
.d40-checkout-iframe-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.d40-checkout-iframe {
    width: 90%;
    height: 90%;
    border: none;
    background: #fff;
    border-radius: 5px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.d40-checkout-iframe-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: #fff;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}
