/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600;700&family=Montserrat:wght@700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap'); /* Including Poppins for safety */

:root {
    --primary-blue: #007bff;
    --light-blue: #e8f4fd;
    --text-color: #343a40;
    --light-text-color: #6c757d;
    --border-color: #dee2e6;
    --input-bg: #f8f9fa;
    --white: #ffffff;
    --gradient-start: #007bff;
    --gradient-end: #0056b3;
    --error-red: #dc3545; /* New variable for error color */

    --font-family-body: 'Open Sans', sans-serif;
    --font-family-heading: 'Montserrat', sans-serif;
}

/* * CORRECTION: Changed 'body' to '.form-page-container' 
 * to avoid collision with the other CSS block's body font. 
 * The HTML should wrap the form in this class/ID if needed.
 */
/* --- KEY CORRECTION FOR CENTERING --- */
.form-page-container {
    font-family: var(--font-family-body);
    background-color: #f0f2f5; 
    display: flex;
    justify-content: center; /* Centers horizontally */
    align-items: center;     /* CHANGED: Centers vertically */
    min-height: 100vh;
    padding: 30px 20px;
    margin: 0;
    box-sizing: border-box;
    width: 100%;
    overflow-y: auto; /* Allows scrolling if the content is taller than the screen */
}

/* Ensure links within the form container don't inherit global 'a' styles */
.form-page-container a { 
    text-decoration: none; 
    color: var(--primary-blue);
}


.form-container {
    background: var(--white);
    padding: 40px 50px;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 950px; 
    box-sizing: border-box;
}

/* --- Header Section (No changes here, keeping only for context) --- */
.form-header {
    display: grid;
    grid-template-columns: 80px 1fr 80px; 
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.form-header .logo { justify-self: start; }

.form-header .logo img {
    max-width: 80px; 
    height: auto;
    display: block;
}

.form-header .main-heading {
    text-align: center;
    font-family: var(--font-family-heading);
    font-size: 2.2em;
    color: var(--primary-blue);
    margin: 0;
    grid-column: 2;
}

/* --- Form Structure (No changes here) --- */
.form-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.section-heading {
    font-family: var(--font-family-heading);
    font-size: 1.8em;
    color: var(--primary-blue);
    margin-bottom: 25px;
    border-bottom: 2px solid var(--primary-blue);
    padding-bottom: 10px;
    display: inline-block;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px 40px;
}

.initial-details-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); 
    gap: 15px 20px; 
}

/* ... (Photo upload styles remain the same) ... */
.initial-details-grid .form-group:nth-child(1) { grid-column: 1 / span 2; } 
.initial-details-grid .photo-group { 
    grid-column: 3;
    grid-row: 1 / span 2; 
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}
.photo-upload-container {
    position: relative; 
    width: 100%;
    max-width: 140px;
    height: 160px;
    border: 2px solid var(--primary-blue);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: var(--input-bg);
    border-radius: 5px;
    margin-top: 5px;
    padding: 5px;
    overflow: hidden; 
    background-size: cover; 
    background-position: center; 
    background-repeat: no-repeat;
}
.photo-upload-container input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0; 
    cursor: pointer;
    z-index: 10;
}
.photo-upload-label {
    display: block;
    width: 100%;
    text-align: center;
    font-size: 0.75em;
    color: var(--text-color);
    line-height: 1.2;
    padding: 5px;
    z-index: 5; 
}
.photo-upload-container.has-image .photo-upload-label {
    display: none;
}
/* END Photo upload styles */


.form-group {
    display: flex;
    flex-direction: column;
}

label {
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-color);
    font-size: 0.95em;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="date"],
textarea,
select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1em;
    color: var(--text-color);
    background-color: var(--input-bg);
    transition: border-color 0.3s, box-shadow 0.3s;
    box-sizing: border-box;
}

/* DEFAULT FOCUS STATE (Blue) */
input:focus, textarea:focus, select:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
    outline: none;
    background-color: var(--white);
}


/* Optional: Red border on focus if invalid */
select:focus:invalid,
textarea:focus:invalid {
        border-color: var(--error-red);
        box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.5); /* Stronger red shadow on focus */
}
/* >>>>>> END: INVALID INPUT STYLING <<<<<< */


textarea {
    min-height: 90px;
    resize: vertical;
}
/* ... (Rest of CSS is unchanged) ... */
.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px 30px;
    margin-top: 5px;
}

.radio-group label {
    display: flex;
    align-items: center;
    font-weight: normal;
    cursor: pointer;
    color: var(--text-color);
}

.radio-group input[type="radio"] {
    margin-right: 8px;
    transform: scale(1.1);
    accent-color: var(--primary-blue);
}

/* Full width for specific fields */
.form-group.full-width {
    grid-column: 1 / -1;
}

/* Next Button */
.next-button {
    display: block;
    width: fit-content;
    margin: 30px auto 0;
    padding: 15px 40px;
    font-size: 1.2em;
    font-weight: 700;
    color: var(--white);
    background-image: linear-gradient(45deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease-in-out;
    box-shadow: 0 5px 15px rgba(0, 123, 255, 0.3);
    text-decoration: none;
}

.next-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 123, 255, 0.4);
}

/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
    .form-container { padding: 25px 20px; }
    .form-header {
        grid-template-columns: 1fr;
        grid-template-areas: "logo" "heading";
        gap: 15px;
    }
    .form-header .logo { grid-area: logo; justify-self: center; }
    .form-header .main-heading { grid-area: heading; font-size: 1.5em; }
    
    .initial-details-grid {
        grid-template-columns: 1fr; /* Single column on mobile */
    }
    .initial-details-grid .form-group:nth-child(1) { grid-column: 1; }
    .initial-details-grid .photo-group { 
        grid-column: 1; 
        grid-row: auto; 
        order: -1; /* Move photo to the top of the section */
        margin-bottom: 20px;
    }
    .photo-upload-container {
        max-width: 100%;
    }
    .form-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}