/* Universal box-sizing for easier responsive design */
*, *::before, *::after {
    box-sizing: border-box;
}

/* Styles for the Trouve Ma Pièce Popup */

.trouvemapiece-popup-overlay {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 10000; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.7); /* Black w/ opacity */
    justify-content: center;
    align-items: center;
}

/* Styles for when the form is displayed inline */
.trouvemapiece-popup-overlay.is-inline-display {
    display: flex; /* Make it visible */
    position: relative; /* Change to relative positioning for inline flow */
    z-index: auto; /* Reset z-index */
    width: auto; /* Adjust width for inline content */
    height: auto; /* Adjust height for inline content */
    background-color: transparent; /* No overlay background */
    overflow: visible; /* Allow content to overflow if needed */
    justify-content: flex-start; /* Adjust alignment for inline display */
    align-items: flex-start; /* Adjust alignment for inline display */
}

.trouvemapiece-popup-overlay.is-inline-display .trouvemapiece-popup-content {
    margin: 0 auto; /* Center content horizontally within its container */
    width: 100%; /* Take full width of its container */
    max-width: 100%; /* Allow content to expand */
    padding: 20px 0px; /* Adjust padding as needed for inline display */
    animation: none; /* Remove animation for inline display */
    box-shadow: none; /* Remove box shadow for inline display */
    background-color: transparent; /* Remove background color */
    border: none; /* Remove border */
}

.trouvemapiece-popup-content {
    background-color: #102239;
    border: 1px solid #ffffff1a;
    color: #eee;
    margin: auto;
    padding: 20px;
    width: 100%;
    max-width: 700px;
    position: relative;
    border-radius: 8px;
    box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19);
    animation-name: animatetop;
    animation-duration: 0.4s;
    padding-top: 20px;
    padding-bottom: 50px;
}

.search-input{
    font-size: 15px !important;
}

/* Add Animation */
@-keyframes animatetop {
    from {top: -300px; opacity: 0}
    to {top: 0; opacity: 1}
}

.trouvemapiece-close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    background: none;
    border: none;
    cursor: pointer;
    position: fixed;
    right: 15px;
    top: 10px;
}

.trouvemapiece-close-button:hover,
.trouvemapiece-close-button:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
    background: #f49c3b;
}

/* Basic form styling (optional, can be overridden by theme) */
.trouvemapiece-form-container label {
    display: block;
 
    font-weight: bold;
    color: #eee; /* Light text for labels */
}

.trouvemapiece-form-container input[type="text"],
.trouvemapiece-form-container input[type="email"],
.trouvemapiece-form-container input[type="tel"], /* Added for phone input */
.trouvemapiece-form-container select {
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
    border: 1px solid #555; /* Darker border for inputs */
    border-radius: 4px;
    box-sizing: border-box; /* Ensures padding doesn't increase width */
    background-color: #16212e; /* Dark input background */
    color: #eee; /* Light text inside inputs */
    font-size: 15px;
}

.trouvemapiece-form-container input[type="submit"],
.trouvemapiece-form-container button {
    background-color: #f49c3b; /* WordPress primary blue */
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    margin-top: 10px;
}

.trouvemapiece-form-container input[type="submit"]:hover,
.trouvemapiece-form-container button:hover {
    background-color: #f49c3b; /* Darker shade on hover */
}

/* Placeholder text color */
.trouvemapiece-form-container input::placeholder,
.trouvemapiece-form-container select::placeholder {
    color: #aaa;
    opacity: 1; /* Ensure placeholder is visible */
}

/* Styles for the 'Vos pièces' repeater item */
.tm-piece-item {
    display: flex;
    flex-direction: column; /* Stack children vertically */
    align-items: flex-start; /* Align items to the start */
    margin-bottom: 20px; /* Increased margin for better separation */
    padding: 5px; /* Added padding for the item */
    border: 1px solid #444; /* Darker border */
    border-radius: 5px; /* Rounded corners */
 
}

/* Make select take full width within the stacked item */
.tm-piece-item select {
    width: 100%; /* Ensure select takes full width */
    margin-right: 0; /* Remove right margin as it's no longer side-by-side */
    margin-bottom: 10px; /* Add margin below select */
}

/* Style for photo upload input within the item */
.tm-piece-item p { /* Targeting the paragraph containing the file input */
    width: 100%; /* Ensure paragraph takes full width */
    margin-bottom: 10px; /* Add margin below */
}

.tm-piece-item input[type="file"] {
    width: 100%; /* Ensure file input takes full width */
    box-sizing: border-box;
    padding: 8px;
    border: 1px solid #555; /* Darker border */
    border-radius: 4px;
    background-color: #16212e; /* Dark input background */
}

/* Adjustments for localisation buttons group */
.tm-localisation-buttons {
    width: 100%; /* Ensure the whole group takes full width */
   
    margin-bottom: 0; /* Remove extra bottom margin */
    display: flex; /* Use flexbox */
    flex-wrap: wrap; /* Allow items to wrap */
    gap: 10px; /* Space between items */
    align-items: center; /* Align items vertically */
}

.tm-localisation-buttons > label:first-child { /* Target the "Localisation:" label */
    flex-basis: 100%; /* Make it take full width so choices start on a new line */
    margin-bottom: 5px; /* Add space below the main label */
}

/* Styles for Localisation Checkboxes (as clickable buttons) */
.tm-localisation-buttons label {
    font-weight: normal; /* Override default bold label */
}

.tm-localisation-buttons input[type="checkbox"]{
   /* Removed float: left */
    /* Hide the default checkbox */
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.tm-localisation-label {
    display: inline-block;
    padding: 8px 15px;
    /* margin-right: 5px; Removed, replaced by gap on parent */
    border: 1px solid #555; /* Darker border */
    border-radius: 4px;
    cursor: pointer;
    background-color: #3a3a3a; /* Darker background */
    transition: background-color 0.2s, border-color 0.2s;
    color: #eee; /* Light text */
    /* white-space: nowrap; Prevent text wrapping inside the label - Removed for better responsiveness */
}

.tm-localisation-label:hover {
    background-color: #4a4a4a; /* Slightly lighter on hover */
    border-color: #666;
}

/* Style for checked checkbox */
.tm-localisation-buttons input[type="checkbox"]:checked + .tm-localisation-label {
    background-color: #f49c3b; /* Orange color when selected */
    color: white;
    border-color: #f49c3b;
}

/* Styling for the 'Add piece' button */
#tm_add_piece {
    width: 100%; /* Make it full width */
    background-color: #3D73D6;
    color: white;
    font-size: 12px;
}
#tm_add_piece:hover {
    background-color: #005177; /* Darker shade on hover */
}

.tm-radio-option,
.tm-checkbox-option {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.tm-radio-option input,
.tm-checkbox-option input {
    margin: 0;
}
.tm-radio-option label,
.tm-checkbox-option label {
    margin: 0;
    cursor: pointer;
}

.tm-checkbox-option a{
 color: #c2ddff !important;
}
/* Tabbed Payment UI */
.tm-payment-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
    border-bottom: 1px solid #555;
    padding-bottom: 5px;
}

.tm-tab-btn {
    background: #3a3a3a !important;
    color: #eee !important;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    border-radius: 4px 4px 0 0;
    font-size: 13px !important;
    font-weight: 700 !important;
}

.tm-tab-btn.active {
    background: #f49c3b !important;
    color: white !important;
}

.tm-payment-content {
    display: none;
    padding: 15px;
    border: 1px solid #555;
    border-radius: 0 0 4px 4px;
    background-color: #16212e;
}

.tm-payment-content.active {
    display: block;
}

/* --- FORM LAYOUT AND RESPONSIVENESS STYLES (from previous turn) --- */

/* Container for form rows */
.tm-form-row {
    display: flex; /* Use flexbox for side-by-side layout */
    flex-wrap: wrap; /* Allow items to wrap on smaller screens */
    gap: 15px; /* Adds space between columns */
    margin-bottom: 15px; /* Add some space below each row */
    align-items: flex-start; /* Align items to the top if they have different heights */
}

/* Styles for columns within a row */
/* Calculated widths to account for flex gap */
.tm-form-col-50 { width: calc(50% - 7.5px); }
.tm-form-col-25 { width: calc(25% - 7.5px); }
.tm-form-col-35 { width: calc(35% - 7.5px); }
.tm-form-col-65 { width: calc(65% - 7.5px); }
.tm-form-col-75 { width: calc(75% - 7.5px); }
.tm-form-col-100 { width: 100%; }

/* Ensure inputs/selects take full width of their container span */
.tm-form-row .tm-form-col-50 input,
.tm-form-row .tm-form-col-50 select,
.tm-form-row .tm-form-col-25 input,
.tm-form-row .tm-form-col-25 select,
.tm-form-row .tm-form-col-35 input,
.tm-form-row .tm-form-col-35 select,
.tm-form-row .tm-form-col-65 input,
.tm-form-row .tm-form-col-65 select,
.tm-form-row .tm-form-col-75 input,
.tm-form-row .tm-form-col-75 select,
.tm-form-row .tm-form-col-100 input,
.tm-form-row .tm-form-col-100 select {
    width: 100%; /* This is already set in the original CSS */
    box-sizing: border-box;
}

/* Adjustments for labels within columns if needed */
.tm-form-row .tm-form-col-50 label,
.tm-form-row .tm-form-col-25 label,
.tm-form-row .tm-form-col-35 label,
.tm-form-row .tm-form-col-65 label,
.tm-form-row .tm-form-col-75 label,
.tm-form-row .tm-form-col-100 label {
    display: block; /* Ensure labels are block elements */
    margin-bottom: 5px;
}

/* Additional styling for the photo upload to ensure it respects the 100% column */
.tm-form-row .tm-form-col-100 input[type="file"] {
    display: block; /* Ensures it takes full width available in the column */
    width: 100%;
    box-sizing: border-box;
    padding: 8px; /* Match other inputs */
    border: 1px solid #555; /* Darker border */
    border-radius: 4px;
    background-color: #16212e; /* Dark input background */
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .tm-form-row {
        flex-direction: column; /* Stack items vertically on smaller screens */
        gap: 0; /* Remove gap when stacked */
    }
    .tm-form-col-50,
    .tm-form-col-25,
    .tm-form-col-35,
    .tm-form-col-65,
    .tm-form-col-75,
    .tm-form-col-100 {
        width: 100%; /* Full width when stacked */
    }
    /* Ensure inputs/selects take full width when stacked */
    .tm-form-row .tm-form-col-50 input,
    .tm-form-row .tm-form-col-25 input,
    .tm-form-row .tm-form-col-35 input,
    .tm-form-row .tm-form-col-65 input,
    .tm-form-row .tm-form-col-75 input,
    .tm-form-row .tm-form-col-100 input,
    .tm-form-row .tm-form-col-50 select,
    .tm-form-row .tm-form-col-25 select,
    .tm-form-row .tm-form-col-35 select,
    .tm-form-row .tm-form-col-65 select,
    .tm-form-row .tm-form-col-75 select,
    .tm-form-row .tm-form-col-100 select,
    .tm-form-row .tm-form-col-100 input[type="file"], /* Existing rule */
    .carte_grise-rangee input[type="file"] { /* New rule to target specifically */
        width: 100%;
        max-width: 100%; /* Ensure it does not exceed 100% */
        box-sizing: border-box; /* Crucial for width calculation */
    }
    .carte_grise-rangee { /* New rule for responsiveness of this specific row */
        flex-direction: column;
        align-items: flex-start; /* Align label to the start */
    }
     /* Adjustments for the piece item layout */
    .tm-piece-item {
        flex-direction: column;
        gap: 10px;
    }
    .tm-piece-item select {
        margin-right: 0;
        width: 100%; /* Ensure select takes full width */
    }
    .tm-piece-item .tm_remove_piece {
        width: 100%; /* Make remove button full width */
    }
    /* Responsive adjustments for payment tabs */
    .tm-payment-tabs {
        flex-direction: column;
    }
    .tm-tab-btn {
        width: 100%;
        margin-bottom: 10px; /* Add some spacing between stacked tabs */
    }
    /* Responsive adjustment for Stripe Payment Element */
    #stripe-payment-element {
        width: 100%;
        max-width: 100%;
    }
}
/* --- END NEW STYLES --- */

/* Specific styles for the attestation modification and CGV checkboxes and labels */
#tm_attestation_modification,
#tm_cgv_acceptance {
    display: inline-block; /* Ensures it's treated as an inline element */
    vertical-align: middle; /* Aligns it nicely with text */
    margin-right: 8px; /* Space between checkbox and label */
    margin-bottom: 0; /* Remove default bottom margin if any */
}

label[for="tm_attestation_modification"],
label[for="tm_cgv_acceptance"] {
    display: inline-block; /* Allows it to sit next to the checkbox */
    font-weight: normal; /* Override the general label bold style for this specific case */
    margin-bottom: 0; /* Remove default bottom margin */
    vertical-align: middle; /* Aligns it nicely with the checkbox */
    color: #eee; /* Ensure label text is light */
}

/* Ensure the paragraph containing the checkbox/label doesn't add extra spacing if it's the last item in a fieldset */
fieldset p:last-of-type {
    margin-bottom: 0;
}

.carte_grise-rangee{
        display: flex;
    flex-direction: row;
    align-items: center;
}
#stripe-payment-element{
background: white;
}

fieldset{
    margin-top: 10px;
}

#tm_total_price_display{
    font-weight: 300; margin-top: 15px; font-size: 20px;
}
/* Styles for the product search suggestions box within the form */
.tm-piece-item {
    position: relative; /* Ensure position:relative for absolute positioning of suggestions */
}

.suggestions-box-form {
    background: #fff;
    border-radius: 5px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    z-index: 9999; /* Higher z-index to appear above other elements */
    max-height: 250px; /* Limit height and add scroll */
    overflow-y: auto;
    display: none; /* Hidden by default, shown by JS */
    border: 1px solid #ddd; /* A subtle border */
}

.suggestions-box-form .suggestion-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
    text-align: left;
    color: #333; /* Darker text for readability on light background */
}

.suggestions-box-form .suggestion-item:last-child {
    border-bottom: none; /* No border for the last item */
}

.suggestions-box-form .suggestion-item:hover {
    background: #f5f5f5; /* Light background on hover */
}

.suggestions-box-form .suggestion-item img {
    width: 30px; /* Smaller image size */
    height: 30px;
    object-fit: cover;
    border-radius: 3px;
    margin-right: 10px;
    pointer-events: none; /* Prevent image from interfering with click event */
}

.suggestions-box-form .suggestion-name {
    color: #333;
    font-weight: 500;
    font-size: 14px;
    pointer-events: none;
}
/* Styles for the custom file upload components */
.custom-file-upload {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.custom-file-upload input[type="file"] {
    display: none; /* Hide the actual file input */
}

.custom-file-upload .upload-button {
    background-color: #3D73D6;
    color: white;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: background-color 0.2s;
}

.custom-file-upload .upload-button:hover {
    background-color: #e08b2d; /* Darker orange on hover */
}

/* Styles for the tm-submit-button */
.tm-submit-button {
    background-color: #28a745 !important; /* Green color */
    color: white !important;
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    margin-top: 10px;
    transition: background-color 0.3s ease;
    border: 0px !important;
}

.tm-submit-button:hover {
    background-color: #218838 !important; /* Darker green on hover */
}

.custom-file-upload .upload-button .dashicons {
    font-size: 20px; /* Adjust Dashicon size */
    width: 20px;
    height: 20px;
}