/* style.css - Initial Styling for InsightForm AI */

/* Define CSS variables for easy changes */
:root {
    --primary-color: #007bff; /* A vibrant blue */
    --primary-hover-color: #0056b3;
    --text-color-dark: #343a40;
    --text-color-medium: #6c757d;
    --text-color-light: #adb5bd;
    --border-color: #ced4da;
    --background-light: #f8f9fa;
    --background-white: #ffffff;
    --error-color: #dc3545;
    --error-background: #f8d7da;
}

/* --- Global Styles & Typography --- */
body {
    font-family: 'Open Sans', sans-serif; /* Body font */
    background-color: var(--background-light); /* Slightly lighter, cleaner background */
    margin: 0;
    padding: 20px;
    color: var(--text-color-dark);
    line-height: 1.6;
}

* {
    box-sizing: border-box; /* Easier layout management */
}

/* --- Form Container --- */
.form-container {
    max-width: 700px; /* Adjust as needed */
    margin: 20px auto; /* Center the form */
    padding: 25px;
    background-color: #ffffff; /* White background for the form */
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* --- Header & Progress Bar --- */
.form-header {
    text-align: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.form-header h1 {
    margin: 0 0 10px 0;
    color: var(--text-color-dark);
    font-family: 'Montserrat', sans-serif; /* Heading font */
}

/* style.css - Visual Progress Bar */
.progress-bar-container {
    width: 100%;
    height: 10px; /* Or your desired height */
    background-color: #e9ecef;
    border-radius: 5px;
    margin-bottom: 5px; /* Space before the text "Page X of Y" */
    overflow: hidden; /* Ensures the inner bar stays contained */
}

.progress-bar-actual {
    width: 0%; /* Will be updated by JavaScript */
    height: 100%;
    background-color: var(--primary-color);
    border-radius: 5px;
    transition: width 0.4s ease; /* Smooth transition */
}
.progress-bar-text { /* Existing .progress-bar can be renamed or styled this way */
    font-size: 0.9em;
    color: var(--text-color-medium);
    text-align: center; /* If you want the text centered below bar */
}

.progress-bar {
    font-size: 0.9em;
    color: var(--text-color-medium);
}

/* --- Fieldset & Legend --- */
fieldset {
    border: none; /* Remove default fieldset border */
    padding: 0; /* Remove default fieldset padding */
    margin-bottom: 20px;
    transition: opacity 0.1s ease-out; /* Much faster, e.g., 0.1s or 0.15s */
}

.hidden-page {
    opacity: 0;
    transform: translateX(-20px); /* Example starting position for incoming page */
    pointer-events: none; /* Prevent interaction with hidden pages */
    position: absolute; /* Allow pages to overlap during transition */
    width: 100%; /* Ensure it takes up the full width of its container */
    left: 0; /* Align with the container */
}

.active-page {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto; /* Allow interaction */
    position: relative; /* Or static, depending on layout needs */
}


legend {
    font-size: 1.4em;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 20px;
    padding-bottom: 5px;
    border-bottom: 2px solid var(--primary-color);
    width: 100%;
    font-family: 'Montserrat', sans-serif; /* Heading font */
}

/* --- Form Groups, Labels & Inputs --- */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    font-weight: 600; /* From Open Sans if imported */
    margin-bottom: 8px;
    color: var(--text-color-dark); /* Darker, more readable labels */
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
textarea,
select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1em;
    transition: border-color 0.3s ease;
    background-color: var(--background-white); /* Ensure inputs are white */
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
textarea:focus,
select:focus {
    border-color: var(--primary-color);
    outline: none; /* Remove default browser outline */
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25); /* Bootstrap-like focus */
}

textarea {
    resize: vertical; /* Allow vertical resize, not horizontal */
    min-height: 80px;
}

select {
    appearance: none; /* Remove default system appearance for select */
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23007CB2%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E');
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    padding-right: 30px; /* Make space for the arrow */
}

small {
    display: block;
    font-size: 0.85em;
    color: var(--text-color-medium);
    margin-top: 5px;
}

/* --- Navigation Buttons --- */
.navigation-buttons {
    display: flex;
    justify-content: space-between; /* Puts space between prev and next */
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

button {
    padding: 12px 25px;
    font-size: 1em;
    font-weight: bold;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.1s ease, box-shadow 0.3s ease; /* Added box-shadow transition */
    text-transform: uppercase; /* Uppercase text */
    letter-spacing: 0.5px; /* Added letter spacing */
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); /* Added subtle box shadow */
}

button#prevBtn {
    background-color: #6c757d; /* A neutral gray */
    color: white;
}

button#prevBtn:hover {
    background-color: #5a6268;
}

button#nextBtn, button#submitBtn /* Assuming submitBtn might be the ID for the submit button */ {
    background-color: var(--primary-color);
    color: white;
}

button#nextBtn:hover, button#submitBtn:hover {
    background-color: var(--primary-hover-color);
}

button:active {
    transform: translateY(1px); /* Slight press effect */
    box-shadow: 0 1px 2px rgba(0,0,0,0.15); /* Slightly adjusted shadow on press */
}


/* --- Footer --- */
.form-footer {
    text-align: center;
    margin-top: 30px;
    font-size: 0.9em;
    color: var(--text-color-medium);
}

/* --- Error Styling (already defined, but ensure it fits) --- */
.input-error {
    border-color: var(--error-color) !important;
    background-color: var(--error-background) !important;
}

.error-message {
    color: var(--error-color);
    font-size: 0.9em;
    margin-top: 5px;
    display: block;
}

/* --- Responsive Design --- */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .form-container {
        margin: 10px auto;
        padding: 20px; /* Adjusted padding for smaller screens */
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08); /* Softer shadow on mobile */
    }

    .form-header h1 {
        font-size: 1.8em; /* Slightly smaller heading */
    }

    legend {
        font-size: 1.2em; /* Smaller legend */
    }

    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="url"],
    textarea,
    select {
        padding: 10px;
        font-size: 0.95em;
    }

    button {
        padding: 10px 20px;
        font-size: 0.95em;
    }

    .navigation-buttons {
        flex-direction: column; /* Stack buttons on smaller screens */
        gap: 10px; /* Add space between stacked buttons */
    }

    button#prevBtn,
    button#nextBtn,
    button#submitBtn {
        width: 100%; /* Make buttons full width */
    }

    /* Adjust progress bar text if needed */
    .progress-bar-text {
        font-size: 0.85em;
    }
}

@media (max-width: 480px) {
    .form-header h1 {
        font-size: 1.5em;
    }

    legend {
        font-size: 1.1em;
    }

    .form-container {
        padding: 15px;
    }

    /* Further reduce padding for very small screens if necessary */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="url"],
    textarea,
    select,
    button {
        font-size: 0.9em;
    }
}

/* style.css - ==== INTRO SCREEN STYLES ==== */
#introScreen {
    position: fixed; /* Cover the entire viewport */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #ffffff; /* Or a theme color, e.g., var(--primary-color) for a full splash */
    /* For a slightly off-white, try var(--background-light) if you want the form to 'pop' more when it appears */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999; /* Ensure it's on top of everything */
    opacity: 1;
    transition: opacity 0.8s ease-out, visibility 0.8s ease-out; /* For fade-out */
}

#introScreen.hidden {
    opacity: 0;
    visibility: hidden; /* Remove from layout after transition */
}

.intro-content {
    text-align: center;
    color: var(--primary-color, #007bff); /* Using primary color for text */
}

/* If using an image logo instead of Lottie */
.intro-logo {
    max-width: 150px; /* Adjust as needed */
    margin-bottom: 20px;
    animation: subtlePulse 2s infinite ease-in-out;
}

.intro-content h1 { /* If you use a text title */
    font-family: 'Montserrat', sans-serif;
    font-size: 2.5em;
    margin-bottom: 10px;
    color: var(--primary-color, #007bff);
}

.intro-tagline {
    font-family: 'Open Sans', sans-serif;
    font-size: 1.2em;
    color: var(--text-color-medium, #6c757d);
    margin-top: 15px; /* Space from Lottie/logo */
    animation: fadeInText 1.5s ease-out 0.5s forwards; /* Text fades in after Lottie starts */
    opacity: 0;
}

/* Keyframe animations for intro elements (optional) */
@keyframes subtlePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}

@keyframes fadeInText {
    to { opacity: 1; }
}

/* Styling for the main form container to fade in */
#mainFormContainer {
    opacity: 0; /* Initially hidden via HTML style attribute */
    transition: opacity 0.8s ease-in 0.5s; /* Fade-in transition, delayed slightly */
}

#mainFormContainer.visible {
    opacity: 1;
}