/* --- Simple Search CAPTCHA Plugin Styling (Refined Professional Inline Look) --- */

/* Basic reset/sizing for consistency within the search form */
.search-form * {
    box-sizing: border-box;
    /* Ensure no default margins or padding interfere */
    margin: 0;
    padding: 0;
}

.search-form {
    display: flex; /* Make the form a flex container */
    align-items: center; /* Vertically align all items in the center */
    justify-content: center; /* Center the entire search bar horizontally */
    flex-wrap: nowrap; /* Prevent wrapping by default for the inline look */
    max-width: 600px; /* Adjust max-width as needed for your layout */
    margin: 20px auto; /* Center the form and add some vertical margin */
    border: 1px solid #ddd; /* A subtle border around the entire search group */
    border-radius: 5px; /* Rounded corners for the entire group */
    overflow: hidden; /* Ensures borders/radii are respected for contained elements */
    background-color: #fff; /* Ensure a consistent white background */
    height: 45px; /* Define a consistent height for the entire search bar group */
    position: relative; /* For potential positioning of pseudo-elements or tooltips */
}

/* Style the search field's container/label (if your theme wraps the input in a label) */
.search-form label:first-of-type {
    flex-grow: 1; /* Allow the search field to take up most available space */
    height: 100%; /* Make label fill height to ensure input alignment */
    display: flex; /* Make label a flex container to align inner elements */
    align-items: center; /* Vertically align screen-reader-text and input */
}

/* Style the search input field */
.search-form .search-field {
    width: 100%; /* Take full width of its flex-grow container */
    height: 100%; /* Fill the height of the form */
    padding: 10px 15px;
    border: none; /* Remove individual border as the form has one */
    outline: none; /* Remove outline on focus */
    font-size: 16px;
    background-color: transparent; /* Inherit form background */
}

/* Style the CAPTCHA container */
.search-form .search-captcha {
    display: flex; /* Make CAPTCHA elements flex items */
    align-items: center; /* Vertically align CAPTCHA label and input */
    flex-shrink: 0; /* Prevent CAPTCHA from shrinking */
    padding: 0 10px; /* Padding for spacing around CAPTCHA content */
    font-size: 0.9em; /* Slightly smaller font for compactness */
    color: #555;
    white-space: nowrap; /* Keep CAPTCHA text on one line */
    border-left: 1px solid #eee; /* Subtle separator line */
    height: 100%; /* Make CAPTCHA area fill the height of the form */
}

.search-form .search-captcha label {
    margin-right: 8px; /* Space between label and input */
    line-height: 1; /* Ensure text is vertically aligned with input */
}

.search-form .search-captcha-field {
    width: 45px; /* Slightly reduce width for compactness */
    height: 30px; /* Define a fixed height for the input for better alignment */
    padding: 5px; /* Adjusted padding */
    border: 1px solid #ccc; /* Maintain a subtle border for the input itself */
    border-radius: 3px;
    font-size: 1em;
    text-align: center;
    outline: none;
}

/* Style the search button */
.search-form .search-submit {
    padding: 10px 15px; /* Consistent padding */
    background-color: #0073aa; /* WordPress blue, adjust to your theme's color */
    color: #fff;
    border: none; /* Remove border */
    border-radius: 0 5px 5px 0; /* Only right corners rounded, matches form border */
    cursor: pointer;
    font-size: 16px;
    white-space: nowrap; /* Prevent button text from wrapping */
    transition: background-color 0.3s ease;
    flex-shrink: 0; /* Prevent button from shrinking */
    margin-left: -1px; /* Overlap with the CAPTCHA separator line to appear seamless */
    height: 100%; /* Make button fill height of parent flex container */
    display: flex; /* Use flex to center text vertically */
    align-items: center;
    justify-content: center;
}

.search-form .search-submit:hover {
    background-color: #005177; /* Darker shade on hover */
}

/* Hide screen reader text if it causes layout issues and you prefer not to display it visually */
.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Responsive Adjustments for smaller screens */
@media (max-width: 768px) {
    .search-form {
        flex-wrap: wrap; /* Allow wrapping on smaller screens */
        border: none; /* Remove the combined border for stacked layout */
        border-radius: 0; /* Remove border radius for stacked layout */
        height: auto; /* Allow height to adjust */
        flex-direction: column; /* Stack items vertically */
        padding: 0 15px; /* Add horizontal padding to the form itself */
        background-color: transparent; /* Remove background, elements will have their own */
    }

    .search-form label:first-of-type {
        width: 100%; /* Search field takes full width */
        margin-bottom: 10px; /* Space below search field */
        height: auto; /* Auto height for stacked layout */
    }

    .search-form .search-field {
        border: 1px solid #ddd; /* Add back border for individual field */
        border-radius: 5px; /* Add back border radius */
        height: 45px; /* Consistent height for stacked input */
        padding: 10px 15px; /* Ensure padding */
        background-color: #fff; /* Give search field its own background */
    }

    .search-form .search-captcha {
        width: 100%; /* CAPTCHA takes full width */
        padding: 10px 15px; /* Consistent padding */
        justify-content: center; /* Center CAPTCHA content */
        border: 1px solid #ddd; /* Add full border for CAPTCHA section */
        border-radius: 5px; /* Add border radius for CAPTCHA section */
        margin-bottom: 10px; /* Space below captcha */
        height: 45px; /* Consistent height for stacked CAPTCHA */
        border-left: none; /* Remove left border as it now has a full border */
        background-color: #fff; /* Give CAPTCHA its own background */
    }

    .search-form .search-captcha label {
        margin-right: 10px; /* Slightly more space */
    }

    .search-form .search-captcha-field {
        border: 1px solid #ccc; /* Ensure CAPTCHA input has its own border */
    }


    .search-form .search-submit {
        width: 100%; /* Make button full width */
        border-radius: 5px; /* Full border radius for button */
        margin-left: 0; /* Remove negative margin */
        height: 45px; /* Consistent height for stacked button */
        margin-bottom: 0; /* No margin below the last item */
    }
}