/*
===================================================================
=== Base Form & Modal Styles
===================================================================
*/

/* Main custom form container */
main#clm-custom-form-container {
    padding: 20px; border-radius: 8px; box-sizing: border-box;
    background-color: #f2f2f2; max-width: 500px; margin: auto;
}

/* General input fields */
main#clm-custom-form-container input:not([type="checkbox"]),
main#clm-custom-form-container textarea,
#clmMessageModal #clm-otp-code-input {
    width: 100%; padding: 12px; margin: 10px 0; border-radius: 4px;
    font-size: 16px; box-sizing: border-box; border: 1px solid #ccc;
    background-color: #ffffff;
}

main#clm-custom-form-container textarea { resize: vertical; }

/* Phone input styles */
.iti { width: 100%; margin: 10px 0; display: block; }

/* Button styles */
main#clm-custom-form-container button, #clmMessageModal button {
    width: 100%; padding: 12px; margin-top: 10px; margin-bottom: 10px;
    border-radius: 4px; font-size: 16px; box-sizing: border-box;
    background-color: #fde90f; color: #000000; border: none;
    cursor: pointer; transition: background-color 0.3s ease, color 0.3s ease;
}
main#clm-custom-form-container button:hover, #clmMessageModal button:hover {
    background-color: #f3622a; color: #ffffff;
}

/* Modal styles */
.clm-modal {
    display: none; position: fixed; z-index: 9999; left: 0; top: 0;
    width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.5);
}
.clm-modal-content {
    background-color: #fefefe; margin: 15% auto; padding: 20px 25px;
    border: 1px solid #888; width: 80%; max-width: 450px; border-radius: 5px;
    position: relative; box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}
.clm-modal-close {
    color: #aaa; float: right; font-size: 28px; font-weight: bold; line-height: 1;
}
.clm-modal-close:hover, .clm-modal-close:focus {
    color: black; text-decoration: none; cursor: pointer;
}
.clm-modal-content h3 {
    margin-top: 0; margin-bottom: 15px; border-bottom: 1px solid #eee; padding-bottom: 10px;
}
.clm-modal-success #clmMessageModalTitle { color: #2b8a3e; }
.clm-modal-error #clmMessageModalTitle { color: #d9480f; }
.clm-modal-warning #clmMessageModalTitle { color: #f08c00; }
.clm-modal-info #clmMessageModalTitle { color: #1971c2; }

/* Loading spinner */
.clm-spinner {
    display: inline-block; width: 1em; height: 1em;
    border: 2px solid rgba(0, 0, 0, 0.1); border-left-color: #fff;
    border-radius: 50%; animation: clm-spin 1s linear infinite;
    vertical-align: middle; margin-left: 0.5em;
}
@keyframes clm-spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/*
===================================================================
=== Fancy Two-Column Checkout Styles
===================================================================
*/

/* Main wrapper for the entire checkout area */
.clm-checkout-wrapper {
    width: 100%;
    max-width: 1200px; /* Set a max-width for very large screens */
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

/* Clearfix to contain the floated columns inside the form */
form.woocommerce-checkout::after {
    content: "";
    display: table;
    clear: both;
}

/* Left Column: Customer Details */
.clm-checkout-col-1 {
    float: left;
    width: 57%; /* Adjust width for gutter */
    padding-right: 35px; /* Create space between columns */
    box-sizing: border-box;
}

/* Right Column: Order Summary & Payment */
.clm-checkout-col-2 {
    float: right;
    width: 43%;
    box-sizing: border-box;
    position: sticky;
    top: 40px; /* Adjust based on your header height if needed */
}

/* Create a unified card for the order review section */
.clm-checkout-col-2 #order_review_heading,
.clm-checkout-col-2 #order_review {
    background-color: #f7f8f9;
    border-left: 1px solid #e1e3e5;
    border-right: 1px solid #e1e3e5;
    padding-left: 30px;
    padding-right: 30px;
    box-sizing: border-box;
    width: 100% !important;
    float: none !important;
}

/* Style the heading part of the card */
.clm-checkout-col-2 #order_review_heading {
    padding-top: 25px;
    padding-bottom: 20px;
    border-top: 1px solid #e1e3e5;
    border-radius: 12px 12px 0 0;
    margin-bottom: 0;
    font-size: 1.5em;
    color: #1d2327;
}

/* Style the table container part of the card */
.clm-checkout-col-2 #order_review {
    padding-top: 20px;
    padding-bottom: 30px;
    border-bottom: 1px solid #e1e3e5;
    border-radius: 0 0 12px 12px;
    margin-top: 0;
}


/* --- Clean Order Table Styles --- */
.woocommerce-checkout-review-order-table {
    border-collapse: collapse !important; width: 100%; border: none !important;
}
.woocommerce-checkout-review-order-table th,
.woocommerce-checkout-review-order-table td {
    border: none !important; padding: 15px 0 !important; background: none !important;
}
.woocommerce-checkout-review-order-table tbody tr,
.woocommerce-checkout-review-order-table tfoot tr {
    border-bottom: 1px solid #e1e3e5;
}
.woocommerce-checkout-review-order-table tfoot tr:last-child {
    border-bottom: none;
}
.woocommerce-checkout-review-order-table thead th {
    text-align: left; font-weight: 500; text-transform: uppercase;
    font-size: 0.9em; color: #555;
    border-bottom: 2px solid #e1e3e5 !important;
}
.woocommerce-checkout-review-order-table .product-total,
.woocommerce-checkout-review-order-table tfoot td {
    text-align: right;
}
.woocommerce-checkout-review-order-table .order-total th,
.woocommerce-checkout-review-order-table .order-total td {
    padding-top: 20px; font-weight: bold; font-size: 1.2em; color: #1d2327;
}

/* Style the payment section as a distinct card */
.clm-checkout-col-2 #payment {
    border-radius: 12px; padding: 0px;
    margin-top: 20px; border: 0px solid #e1e3e5;
}

/*
===================================================================
=== Checkout Quantity Modifier Styles (Responsive)
===================================================================
*/
#clm-checkout-quantity-manager {
    margin-top: 2.5em; margin-bottom: 2em; width: 100%;
}
.clm-product-row {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: 15px; padding: 1em; border: 1px solid #ddd;
    border-radius: 8px; margin-bottom: 1em; position: relative;
}
.clm-product-row:last-child { margin-bottom: 0; }
.clm-product-selector { flex-shrink: 0; }
.clm-product-image img {
    width: 50px; height: 50px; object-fit: cover;
    border-radius: 4px; display: block;
}
.clm-product-info {
    flex-grow: 1; font-weight: 600; min-width: 0px;
}
.clm-product-actions {
    display: flex; align-items: center; justify-content: space-between;
    flex-grow: 1; flex-basis: 200px;
}
.clm-quantity-control { display: flex; }
.clm-qty-input {
    width: 40px !important; height: 30px !important; text-align: center;
    padding: 5px !important; margin: 0 !important; border: 1px solid #ccc !important;
    border-left: none !important; border-right: none !important;
    border-radius: 0 !important; -moz-appearance: textfield;
}
.clm-qty-input::-webkit-outer-spin-button, .clm-qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none; margin: 0;
}
.clm-qty-btn {
    width: 28px !important; height: 30px !important; padding: 0 !important;
    font-size: 1em; line-height: 28px; border: 1px solid #ccc; background-color: #f9f9f9;
}
.clm-qty-btn.minus { border-radius: 4px 0 0 4px; }
.clm-qty-btn.plus { border-radius: 0 4px 4px 0; }
.clm-product-pricing { font-weight: 700; }
.clm-product-row.clm-processing::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(255, 255, 255, 0.6); z-index: 10; border-radius: 8px;
}

/* Style for the new container grouping image and name */
.clm-product-details {
    display: flex;
    align-items: center;
    gap: 15px; /* Creates space between the image and name */
    flex-grow: 1; /* Allows this group to take up available space */
    min-width: 240px; /* Helps with wrapping on small screens */
}
/*
===================================================================
=== Responsive & Universal Compatibility Overrides
===================================================================
*/

/* Mobile stacking */
@media (max-width: 992px) {
    .clm-checkout-col-1,
    .clm-checkout-col-2 {
        float: none; width: 100%; position: static; padding-right: 0;
    }
    .clm-checkout-col-2 { margin-top: 30px; }
}

/* This block targets common theme content containers and forces them
   to be full-width ONLY on the checkout page, allowing our layout to work. */
body.woocommerce-checkout .site-content > .container,
body.woocommerce-checkout .site-content > .ast-container,
body.woocommerce-checkout #primary,
body.woocommerce-checkout #main,
body.woocommerce-checkout .main,
body.woocommerce-checkout .content-area,
body.woocommerce-checkout .entry-content {
    max-width: 100% !important;
    padding-left: 0px !important;
    padding-right: 0px !important;
    box-sizing: border-box;
}

/* Neutralize the default WooCommerce/theme column system (.col2-set) */
.clm-checkout-wrapper .col2-set,
.clm-checkout-wrapper .col2-set .col-1,
.clm-checkout-wrapper .col2-set .col-2 {
    float: none !important; width: 100% !important; padding: 0 !important;
    margin: 0 !important; max-width: 100% !important;
}

/* Force Elementor widget container to be full width */
.elementor-widget-shortcode .elementor-widget-container { width: 100%; }

/* Hides fields disabled from the Checkout Customizer settings */
.clm-hidden-field {
    display: none !important;
}

.woocommerce-checkout-review-order-table th,
.woocommerce-checkout-review-order-table td {
    border: none !important; 
    padding: 10px 0 !important;
    background: none !important;
}

/*
===================================================================
=== Checkout Spacing Tweaks (High Specificity Version)
===================================================================
*/

/* --- Left Column: Tighter Customer Fields --- */
body.woocommerce-checkout .clm-checkout-col-1 .form-row {
    margin-bottom: 5px !important;
    padding: 0 !important;
}

body.woocommerce-checkout .clm-checkout-col-1 .form-row label {
    margin-bottom: 5px !important;
}


/* --- Right Column: Tighter Order Summary (NEW SELECTORS) --- */
body.woocommerce-checkout #order_review .woocommerce-checkout-review-order-table th,
body.woocommerce-checkout #order_review .woocommerce-checkout-review-order-table td {
    padding-top: 1px !important;
    padding-bottom: 1px !important;
}

body.woocommerce-checkout #order_review .woocommerce-checkout-review-order-table .order-total th,
body.woocommerce-checkout #order_review .woocommerce-checkout-review-order-table .order-total td {
    padding-top: 0px !important;
}

/*
===================================================================
=== Final Fix for Shipping Row Spacing (Maximum Force)
===================================================================
*/

/* 1. Force the padding on the table cell itself. */
body.woocommerce-checkout #order_review tr.shipping td {
    padding-top: 5px !important;
    padding-bottom: 5px !important;
}

/* 2. Target EVERYTHING inside the cell and remove all extra margins and padding. */
body.woocommerce-checkout #order_review tr.shipping td * {
    padding: 0 !important;
    margin: 0 !important;
}

/* 3. Restore the layout of the text and price within the label. */
body.woocommerce-checkout #order_review tr.shipping td label {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
}

/*
===================================================================
=== Reduce Payment Method Padding
===================================================================
*/

body.woocommerce-checkout #payment ul.payment_methods li.wc_payment_method {
    padding-top: 5px !important;
    padding-bottom: 5px !important;
    margin-bottom: 0px !important;
    background: #e4e4e4 !important;
    padding: 1em 1em; 
    border-radius: 15px;
    margin-bottom: 0.5em;
}

/*
===================================================================
=== Reduce Space Below Order Table
===================================================================
*/

body.woocommerce-checkout #order_review {
    margin-bottom: 1px !important;
}

/*
===================================================================
=== Reduce Space Before Place Order Button
===================================================================
*/

.woocommerce-page.woocommerce-checkout #payment div.form-row, .woocommerce.woocommerce-checkout #payment div.form-row {
    margin-top: 0px !important;
}

/*
===================================================================
=== Make "Your Order" Section Transparent
===================================================================
*/

body.woocommerce-checkout .clm-checkout-col-2 #order_review_heading,
body.woocommerce-checkout .clm-checkout-col-2 #order_review {
    /* This is the original light grey color with 50% transparency */
    background-color: rgba(247, 248, 249, 0.40) !important;
}

/*
===================================================================
=== Remove WooCommerce AJAX Loading Overlay Background
===================================================================
*/

.woocommerce .blockUI.blockOverlay {
    background: none !important;
}


/*
===================================================================
=== Universal Styles for "Place Order" Button (Revised Centering)
===================================================================
*/

/* 1. Reset text-align on the container, as we will center the button itself */
body.woocommerce-checkout #payment .form-row.place-order {
    text-align: left; /* Reset to default */
}

/* 2. Style the button with a new centering method */
body.woocommerce-checkout #payment #place_order {
    /* --- Centering Logic --- */
    display: block;          /* Treat the button as a block-level element */
    margin-left: auto;       /* Automatically calculate left margin */
    margin-right: auto;      /* Automatically calculate right margin */
    float:none !important;
    
    /* --- Shape & Sizing --- */
    width: 90%;              /* Make the button 90% of the container's width */
    max-width: 320px;        /* Set a maximum width for larger screens */
    padding: 14px 20px;
    border-radius: 9999px;   /* Capsule shape */
    border: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);

    /* --- Typography --- */
    font-size: 16px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    line-height: 1.2;
    text-align: center;      /* Ensure text inside the button is centered */

    /* --- Behavior --- */
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* 3. Add a subtle hover effect */
body.woocommerce-checkout #payment #place_order:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* Hide intl-tel-input elements on WooCommerce checkout when flags are removed */
body.woocommerce-checkout.woocommerce-page .clm-checkout-wrapper .clm-plain-phone-input {
    /* Ensure the input itself is visible, but override its padding from .iti */
    padding-left: 12px !important; /* Reset padding-left from intl-tel-input */
    padding-right: 12px !important; /* Reset padding-right from intl-tel-input */
}

body.woocommerce-checkout.woocommerce-page .clm-checkout-wrapper .iti.iti--allow-dropdown {
    border: none !important; /* Remove the iti wrapper border */
    height: auto !important; /* Ensure height adjusts */
}

body.woocommerce-checkout.woocommerce-page .clm-checkout-wrapper .iti__flag-container,
body.woocommerce-checkout.woocommerce-page .clm-checkout-wrapper .iti__country-list {
    display: none !important; /* Hide the flag and dropdown */
}

/* Adjust the border radius if capsule fields are enabled AND flags are removed */
body.woocommerce-checkout.woocommerce-page .clm-checkout-wrapper .clm-plain-phone-input.clm-plain-phone-input[type="text"][class*="capsule-fields"] {
    border-radius: 999px !important;
    padding-left: 20px !important;
    padding-right: 20px !important;
}

.woocommerce-message {
    border-top-color: #8fae1b;
    display: none;
}

.form-table th {
    width:none !important;
}

