/* Modal Styles */
#wecod-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
}

#wecod-modal-content {
    background-color: #ffffff;
    margin: 2% auto;
    padding: 0;
    border: none;
    width: 90%;
    max-width: var(--woocod-popup-max, 600px);
    max-height: 90vh;
    position: relative;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Slideout variants */
.woocod-slideout #wecod-modal-content {
    margin: 0;
    max-width: var(--woocod-slideout-max, 900px);
    width: 100%;
    height: 100%;
    max-height: 100vh;
    border-radius: 0;
    transform: translateX(100%);
    animation: woocod-slide-in-right 0.35s ease-out forwards;
}

.woocod-slideout.left #wecod-modal-content {
    margin-left: 0;
    margin-right: auto;
    transform: translateX(-100%);
    animation: woocod-slide-in-left 0.35s ease-out forwards;
}

.woocod-slideout.right #wecod-modal-content {
    margin-left: auto;
    margin-right: 0;
}

/* Close animations based on direction */
.woocod-slideout.right.closing #wecod-modal-content { animation: woocod-slide-out-right 0.3s ease-in forwards; }
.woocod-slideout.left.closing #wecod-modal-content { animation: woocod-slide-out-left 0.3s ease-in forwards; }

.woocod-slideout #wecod-modal {
    background-color: rgba(0,0,0,0.5);
}

.woocod-slideout .wecod-modal-header {
    border-radius: 0;
}

/* Single-column layout for slideout/full view */
.woocod-slideout #wecod-order-form {
    display: block;
    max-height: calc(100vh - 100px);
}

.woocod-slideout .wecod-form-left {
    width: 100%;
}

.woocod-slideout .wecod-right-summary { 
    width: 100%; 
}


/* Coupon row */
.wecod-coupon-row {
    display: grid;
    grid-template-columns: 1fr 140px;
    gap: 10px;
    margin: 10px 0 15px 0;
}

.wecod-coupon-row input {
    padding: 12px 14px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    background: #fff;
}

.wecod-coupon-row .button {
    padding: 12px 16px;
    border-radius: 10px;
    background: #ff9800;
    color: #fff;
    border: none;
    cursor: pointer;
}

/* Smaller input sizing */
.woocod-slideout .wecod-input-group input,
.woocod-slideout .wecod-input-group textarea {
    padding: 12px 12px 12px 40px;
    font-size: 13px;
}

/* Slide animations */
@keyframes woocod-slide-in-right { to { transform: translateX(0); } }
@keyframes woocod-slide-in-left { to { transform: translateX(0); } }
@keyframes woocod-slide-out-right { to { transform: translateX(100%); } }
@keyframes woocod-slide-out-left { to { transform: translateX(-100%); } }

/* Prevent page scroll when modal open */
body.woocod-modal-open { overflow: hidden; }

.wecod-modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px 30px;
    position: relative;
    text-align: center;
}

.wecod-modal-header h2 {
    margin: 0;
    font-size: 1.4em;
    font-weight: 600;
    line-height: 1.3;
}

#wecod-modal-close {
    color: white;
    position: absolute;
    top: 20px;
    right: 25px;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.3s;
}

#wecod-modal-close:hover {
    opacity: 1;
}

/* Form Styles */
#wecod-order-form {
    padding: 30px;
    flex: 1;
    overflow-y: auto;
    max-height: calc(90vh - 100px);
}

#wecod-order-form::-webkit-scrollbar {
    width: 0px;
    background: transparent;
}

#wecod-order-form {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.wecod-form-row {
    margin-bottom: 15px;
}

.wecod-form-row label { display: inline-block; min-width: 140px; margin: 0 10px 0 0; font-weight: 600; color: #333; font-size: 0.95em; }
.wecod-form-row .wecod-input-group { flex: 1; }
.wecod-form-row { display: flex; align-items: center; gap: 10px; }

.wecod-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.wecod-icon {
    position: absolute;
    left: 15px;
    font-size: 16px;
    color: #666;
    z-index: 2;
}

.wecod-input-group input,
.wecod-input-group textarea {
    width: 100%;
    padding: 15px 15px 15px 45px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    box-sizing: border-box;
    font-size: 14px;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.wecod-input-group input:focus,
.wecod-input-group textarea:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.wecod-input-group textarea {
    min-height: 46px;
    resize: none;
}

.wecod-form-row .required {
    color: #e74c3c;
    font-weight: bold;
}

/* Shipping Section */
.wecod-shipping-section {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #e1e5e9;
}

.wecod-shipping-section h3 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 1.1em;
    font-weight: 600;
}

.wecod-shipping-option {
    display: flex;
    align-items: center;
    padding: 15px;
    margin-bottom: 10px;
    background: white;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.wecod-shipping-option:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.wecod-shipping-option.selected {
    border-color: #667eea;
    background: #f0f4ff;
}

.wecod-shipping-option input[type="radio"] {
    margin-right: 15px;
    transform: scale(1.2);
}

.wecod-shipping-option label {
    flex: 1;
    margin: 0;
    cursor: pointer;
    font-weight: 500;
}

.wecod-shipping-price {
    font-weight: 600;
    color: #667eea;
    font-size: 1.1em;
}

/* Products Section */
.wecod-products-section {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #e1e5e9;
}

.wecod-products-section h3 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 1.1em;
    font-weight: 600;
}

.wecod-product-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 10px;
    margin-bottom: 10px;
}

.wecod-product-thumbnail {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    margin-right: 15px;
    object-fit: cover;
}

.wecod-product-info {
    flex: 1;
}

.wecod-product-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.wecod-product-details {
    font-size: 0.9em;
    color: #666;
}

.wecod-product-price {
    font-weight: 600;
    color: #667eea;
    font-size: 1.1em;
}

.wecod-remove-item {
    background: none;
    border: none;
    color: #e74c3c;
    cursor: pointer;
    font-size: 18px;
    padding: 5px;
    margin-left: 10px;
}

.wecod-products-container {
    max-height: 200px;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.wecod-products-container::-webkit-scrollbar {
    width: 0px;
    background: transparent;
}

.wecod-show-more-btn {
    width: 100%;
    padding: 10px;
    background: #f8f9fa;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    color: #667eea;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.3s ease;
}

.wecod-show-more-btn:hover {
    background: #e9ecef;
    border-color: #667eea;
}

/* Order Summary */
.wecod-order-summary {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    margin: 20px 0;
    border: 1px solid #e1e5e9;
}

.wecod-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #e1e5e9;
}

.wecod-summary-row:last-child {
    border-bottom: none;
}

.wecod-total-row {
    font-weight: 700;
    font-size: 1.2em;
    color: #333;
    border-top: 2px solid #667eea;
    margin-top: 10px;
    padding-top: 15px;
}

#wecod-total {
    color: #667eea;
}

/* Button Styles */
#wecod-confirm-order-button {
    width: 100%;
    padding: 18px;
    font-size: 1.1em;
    font-weight: 600;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 15px;
}
#wecod-pay-online-button {
    width: 100%;
    padding: 14px;
    font-size: 1em;
    font-weight: 600;
    background: #0073aa;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 10px;
}

#wecod-pay-online-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 16px rgba(0, 115, 170, 0.25);
}

#wecod-confirm-order-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(40, 167, 69, 0.3);
}

#wecod-confirm-order-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.wecod-confirmation-text {
    text-align: center;
    color: #666;
    font-size: 0.9em;
    margin: 0;
    line-height: 1.4;
}

/* Responsive */
@media screen and (max-width: 768px) {
    #wecod-modal-content {
        margin: 10% auto;
        width: 95%;
    }
    
    .wecod-modal-header {
        padding: 20px 25px;
    }
    
    .wecod-modal-header h2 {
        font-size: 1.2em;
    }
    
    #wecod-order-form {
        padding: 25px 20px;
    }
    
    .wecod-shipping-option {
        padding: 12px;
    }
    
    .wecod-product-item {
        padding: 12px;
    }
    
    .wecod-product-thumbnail {
        width: 40px;
        height: 40px;
    }
}

/* COD Button Styles */
.wecod-open-modal-button,
.wecod-open-modal-button-loop {
    background: #28a745;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.wecod-open-modal-button:hover,
.wecod-open-modal-button-loop:hover {
    background: #218838;
    transform: translateY(-1px);
}

.wecod-open-modal-button.disabled,
.wecod-open-modal-button-loop.disabled,
.wecod-open-modal-button:disabled,
.wecod-open-modal-button-loop:disabled {
    background: #6c757d;
    color: #adb5bd;
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
}

.wecod-loop-button-wrapper {
    margin-top: 10px;
}

.wecod-disabled {
    background: #6c757d !important;
    color: #adb5bd !important;
    cursor: not-allowed !important;
    opacity: 0.6 !important;
}

/* ===== NEW STYLES FOR VARIANT PICKER AND CART COD ===== */

/* Variant Picker Modal */
#wecod-variant-picker-modal {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
}

.wecod-variant-picker-content {
    background-color: #ffffff;
    margin: 5% auto;
    padding: 0;
    border: none;
    width: 90%;
    max-width: 500px;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    overflow: hidden;
}

.wecod-variant-picker-header {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wecod-variant-picker-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.wecod-variant-picker-close {
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}

.wecod-variant-picker-body {
    padding: 20px;
}

.variation-row {
    margin-bottom: 15px;
}

.variation-row label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.wecod-variation-select {
    width: 100%;
    padding: 10px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    background: white;
}

.wecod-variant-picker-footer {
    padding: 20px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    background: #f8f9fa;
}

.wecod-variant-picker-confirm {
    background: #28a745;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

.wecod-variant-picker-confirm:disabled {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Cart COD Modal */
#wecod-cart-modal {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
    overflow-y: auto;
}

.wecod-cart-modal-content {
    background-color: #ffffff;
    margin: 2% auto;
    padding: 0;
    border: none;
    width: 90%;
    max-width: 800px;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.wecod-cart-modal-header {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wecod-cart-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

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

.wecod-cart-modal-body {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
}

.wecod-cart-items {
    margin-bottom: 20px;
}

.wecod-cart-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    margin-bottom: 10px;
    background: #f8f9fa;
}

.wecod-cart-item-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    margin-right: 15px;
}

.wecod-cart-item-details h4 {
    margin: 0 0 5px 0;
    font-size: 14px;
    color: #333;
}

.wecod-cart-item-details p {
    margin: 0;
    font-size: 12px;
    color: #666;
}

.wecod-cart-order-form h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 16px;
}

.wecod-cart-modal-footer {
    padding: 20px;
    background: #f8f9fa;
    border-top: 1px solid #e1e5e9;
}

.wecod-cart-order-summary {
    margin-bottom: 15px;
}

/* Cart COD Button */
.wecod-cart-cod-wrapper {
    margin-bottom: 20px;
}

.wecod-cart-cod-button {
    width: 100%;
    padding: 15px;
    font-size: 16px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.wecod-cart-cod-button:hover {
    background: #218838;
    transform: translateY(-1px);
}

/* Pick Variant Button */
.wecod-pick-variant-button {
    background: #ffc107;
    color: #212529;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    width: 100%;
}

.wecod-pick-variant-button:hover {
    background: #e0a800;
    transform: translateY(-1px);
}

/* Responsive Design */
@media (max-width: 768px) {
    .wecod-variant-picker-content,
    .wecod-cart-modal-content {
        width: 95%;
        margin: 2% auto;
    }
    
    .wecod-cart-item {
        flex-direction: column;
        text-align: center;
    }
    
    .wecod-cart-item-image {
        margin-right: 0;
        margin-bottom: 10px;
    }
    
    .wecod-variant-picker-footer {
        flex-direction: column;
    }
    
    .wecod-variant-picker-footer button {
        width: 100%;
    }
}
