/* ========================================================================= */
/* --- Form Specific Variables (Ensure these are also defined in style.css if needed globally) --- */
/* ========================================================================= */
:root {
    --form-bg: #fff;
    --form-border: #b5f4ff;
    --form-focus: #0077b6; /* Primary color (Deep Blue) */
    --form-header-color: #002d62; /* Darker Blue for titles */
    --form-text-color: #444;
    --form-label-color: #333;
    /* Assume --light-bg, --accent-color, --heading-font, --body-font are in global style.css */
}

/* ========================================================================= */
/* --- Form Container & Intro Styles --- */
/* ========================================================================= */
.registration-form-section {
    padding: 60px 0 100px 0; /* Increased padding for better separation */
    background-color: var(--light-bg);
}

.form-container {
    padding: 20px;
}

.form-intro {
    text-align: center;
    margin-bottom: 40px;
}

.form-intro h1 {
    font-size: 2.5rem; /* Slightly larger title */
    color: var(--form-header-color);
    margin-bottom: 5px;
    font-family: var(--heading-font);
}

.form-intro h2 {
    font-size: 1.6rem;
    color: #555;
    font-family: var(--body-font);
    font-weight: 600;
}

.registration-form {
    background: var(--form-bg);
    padding: 40px; /* Increased padding inside the form box */
    border-radius: 12px; /* Slightly more rounded corners */
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.12); /* More pronounced shadow */
}

/* ========================================================================= */
/* --- Fieldset and Legend --- */
/* ========================================================================= */
fieldset {
    border: 2px solid rgb(12, 107, 145);
    padding: 10px; /* Increased padding inside fieldset */
    margin-bottom: 30px; /* Increased margin between fieldsets */
    border-radius: 10px;
}

legend {
    font-family: var(--heading-font);
    font-size: 1.4rem; /* Slightly larger legend */
    color: var(--form-focus);
    padding: 0 15px; /* More padding around legend text */
    margin-left: 15px; /* Adjust based on padding */
}

h4 {
    font-size: 1.2rem;
    color: var(--form-label-color);
    margin-top: 20px;
    margin-bottom: 15px;
    border-bottom: 2px solid #f0f0f0; /* Slightly thicker separator */
    padding-bottom: 8px;
    font-weight: 700;
}

.small-note {
    font-size: 0.8rem; /* Slightly smaller for ancillary text */
    color: #777;
    margin-bottom: 15px;
}

.small-note-inline {
    display: flex; /* Use flex for better vertical alignment */
    align-items: center;
    margin-bottom: 20px;
}

.small-note-inline label {
    font-weight: 400; /* Normal weight for inline label */
    color: var(--form-text-color);
    margin: 0 0 0 8px;
    font-size: 1rem;
    cursor: pointer;
}

/* ========================================================================= */
/* --- Form Grid Layout (The core layout for alignment) --- */
/* ========================================================================= */
.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px; /* Standard space between columns */
    margin-bottom: 15px; /* Increased space between rows for better separation */
}

.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 0; /* Remove vertical margin here, controlled by .form-row */
    /* Ensure form groups take up space even if content is smaller */
    min-height: 70px; 
}

/* Width Classes for Columns (1200px and up) */
.form-row .half-width {
    flex-basis: calc(50% - 10px); 
}

.form-row .third-width {
    flex-basis: calc(33.333% - 13.333px);
}

.form-row .quarter-width {
    flex-basis: calc(25% - 15px); 
}

.form-row:last-child {
    margin-bottom: 0;
}


/* ========================================================================= */
/* --- Input Styling (Refined UX) --- */
/* ========================================================================= */
label {
    margin-bottom: 3px; /* Tighter spacing to input */
    font-weight: 500;
    font-size: 0.9rem; /* Slightly smaller, focused label */
    color: var(--form-label-color);
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="tel"],
select {
    padding: 8px 8px; /* Uniform padding */
    border: 1px solid rgb(60, 91, 105);
    border-radius: 6px; /* Slightly more rounded inputs */
    font-size: 1rem;
    color: var(--form-text-color);
    transition: all 0.2s ease-in-out;
    width: 100%;
    background-color: rgb(173, 218, 247);
    min-height: 30px; /* Ensure a comfortable click target */
}

/* Stronger, cleaner focus state */
input:focus, select:focus {
    border-color: var(--form-focus);
    box-shadow: 0 0 0 3px rgba(0, 119, 182, 0.3); /* Softer, wider glow */
    outline: none;
}

/* --- Radio Group Styling --- */
.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 7px 7px; /* Wider gap between options */
    margin-top: 0px;
    align-items: center;
    /* Adjust vertical alignment to match standard inputs */
    min-height: 40px; 
    padding-top: 0;
    border-radius: 5px;
    padding-left: 5px;
    background-color: rgb(173, 218, 247);
    border: 1px solid rgb(60, 91, 105);
}

.radio-group label {
    margin-bottom: 0;
    font-weight: 400;
    font-size: 1rem;
    color: var(--form-text-color);
}

/* ========================================================================= */
/* --- Submit Button & Status Messages --- */
/* ========================================================================= */
.submit-row {
    justify-content: center;
    margin-top: 40px; /* More separation above the button */
}

.next-button {
    /* Uses the shared button style for consistency */
    display: inline-block;
    background: rgb(6, 189, 192); 
    color: #fff;
    padding: 15px 50px; /* Wider button */
    border: none;
    border-radius: 50px;
    font-size: 1.2rem; /* Larger font */
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    transition: background-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.next-button:hover:not(:disabled) {
    background-color: #e64a19; 
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.next-button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* --- Form Status Messages (Moved out of the mobile media query) --- */
.form-message {
    padding: 15px;
    margin: 20px 0;
    border-radius: 5px;
    font-weight: 600;
    text-align: center;
    border: 1px solid transparent;
}

.form-message.loading {
    background-color: #e0f7fa; /* Light Blue */
    color: #0077b6;
    border-color: #b3e5fc;
}

.form-message.success {
    background-color: #e8f5e9; /* Light Green */
    color: #388e3c;
    border-color: #c8e6c9;
}

.form-message.error {
    background-color: #ffebee; /* Light Red */
    color: #d32f2f;
    border-color: #ffcdd2;
}

.hidden {
    display: none !important;
}

/* ========================================================================= */
/* --- Form Responsive Fixes (Crucial for Mobile Layout) --- */
/* ========================================================================= */
@media (max-width: 768px) {
    .registration-form-section {
        padding: 40px 0 60px 0;
    }
    
    .registration-form {
        padding: 20px;
    }

    /* Force all columns to full width on small screens */
    .form-row .half-width,
    .form-row .third-width,
    .form-row .quarter-width {
        flex-basis: 100%;
        margin-bottom: 0; /* Handled by form-row */
    }

    .form-row {
        gap: 0; /* Remove horizontal gap when stacking */
        margin-bottom: 10px; /* Reduced vertical space on mobile */
    }

    .form-group {
        margin-bottom: 15px; /* More vertical space between fields on mobile */
    }

    .form-intro h1 {
        font-size: 2rem;
    }
    
    .form-intro h2 {
        font-size: 1.3rem;
    }
    
    .next-button {
        font-size: 1rem;
        padding: 12px 30px;
    }
    /* --- Acknowledgment Slip Styles --- */

.acknowledgment-slip-section {
    padding: 60px 0;
    background-color: #f7f7f7;
    min-height: 80vh;
}

.ack-container {
    max-width: 800px;
    background: #fff;
    padding: 40px;
    border: 1px solid #ddd;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
}

.ack-header {
    text-align: center;
    margin-bottom: 30px;
}

.ack-logo {
    height: 80px;
    margin-bottom: 10px;
}

.ack-header h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
}

.ack-header h2 {
    font-size: 1.2rem;
    color: #555;
    margin-bottom: 0;
    text-align: center;
}

.ack-content p, .ack-content ol {
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 10px;
}

.summary-details p {
    margin-bottom: 5px;
}

.ack-actions {
    text-align: center;
    margin-top: 40px;
    display: flex;
    gap: 20px;
    justify-content: center;
}

.ack-ref, .ack-date {
    font-weight: 500;
    color: var(--form-header-color);
}

.ack-footer {
    text-align: center;
    font-size: 0.9rem;
    color: #888;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px dashed #ddd;
}

/* --- Print Media Query (CRITICAL for PDF/Print) --- */
@media print {
    /* Hide the navigation, header, and buttons when printing */
    header, 
    .registration-form-section, 
    .ack-actions, 
    .no-print {
        display: none !important;
    }
    
    /* Show only the acknowledgment slip content */
    #acknowledgment-section {
        display: block !important;
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        margin: 0;
        padding: 0;
    }
    
    .ack-container {
        box-shadow: none; /* Remove shadow for clean print */
        border: none;
        padding: 0;
        width: 100%;
        max-width: 100%;
    }
}
}