*, *::before, *::after {
    box-sizing: border-box;
}

:root {
    --primary-color: #003D4D;
    --background-color: #f4f7f9;
    --form-background: #ffffff;
    --text-color: #212529;
    --border-color: #dee2e6;
    --focus-outline-color: #007bff;
    --error-bg-color: #f8d7da;
    --error-border-color: #721c24;
    --error-text-color: #721c24;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--background-color);
    margin: 0;
    padding: 20px;
    color: var(--text-color);
    line-height: 1.6;
}

/* Add this new utility class near the top of your stylesheet */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* NEW: Utility class to hide elements completely (visually and from screen readers) */
.hidden {
    display: none;
}

.container {
    max-width: 800px;
    margin: 20px auto;
    background-color: var(--form-background);
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
}

.header {
    background-color: var(--primary-color);
    color: white;
    padding: 50px 30px;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.header h1 {
    margin: 0;
    font-size: 28px;
}

.header p {
    margin: 10px 0 0;
    font-size: 15px;
}

main {
    padding: 30px;
}

fieldset {
    border: none;
    padding: 0;
    margin: 0 0 30px 0;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 25px;
}

fieldset:last-of-type {
    border-bottom: none;
    padding-bottom: 0;
}

legend {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 15px;
    padding: 0;
    width: 100%;
}

.option {
    margin-bottom: 12px;
    display: flex;
    align-items: center;
}

label {
    cursor: pointer;
    margin-left: 10px;
}

select,
input[type="text"],
input[type="email"],
input[type="tel"] {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 16px;
    font-family: inherit;
    background-color: white;
}

.footer-note {
    margin-top: 20px;
    font-style: italic;
    color: #666;
    font-size: 14px;
}

#submitBtn {
    display: block;
    width: 100%;
    padding: 12px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}

#submitBtn:hover {
    background-color: #002933;
}

#submitBtn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

input[type="text"]:focus-visible,
input[type="email"]:focus-visible,
input[type="tel"]:focus-visible,
select:focus-visible,
input[type="radio"]:focus-visible,
input[type="checkbox"]:focus-visible,
button:focus-visible, /* A more generic rule for all buttons */
#submitBtn:focus-visible {
    outline: 3px solid var(--focus-outline-color);
    outline-offset: 2px;
    box-shadow: 0 0 0 3px var(--form-background), 0 0 0 6px var(--focus-outline-color);
}

#formMessage {
    margin: 20px 0;
    padding: 15px;
    border-radius: 4px;
    font-weight: bold;
    text-align: center;
    border-width: 1px;
    border-style: solid;
    display: none;
}

.success {
    background-color: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

.error {
    background-color: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

.error-message {
    color: var(--error-text-color);
    font-weight: bold;
    font-size: 0.9em;
    margin-top: 5px;
    display: block;
}

fieldset.has-error .question-body,
.form-group.has-error {
    background-color: var(--error-bg-color);
    border: 1px solid var(--error-border-color);
    border-left: 5px solid var(--error-border-color);
    padding: 20px;
    border-radius: 4px;
    margin-top: 8px;
}

.form-group-wrapper.has-error {
    background-color: var(--error-bg-color);
    border: 1px solid var(--error-border-color);
    border-left: 5px solid var(--error-border-color);
    padding: 20px;
    border-radius: 4px;
    margin-bottom: 20px; /* Add spacing below the error box */
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}


select.is-invalid {
    border: 2px solid var(--error-border-color);
}

select.placeholder-shown {
  color: #6c757d;
}

select:required:invalid {
  color: #6c757d;
}

select option {
  color: var(--text-color);
}

select:required:valid {
  color: var(--text-color);
}

.instructions ul {
    margin-top: 0;
}

/* =================================================== */
/* === STYLES FOR PAPER-BASED REQUEST FORM         === */
/* =================================================== */

/* Widen the main container for this form's layout */
.wide-container {
    max-width: 960px;
}

.form-header-block {
    text-align: center;
    padding: 20px 30px;
    border-bottom: 1px solid var(--border-color);
}
.logo-large {
    max-width: 350px;
    height: auto; 
    display: block;
    margin: 0 auto 20px;
}
.logo-small {
    max-width: 350px;
    height: auto;
    display: block;
    margin-top: 20px;
}
.form-header-block h2 {
    margin: 0 0 5px 0;
}
.form-header-block .subtitle {
    font-style: bold;
    color: #666;
    margin-bottom: 20px;
}
.form-header-block p {
    max-width: 800px;
    margin: 10px auto;
    line-height: 1.6;
}

/* Blue section headers using the correct color */
h2.form-section-header {
    background-color: #225896; /* CORRECTED COLOR */
    color: white;
    padding: 10px 20px;
    margin: 30px -30px 0 -30px;
    font-size: 18px;
}
.form-section {
    padding-top: 20px;
}

/* Two-column layout for standard fields */
.form-row {
    display: flex;
    gap: 30px;
    margin-bottom: 20px;
}
.form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
}
.form-group.full-width {
    flex-basis: 100%;
}
.form-group label {
    margin-bottom: 8px;
    font-weight: 600;
    margin-left: 0;
}

.form-group label sup,
.form-group label::after {
    color: #d9534f; /* A standard, accessible red color */
    content: " *";
    font-size: 1em;
}

/* Style for the "Order Window Closed" message */
.closed-window-message {
    text-align: center;
    padding: 40px 20px;
}

.closed-window-message p {
    color: #a94442; /* A standard, accessible error red */
    font-size: 24px;
    font-weight: bold;
}

/* ================================================= */
/* === STYLES FOR DROPDOWNS WITH CODES           === */
/* ================================================= */

.input-with-code {
    display: flex;
    align-items: center;
    gap: 15px;
}

.input-with-code select {
    flex-grow: 1;
}

.code-display-wrapper {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}

.code-display {
    display: inline-block;
    min-width: 50px; /* Give it some space */
    font-weight: 600;
    color: #333;
}

/* Style for disabled dropdowns */
select:disabled {
    background-color: #e9ecef;
    cursor: not-allowed;
}

/* ================================================= */
/* === STYLES FOR HORIZONTAL RADIO/CHECKBOX GROUPS === */
/* ================================================= */

/* Main container for the question */
.radio-group-multi-line > label {
    display: block;
    width: 100%;
}

/* This is the flex container that allows wrapping */
.radio-options-wrapper {
    display: flex;
    flex-wrap: wrap; /* Allows items to wrap to the next line */
    gap: 10px 30px;  /* Vertical and horizontal spacing between items */
    margin-top: 8px;
}

/* This is the "atomic" unit that will never break */
.radio-option-item {
    display: inline-flex; /* Aligns the radio button and text */
    align-items: center;
    white-space: nowrap; /* THE KEY: Prevents the text inside from wrapping */
}

/* Standard styling for the input and label within the item */
.radio-option-item input[type="radio"],
.radio-option-item input[type="checkbox"] {
    margin-right: 8px;
    flex-shrink: 0; /* Prevents the radio button from shrinking */
}

.radio-option-item label {
    font-weight: normal;
    margin-bottom: 0; /* Override default label margin */
}

/* CORRECTED LAYOUT FOR "OTHER INFORMATION" SECTION */
/* ================================================= */
/* === LAYOUT FOR "OTHER INFORMATION" SECTION    === */
/* ================================================= */

.other-info-grid {
    display: grid;
    grid-template-columns: 1fr auto; /* Column 1 (question) takes up space, Column 2 (toggle) fits content */
    align-items: center;
    row-gap: 15px; /* Space between each question row */
    column-gap: 30px; /* Space between question and toggle */
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
    margin-bottom: 20px;
}

.toggle-question {
    margin: 0;
    padding: 0;
}

.toggle-switch {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    gap: 10px;
}
.toggle-switch input[type="radio"] {
    /* This is now handled by the .visually-hidden class */
}
.toggle-switch label {
    padding: 8px 20px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    font-weight: 600;
}
.toggle-switch input[type="radio"]:checked + label {
    background-color: #225896;
    color: white;
    border-color: #225896;
}

/* ================================================= */
/* === SPECIAL LAYOUT FOR "OTHER REASON" FIELD   === */
/* ================================================= */

/* Make the entire "Other Reason" item expand to fill the available width */
.radio-option-item.can-grow {
    flex-grow: 1;
    /* We keep the default white-space: nowrap from the parent .radio-option-item rule */
}

/* This is the key change: make the text input itself the flexible item */
.radio-option-item.can-grow .conditional-field {
    display: none; /* Still hidden by default */
    margin-left: 15px;
    flex-grow: 1; /* This tells the text box to expand and fill the remaining space */
    width: auto; /* Let flexbox control the width */
}

/* =================================== */
/* === CONTACT INFORMATION SECTION === */
/* =================================== */

.contact-section {
    display: flex;
    gap: 40px;
    align-items: flex-center; /* KEY CHANGE: Aligns items to the bottom */
    background-color: #ffffff;
    padding: 20px 0;
    margin: 20px 0 0 0;
}

.contact-column {
    display: flex;
    flex-direction: column;
}

.logo-column {
    flex: 1;
    align-self: center;
}

.info-column {
    flex: 2;
}

.logo-contact {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Style for the name */
.info-column h4 {
    margin: 20px 0 5px 0;
    font-size: 22px; /* NEW: Increased font size for the name */
    font-weight: 600; /* Bolder than normal text */
}

/* General style for paragraphs in the info column */
.info-column p {
    margin: 5px 0;
    line-height: 1.6;
}

/* Specific style for the job title */
.info-column .job-title {
    color: #6c757d; /* NEW: Muted gray color for the job title */
}

/* Specific style for email and phone */
.info-column .contact-link {
    color: #225896; /* NEW: The specific blue color for contact info */
    font-weight: 600;
}

.info-column i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

/* Overriding the default full-width submit button for this form */
.contact-section #submitBtn {
    width: auto;
    padding: 10px 30px;
    margin-top: 20px;
    background-color: var(--primary-color);
    font-size: 16px;
    border-radius: 5px;
}

.contact-section #submitBtn:hover {
    background-color: #002933;
}

/* Style for the highlighted 18pt font size text in the header */
.font-18pt {
    font-size: 18pt; /* Use 'pt' (points) as it matches the text content */
    font-weight: 800; /* Make it slightly bolder */
    color: #000; /* Ensure it's fully black */
}

/* --- NEW ACCESSIBILITY FIXES FOR WAVE SCAN --- */

/* Ensure the main heading (now h1) has the same style as the old h2 */
.form-header-block h1 {
    margin: 0 0 5px 0;
    font-size: 1.5em; /* Standard h2 size */
}

/* Reset default fieldset styling for our custom layouts */
fieldset.radio-group-multi-line,
fieldset.question-pair {
    border: none;
    padding: 0;
    margin: 0;
}

/* Style the new <legend> for the main radio groups to look like the old <label> */
fieldset.radio-group-multi-line legend {
    font-weight: 600;
    margin-bottom: 8px;
    padding: 0;
    width: 100%;
}

/* Style the new <legend> for the toggle questions to look like the old <p> */
fieldset.question-pair legend.toggle-question {
    padding: 0;
    margin: 0;
    padding-right: 20px;
    font-weight: normal;
    width: auto; /* Allows the legend to size to its content */
    float: left; /* Fixes a common layout bug with legends in flex containers */
}

/* Add a clearfix to the fieldset to contain the floated legend */
fieldset.question-pair:after {
    content: "";
    display: table;
    clear: both;
}

/* =================================================== */
/* === STYLES FOR THE INDEX/LANDING PAGE           === */
/* =================================================== */

.form-list {
    list-style: none;
    padding: 0;
    margin-top: 20px;
}

.form-list li {
    margin-bottom: 15px;
}

.form-list a {
    display: block;
    padding: 18px 25px;
    background-color: #f8f9fa;
    border: 1px solid var(--border-color);
    border-left: 5px solid var(--primary-color); /* Uses your theme color */
    border-radius: 5px;
    text-decoration: none;
    color: var(--text-color);
    font-weight: 600;
    font-size: 16px;
    transition: background-color 0.2s, transform 0.2s;
}

.form-list a:hover {
    background-color: #e9ecef;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
}

/* Style for the "Submit Another Response" button */
.success-button {
    padding: 10px 30px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}

.success-button:hover {
    background-color: #002933;
}

/* Hide the success panel by default */
#successPanel {
    display: none;
    text-align: center;
}

#successMessage {
    margin-bottom: 20px;
    padding: 15px;
    border-radius: 4px;
    font-weight: bold;
}