/* Import Google Font */
@import url('https://fonts.googleapis.com/css2?family=Nunito+Sans:wght@400;600;700&display=swap');

/* Base styles & Variables (Optional) */
:root {
    --primary-color: #007bff; /* Bootstrap Blue */
    --primary-color-darker: #0056b3;
    --light-grey: #f4f7f6;
    --border-color: #ced4da;
    --text-color: #333;
    --text-color-secondary: #555;
    --white: #ffffff;
    --autofill-bg: #fff3cd; /* Keeping the yellow for autofill */
    --autofill-text: #665c1e;
    --autofill-border: #ffeeba;
    --focus-shadow: rgba(0, 123, 255, 0.25);
}

body {
    font-family: 'Nunito Sans', sans-serif; /* Use imported font */
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--light-grey); /* Light grey background */
    margin: 0;
    padding: 30px 15px; /* Add padding around the body */
    min-height: 100vh;
    display: flex; /* Helps center form vertically if needed */
    flex-direction: column;
    align-items: center;
}

h1, h2 {
    text-align: center;
    color: var(--text-color);
}

h1 {
    margin-bottom: 15px;
    font-weight: 700;
}

h2 {
    margin-top: 30px; /* Space above subheadings */
    margin-bottom: 20px;
    font-weight: 600;
    font-size: 1.3em;
}

/* Style the form container */
form {
    background-color: var(--white);
    padding: 30px 40px; /* More padding inside the form */
    border-radius: 8px; /* Rounded corners */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08); /* Subtle shadow */
    max-width: 650px; /* Max width of the form container */
    width: 100%; /* Ensure it takes available width up to max-width */
    box-sizing: border-box;
}

/* --- Form Elements --- */

fieldset {
    border: none; 
    padding: 0;
    margin: 0 0 30px 0; /* Space below each fieldset */
}

legend {
    font-weight: 600;
    font-size: 1.1em;
    color: var(--text-color-secondary);
    margin-bottom: 15px; /* More space below legend */
    padding: 0;
    width: 100%;
    border-bottom: 1px solid #eee; /* Subtle separator line */
    padding-bottom: 8px;
}

.form-group {
    margin-bottom: 20px; /* Increase spacing between fields in a group */
}

label {
    display: block;
    margin-bottom: 8px; /* More space below label */
    font-weight: 600;
    font-size: 0.95em;
    color: var(--text-color-secondary);
}

input[type="text"],
input[type="tel"] {
    width: 100%;
    padding: 10px 12px; /* Increased padding */
    border: 1px solid var(--border-color); /* Softer border color */
    border-radius: 5px; /* Rounded corners for inputs */
    box-sizing: border-box;
    font-size: 1em;
    color: var(--text-color);
    transition: border-color 0.2s ease, box-shadow 0.2s ease; /* Smooth transition */
}

input[type="text"]:focus,
input[type="tel"]:focus {
    outline: none; /* Remove default browser outline */
    border-color: var(--primary-color); /* Highlight border on focus */
    box-shadow: 0 0 0 3px var(--focus-shadow); /* Add a glow effect */
}

small {
    display: block;
    color: #888; /* Lighter color for helper text */
    margin-top: 5px;
    font-size: 0.85em;
}

/* --- Name Group Layout --- */
.name-group {
    display: flex;
    gap: 20px; /* Slightly increased gap */
}
.name-group .form-group {
    flex: 1;
    margin-bottom: 0;
}

/* --- Button Styling --- */
button {
    display: block; /* Make button block level */
    width: 100%; /* Make button full width */
    padding: 12px 20px;
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 5px; /* Rounded corners */
    cursor: pointer;
    font-size: 1.1em; /* Slightly larger font */
    font-weight: 600;
    margin-top: 15px; /* Space above button */
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

button:hover {
    background-color: var(--primary-color-darker);
}

button:focus {
    outline: none; /* Remove default outline */
    box-shadow: 0 0 0 3px var(--focus-shadow); /* Glow effect */
}

/* --- Autofill Indication --- */
input:-webkit-autofill,
input:autofill {
    /* Keep the yellow background */
    background-color: var(--autofill-bg) !important;
    color: var(--autofill-text) !important;
    border: 1px solid var(--autofill-border);
    border-radius: 5px; /* Match input border-radius */
    -webkit-text-fill-color: var(--autofill-text) !important;
    caret-color: var(--autofill-text);
    /* Ensure box-shadow override works if needed */
    box-shadow: 0 0 0 1000px var(--autofill-bg) inset !important;
    transition: background-color 5000s ease-in-out 0s; /* Keep transition hack */
}
input:-webkit-autofill:focus,
input:autofill:focus {
    /* Ensure focus style is visible on autofilled fields */
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--focus-shadow), 0 0 0 1000px var(--autofill-bg) inset !important; /* Combine focus shadow and autofill bg */
}


/* --- Output Summary Styling --- */
#autofillInfo {
    margin-top: 30px;
    padding: 20px 30px;
    background-color: var(--white); /* Match form background */
    border-radius: 8px; /* Match form corners */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08); /* Match form shadow */
    max-width: 650px; /* Match form width */
    width: 100%;
    box-sizing: border-box;
}
#autofillInfo h2 { /* Style heading inside output if needed */
    margin-top: 0;
    margin-bottom: 15px;
    text-align: left;
    font-size: 1.2em;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}
#autofillInfo p { /* Style the initial paragraph */
    color: var(--text-color-secondary);
    text-align: center;
}
.output-wrapper {
    display: flex;
    justify-content: space-between;
    padding: 8px 0; /* Adjusted padding */
    border-bottom: 1px solid #eee;
    font-size: 0.95em;
}
.output-wrapper:last-child {
    border-bottom: none;
}
.element-id {
    font-weight: 600; /* Make label text bold */
    margin-right: 15px;
    color: var(--text-color-secondary);
}
/* Status indicator colors - kept as before but ensure they stand out */
.autofilled { color: #28a745; }
.autofilled-then-modified { color: #fd7e14; }
.only-manual { color: #0d6efd; } /* Slightly different blue */
.empty { color: #6c757d; }


/* --- Flex Container for Side-by-Side Layout --- */
.flex-container {
    display: flex;
    gap: 30px;
    justify-content: center;
    align-items: flex-start;
    width: 100%;
    max-width: 1200px;
    margin: 30px auto;
}

.results-pane {
    flex: 1;
    max-width: 500px;
    background-color: var(--white);
    padding: 20px 30px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    box-sizing: border-box;
}

.results-pane h2 {
    margin-top: 0;
    text-align: left;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    font-size: 1.25em;
}

@media (max-width: 1100px) {
    .flex-container {
        flex-direction: column;
        align-items: center;
    }
    .results-pane {
        width: 100%;
        max-width: 650px;
    }
}

/* --- Responsive Adjustments --- */
@media (max-width: 600px) {
    body {
        padding: 20px 10px; /* Less padding on small screens */
    }
    form, #autofillInfo {
        padding: 20px; /* Less padding inside containers */
    }
    .name-group {
        flex-direction: column;
        gap: 0; /* Remove gap when stacked */
    }
    .name-group .form-group {
        margin-bottom: 20px; /* Add margin back when stacked */
    }
     .name-group .form-group:last-child {
         margin-bottom: 0; /* Remove margin on last item */
     }
}

@media (max-width: 480px) {
    h1 { font-size: 1.8em; }
    h2 { font-size: 1.2em; }
    button { font-size: 1em; padding: 10px 15px; }
}

/* --- Documentation Section Styles (Consolidated) --- */
.docs-container {
    max-width: 900px;
    margin: 40px auto;
    padding: 30px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    width: 100%;
    box-sizing: border-box;
}
.docs-section {
    margin-bottom: 40px;
}
.docs-section h2 {
    border-bottom: 2px solid #007bff;
    padding-bottom: 10px;
    text-align: left;
    font-size: 1.5rem;
}
table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}
th, td {
    padding: 12px;
    text-align: left;
    border: 1px solid #ddd;
}
th {
    background-color: #f8f9fa;
    font-weight: bold;
}
pre {
    background-color: #f1f3f4;
    padding: 15px;
    border-radius: 5px;
    overflow-x: auto;
    font-family: monospace;
}
code {
    font-family: monospace;
    background-color: #f1f3f4;
    padding: 2px 4px;
    border-radius: 3px;
}