/* Cart Drawer Styles */
.custom-cart-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99998;
    display: none;
}

.custom-cart-drawer {
    position: fixed;
    top: 0;
    right: -100%;
    width: 400px;
    height: 100%;
    background: #f8f9fa;
    box-shadow: -2px 0 15px rgba(0, 0, 0, 0.1);
    z-index: 99999;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

/* Cart Drawer Header */
.cart-drawer-header {
    padding: 18px 20px;
    border-bottom: 1px solid #e0e0e0;
    background: white;
    flex-shrink: 0;
}

.cart-drawer-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.close-cart-drawer {
    background: none !important;
    border: none !important;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s;
}

.close-cart-drawer:hover {
    background: #f5f5f5 !important;
}

.close-cart-drawer:active,
.close-cart-drawer:focus,
.close-cart-drawer:focus-visible {
    background: none !important;
    outline: none !important;
    box-shadow: none !important;
}

/* Cart Drawer Content */
.cart-drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px 20px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.cart-drawer-content::-webkit-scrollbar {
    display: none;
}

/* Cart Product Card */
.cart-product-card {
    background: white;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 12px;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.05);
}

.cart-product-image {
    flex-shrink: 0;
    width: 100px;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #eee;
}

.cart-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-product-details {
    flex: 1;
    min-width: 0;
}

.cart-product-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    line-height: 2.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-remove-item {
    background: none !important;
    border: none !important;
    color: #b6b6b8;
    cursor: pointer;
    font-size: 18px;
    padding: 0;
    margin-left: 5px;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.cart-remove-item:hover {
    color: #ff0000;
    background: rgba(255, 0, 0, 0.05) !important;
}

.cart-remove-item:active,
.cart-remove-item:focus,
.cart-remove-item:focus-visible {
    background: none !important;
    outline: none !important;
    box-shadow: none !important;
    color: #ff0000;
}

/* Custom Cable Badge */
.cart-custom-cable-badge {
    background: #f0f7f5;
    padding: 4px 8px;
    border-radius: 20px;
    margin-bottom: 6px;
    text-align: center;
}

.cart-custom-cable-badge span {
    font-size: 14px;
    color: #129978;
    font-weight: 500;
}

/* Cart Quantity Controls - FIXED FOR iOS/SAFARI */
.cart-qty-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    padding: 5px;
    background: white;
    height: 38px;
}

.cart-qty-minus,
.cart-qty-plus {
    width: 28px;
    height: 28px;
    border: none !important;
    background: transparent !important;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    font-weight: 600;
    color: #666;
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
    transition: all 0.2s ease;
}

.cart-qty-minus:hover {
    background: rgba(255, 0, 0, 0.1) !important;
    color: #ff0000;
}

.cart-qty-plus:hover {
    background: rgba(18, 153, 120, 0.1) !important;
    color: #129978;
}

.cart-qty-minus:active,
.cart-qty-minus:focus,
.cart-qty-minus:focus-visible,
.cart-qty-plus:active,
.cart-qty-plus:focus,
.cart-qty-plus:focus-visible {
    background: transparent !important;
    outline: none !important;
    box-shadow: none !important;
    color: #666;
}

/* FIXED: Quantity input for iOS/Safari - ensures number displays properly */
.cart-qty-input {
    width: 40px;
    height: 28px;
    min-height: 28px;
    max-height: 28px;
    text-align: center;
    border: none !important;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    padding: 0;
    margin: 0;
    flex-shrink: 0;
    background: transparent;
    outline: none;
    box-shadow: none;
    line-height: 28px;
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
}

.cart-qty-input:focus {
    outline: none;
    box-shadow: none;
    border: none !important;
}

/* Remove number input spinners */
.cart-qty-input::-webkit-inner-spin-button,
.cart-qty-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
    appearance: none;
}

.cart-qty-input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Additional iOS/Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    .cart-qty-controls {
        height: 40px;
    }
    
    .cart-qty-input {
        height: 32px;
        min-height: 32px;
        max-height: 32px;
        line-height: 32px;
        font-size: 15px;
    }
    
    .cart-qty-minus,
    .cart-qty-plus {
        width: 30px;
        height: 30px;
    }
}

/* Cart Total */
.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0px;
    border-bottom: 1px solid #eee;
    padding-bottom: 0px;
}

.cart-total-label {
    font-size: 16px;
    color: #000000;
}

.cart-total-amount {
    font-size: 24px;
    font-weight: bold;
    color: #000000;
}

/* Cart Footer */
.cart-drawer-footer {
    border-top: 1px solid #e0e0e0;
    background: white;
    flex-shrink: 0;
    padding: 5px 10px;
}

/* Benefits Row */
.cart-benefits-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.cart-benefit-item {
    display: flex;
    align-items: center;
    flex: 1;
    padding: 0 5px;
}

.cart-benefit-icon {
    width: 50px;
    height: 50px;
    min-width: 50px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-shrink: 0;
    padding: 3px;
}

.cart-benefit-icon img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    display: block;
}

.cart-benefit-text {
    min-width: 0;
    margin-left: 2px;
}

.cart-benefit-title {
    font-size: 13px;
    font-weight: 500;
    color: #000;
    line-height: 1.1;
    white-space: nowrap;
}

.cart-benefit-subtitle {
    font-size: 12px;
    color: #666;
    line-height: 1.1;
    white-space: nowrap;
}

/* Secure Checkout Button */
.secure-checkout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 7px;
    background: #000000;
    color: white !important;
    border: none;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 0px;
    transition: all 0.3s;
    position: relative;
}

.secure-checkout-btn:hover {
    background: #0d7a5f;
    transform: translateY(-1px);
    color: white;
}

.secure-checkout-btn:active,
.secure-checkout-btn:focus,
.secure-checkout-btn:focus-visible {
    background: #000000;
    outline: none;
    box-shadow: none;
}

/* Payment Icons */
.payment-icons {
    text-align: center;
    margin-top: 0px;
}

.payment-icons-row {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 0px;
    margin-top: 5px;
    flex-wrap: wrap;
}

.payment-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.payment-icon img {
    width: 50px;
    height: 35px;
    object-fit: contain;
    display: block;
}

.payment-footer-text {
    font-size: 12px;
    color: #888;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 0px;
    margin-bottom: 10px;
}

/* Empty Cart Message */
.empty-cart-message {
    text-align: center;
    padding: 60px 20px;
}

.empty-cart-icon {
    font-size: 48px;
    margin-bottom: 15px;
    color: #ddd;
}

.empty-cart-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 10px;
    color: #666;
}

.empty-cart-subtitle {
    color: #999;
    font-size: 14px;
}

/* Responsive */
@media (max-width: 480px) {
    .custom-cart-drawer {
        width: 100%;
        right: -100%;
    }
    
    .cart-product-image {
        width: 80px;
        height: 80px;
    }
    
    .cart-benefit-title,
    .cart-benefit-subtitle {
        white-space: normal;
        font-size: 10px;
    }
    
    .cart-benefit-icon {
        width: 40px;
        min-width: 40px;
    }
    
    .cart-benefit-icon img {
        width: 28px;
        height: 28px;
    }
    
    /* iOS/Safari responsive fixes */
    @supports (-webkit-touch-callout: none) {
        .cart-qty-controls {
            height: 38px;
        }
        
        .cart-qty-input {
            height: 30px;
            min-height: 30px;
            max-height: 30px;
            line-height: 30px;
            font-size: 14px;
        }
        
        .cart-qty-minus,
        .cart-qty-plus {
            width: 28px;
            height: 28px;
        }
    }
}

/* ===== FIX: Ensure close button has NO background on all pages ===== */
.close-cart-drawer,
.close-cart-drawer:hover,
.close-cart-drawer:active,
.close-cart-drawer:focus,
.close-cart-drawer:focus-visible,
.close-cart-drawer:visited,
button.close-cart-drawer,
button.close-cart-drawer:hover,
button.close-cart-drawer:active,
button.close-cart-drawer:focus,
button.close-cart-drawer:focus-visible {
    background: none !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
}

/* Also ensure any parent elements don't add background */
.custom-cart-drawer .cart-drawer-header .close-cart-drawer,
.custom-cart-drawer .cart-drawer-header button.close-cart-drawer {
    background: none !important;
    background-color: transparent !important;
}

/* Override any home page specific styles that might affect the close button */
body.home .close-cart-drawer,
body.home button.close-cart-drawer,
body.home .custom-cart-drawer .close-cart-drawer {
    background: none !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
}

/* =========================================== */
/* IOS/SAFARI FIXES - PLACE ORDER BUTTON ALIGNMENT */
/* =========================================== */

/* Fix for iOS/Safari - Prevent button from going out of screen */
@supports (-webkit-touch-callout: none) {
    
    /* Ensure the payment section container doesn't overflow */
    .payment-section {
        width: 100% !important;
        overflow-x: visible !important;
        position: relative !important;
    }
    
    #payment {
        width: 100% !important;
        overflow-x: visible !important;
    }
    
    /* Place order button container */
    #payment .place-order,
    body.woocommerce-checkout #custom-checkout-wrapper #payment div.place-order,
    #custom-checkout-wrapper #payment div.place-order {
        width: 100% !important;
        padding: 15px 0 5px 0 !important;
        margin: 0 !important;
        text-align: left !important;
        overflow-x: visible !important;
        box-sizing: border-box !important;
    }
    
    /* Place order button itself */
    #place_order,
    body.woocommerce-checkout #custom-checkout-wrapper #payment div.place-order .button,
    #custom-checkout-wrapper #payment div.place-order .button {
        width: auto !important;
        min-width: 160px !important;
        max-width: 100% !important;
        padding: 12px 25px !important;
        background: var(--brand-primary) !important;
        color: white !important;
        border: none !important;
        border-radius: 8px !important;
        font-size: 15px !important;
        font-weight: 700 !important;
        cursor: pointer !important;
        transition: background 0.2s !important;
        text-transform: uppercase !important;
        letter-spacing: 0.5px !important;
        display: inline-block !important;
        margin: 10px 0 !important;
        line-height: 1.4 !important;
        box-sizing: border-box !important;
        white-space: nowrap !important;
    }
    
    /* For smaller screens, allow button to wrap text if needed */
    @media (max-width: 480px) {
        #place_order,
        body.woocommerce-checkout #custom-checkout-wrapper #payment div.place-order .button,
        #custom-checkout-wrapper #payment div.place-order .button {
            white-space: normal !important;
            min-width: 140px !important;
            width: auto !important;
            max-width: calc(100% - 20px) !important;
            padding: 12px 20px !important;
            font-size: 14px !important;
        }
        
        /* Ensure the container doesn't overflow */
        .checkout-left-column {
            overflow-x: visible !important;
            padding: 30px 20px !important;
        }
        
        #payment .place-order {
            overflow-x: visible !important;
            text-align: center !important;
        }
    }
    
    /* Additional fix for very small screens */
    @media (max-width: 380px) {
        #place_order,
        body.woocommerce-checkout #custom-checkout-wrapper #payment div.place-order .button,
        #custom-checkout-wrapper #payment div.place-order .button {
            width: 100% !important;
            max-width: 100% !important;
            text-align: center !important;
            white-space: normal !important;
            padding: 12px 15px !important;
        }
    }
}

/* Ensure the button container doesn't overflow on any device */
#payment .place-order,
body.woocommerce-checkout #custom-checkout-wrapper #payment div.place-order,
#custom-checkout-wrapper #payment div.place-order {
    overflow-x: visible !important;
    clear: both !important;
}

/* Make sure the button doesn't get cut off */
#place_order,
body.woocommerce-checkout #custom-checkout-wrapper #payment div.place-order .button,
#custom-checkout-wrapper #payment div.place-order .button {
    overflow: visible !important;
    position: relative !important;
    z-index: 1 !important;
}