/* Container for the entire form snippet */
.form-container {
    font-family: Arial, sans-serif;
    padding: 20px;
    max-width: 800px;
    margin: 0 auto;
    box-sizing: border-box;
}

/* Styling for each row of form elements */
.form-row {
    margin-bottom: 15px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

/* Wrapper for each form field (input/select + label) */
.form-field-wrapper {
    position: relative;
    flex-grow: 1;
    min-width: 150px;
    display: flex;
    flex-direction: column;
}

/* Style for all text inputs, number inputs, email inputs, and select boxes */
.form-input {
    width: 100%;
    padding: 14px 15px 8px 15px; /* Adjusted padding for taller box, more space at top */
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #f0f0f0;
    font-size: 16px;
    color: #333;
    box-sizing: border-box;
    min-height: 50px; /* Input boxes taller */
    transition: all 0.2s ease-out, border-color 0.2s ease-out, box-shadow 0.2s ease-out;
    outline: none;
    line-height: normal;
    flex-shrink: 0;
}

/* Specific adjustments for select elements - revert to default browser arrows */
.form-input:is(select) {
    appearance: menulist-button;
    -webkit-appearance: menulist-button;
    -moz-appearance: menulist-button;
    background-image: none;
    background-repeat: initial;
    background-position: initial;
    background-size: initial;
    padding-right: 15px;
    padding-top: 14px;
    padding-bottom: 8px;
}

/* Floating Labels - ALWAYS smaller, raised, and grey */
.form-label.floating-label {
    position: absolute;
    left: 15px;
    top: 5px; /* Label is always raised */
    transform: translateY(0); /* Ensure no vertical transform */
    color: #666; /* Label is always grey */
    font-size: 12px; /* Label is always smaller */
    pointer-events: none;
    transition: all 0.2s ease-out;
    background-color: transparent;
    padding: 0 2px;
    line-height: normal;
}

/* Styles for focus glow (no red borders for invalid inputs) */
.form-input:focus {
    border-color: #007bff;
    background-color: #eaf6ff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Responsive Two-Column Layout (default 50/50 split) */
.form-row-two-columns .form-field-wrapper {
    flex-basis: calc(50% - 7.5px);
    max-width: calc(50% - 7.5px);
}

/* Custom width for Origin and Age row (75/25 split) */
.form-row-origin-age .form-field-wrapper:nth-child(1) { /* Country of Origin */
    flex-basis: calc(75% - 3.75px); /* (100% - gap) * 0.75 */
    max-width: calc(75% - 3.75px);
}

.form-row-origin-age .form-field-wrapper:nth-child(2) { /* Age */
    flex-basis: calc(25% - 11.25px); /* (100% - gap) * 0.25 */
    max-width: calc(25% - 11.25px);
}


@media (max-width: 600px) {
    .form-row-two-columns .form-field-wrapper {
        flex-basis: 100%;
        max-width: 100%;
    }
    /* Ensure custom width row also stacks on small screens */
    .form-row-origin-age .form-field-wrapper:nth-child(1),
    .form-row-origin-age .form-field-wrapper:nth-child(2) {
        flex-basis: 100%;
        max-width: 100%;
    }
    .form-container {
        padding: 10px;
    }
}

/* Styling for the checkbox row */
.form-row-checkbox {
    align-items: center;
}

.form-checkbox {
    width: auto;
    height: auto;
    margin-right: 10px;
    flex-shrink: 0;
}

/* Specific styling for the email input - no icon */
.form-row-email .form-field-wrapper {
    position: relative;
}

.email-input-with-icon {
    padding-right: 15px;
}

/* Specific styling for the "Country of Residence" - no flag */
.country-residence-input-with-flag {
    background-image: none;
    background-repeat: initial;
    background-position: initial;
    background-size: initial;
    padding-left: 15px;
}

/* Submit button */
.form-submit-button {
    background-color: #007bff;
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 18px;
    width: auto;
    margin-top: 10px;
    align-self: flex-start;
    transition: background-color 0.3s ease;
}

.form-submit-button:hover {
    background-color: #0056b3;
}

.form-submit-button:focus {
    background-color: #0056b3;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

textarea#comment {
    field-sizing: content;
    padding-top: 20px;
    font-family: var(--md-text-font-family);
    font-feature-settings: "kern","liga";
}

input[type="checkbox"]#show_name {
    width: 20px;
    vertical-align: text-top;
}

input[type="checkbox"]#show_name:focus {
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

input[type="submit"]:disabled {
    background-color: #333;
}
