html, body {
    height: auto !important;
    overflow-y: auto !important;
}

/* Base layout */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0 auto;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.6s ease;
}

body.loaded {
    opacity: 1;
}

/* Form container */
.container {
    background: white;
    padding: 30px 40px;
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
    max-width: 950px;
    margin: 20px auto;
}

/* Headings */
h1 {
    color: #1e3a8a;  /* dark blue */
    text-align: center;
    font-size: 1.8rem;
    margin-bottom: 25px;
}

h2 {
    padding: 10px 15px;
    border-left: 6px solid #3498db;
    margin-top: 26px;
    font-size: 1.05em;
    color: #2c3e50;
    border-radius: 4px;
}

h3 {
    padding: 10px 15px;
    border-left: 2px solid #db3f34;
    font-size: 16px;
    color: #f30713;
    border-radius: 7px;
}

/* Logo */
.logo-wrapper {
    text-align: center;
    margin-bottom: 20px;
}

.top-logo {
    max-width: 450px;
    height: auto;
}

/* Questions */
.question-block {
    opacity: 0;
    transform: translateY(0);
    transition: all 0.5s ease-out;
}

.question-block.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Animate only dynamically injected questions */
.question-block:not(.visible) {
    opacity: 0;
    transform: translateY(20px);
}

.question-block:hover {
    background-color: #eef6ff; /* slight highlight on hover */
    transform: translateY(-1px);
}

.question-block label span {
    color: red;
}

.form-divider {
    border-top: 1px solid #d62f2f;
    padding: 18px 0;
}

label.main-label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #1f2937;  /* dark gray */
}

.options label {
    display: block;
    margin-bottom: 6px;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.options label:hover {
    background-color: #f0f4ff;
}

/* Inputs */
textarea,
input[type="text"] {
    width: 100%;
    padding: 12px;
    border: 1.5px solid #cbd5e1;
    border-radius: 6px;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

textarea:focus,
input[type="text"]:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 6px rgba(52, 152, 219, 0.4);
    transition: all 0.2s ease-in-out;
}

input[type="radio"],
input[type="checkbox"] {
    margin-right: 10px;
    accent-color: #2563eb; /* modern blue check */
}

/* Buttons */
button.primary {
    padding: 14px 20px;
    font-size: 16px;
    font-weight: 600;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

button.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(52, 152, 219, 0.4);
}

/* Note */
.note {
    font-size: 0.9rem;
    color: #4b5563;
    margin-top: 12px;
    background: #f0f4ff;
    padding: 10px 12px;
    border-left: 4px solid #2563eb;
    border-radius: 4px;
}

.section-divider {
    height: 1px;
    background: linear-gradient(to right, transparent, #cbd5e1, transparent);
    margin: 30px 0;
}

textarea {
    transition: all 0.25s ease;
}
textarea:focus {
    min-height: 120px;
}

input:required:invalid,
textarea:required:invalid {
    border-color: #ef4444;
    background: #fff5f5;
}

input:required:valid,
textarea:required:valid {
    border-color: #22c55e;
    background: #f0fff2;
}

.invalid-required {
    border: 2px solid #ff4d4d !important;
    background: #ffecec;
}

.invalid-block {
    border: 2px solid red !important;
    padding: 10px;
    border-radius: 8px;
    background-color: #fff0f0;
    scroll-margin-top: 100px;   /* NEW: prevent layout shift */
}

/* ===== User Info Top Section ===== */
.user-info {
    background: #ffffffee;
    padding: 22px 28px;
    margin: 20px 0 35px 0;
    border-radius: 14px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.08);
}

.user-info-title {
    font-size: 22px;
    font-weight: 700;
    color: #003366;
    margin-bottom: 18px;
    border-left: 4px solid #00aaff;
    padding-left: 10px;
}

.user-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px 28px;
}

.user-field label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #003366;
}

.user-field label span {
    color: red;
}

.user-field input {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #d0d7e2;
    background: #f9fbff;
    border-radius: 8px;
    font-size: 15px;
    transition: 0.2s;
}

.user-field input:focus {
    border-color: #00aaff;
    background: #ffffff;
    outline: none;
    box-shadow: 0 0 4px rgba(0,170,255,0.25);
}

/* --------------------------- Collapse Secstion - Start --------------------------- */
/* Collapsible Section */
.collapsible-section {
    margin-bottom: 20px;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
}

.collapsible-section:last-of-type {
    padding-bottom: 160px !important;
}

/* Header with + icon */
.collapsible-toggle {
    width: 100%;
    background: #4f81ee;
    color: white;
    font-size: 18px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    padding: 12px 10px;
    border-radius: 8px;
    display: flex;
    align-items:center;
    gap:8px;
    transition: background-color 0.35s ease, color 0.35s ease;
    position: relative;
}

/* Tooltip */
.collapsible-toggle::after {
    content: attr(data-progress);
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.85);
    color: #fff;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.collapsible-toggle:hover::after {
    opacity: 1;
}

/* The + / – icon */
.plus-minus {
    font-size: 24px;
    font-weight: bold;
    width: 24px;
    text-align: center;
    transition: transform 0.2s ease;
}

/* Title text */
.title-text {
    flex: 1;
    text-align: left;
}

/* Collapsible content — CLOSED */
.collapsible-content {
    overflow: hidden;
    padding: 0 16px;          /* L/R padding only */
    padding-bottom: 0px;
    transition: 
        max-height 0.35s ease, 
        padding 0.35s ease;
}

/* OPEN */
.collapsible-content.open {
    padding: 16px;            /* full padding when open */
    max-height: 9999px;
}

/* Error highlight */
.section-invalid {
    background: #fa2a55 !important;
    border-left: 4px solid #ef4444;
}

.collapse-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.btn-small {
    padding: 8px 14px;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.btn-small:hover {
    background: #1d4ed8;
}

/* --------------------------- Collapse Section - END --------------------------- */

#clearBtn {
    flex: 1;
    background: #e74c3c;
}

#savePdfBtn {
    scroll-margin-top: 200px;
}

/* Form Actions Layout */
.form-actions {
    margin-top: 30px;
    text-align: center;
}

/* ======================================================
   FLOATING ACTION BAR – using existing buttons
   ====================================================== */

.floating-actions {
    position: fixed;
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%) translateY(0);
    display: flex;
    gap: 12px;

    background: rgba(245, 247, 250, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(180, 188, 198, 0.45);

    padding: 12px 22px;
    border-radius: 50px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.22);

    opacity: 1;
    z-index: 9999;
}

/* Dedicated Action Section */
/* Make the action bar look compact */
.actions-wrapper {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(6px);
    border-radius: 40px;
    width: fit-content;
    margin: 0 auto 20px;
}

/* Make the buttons shrink to fit content */
.actions-wrapper .btn-flex {
    min-width: auto;
    padding: 10px 18px;
    font-size: 14px;
    line-height: 1.2;
    border-radius: 30px;
}

/* Ensure both buttons visually match in size */
.actions-wrapper .primary.btn-flex,
.actions-wrapper .secondary.btn-flex {
    width: auto;
    flex: 0 0 auto;
}

/* Primary Button */
.actions-wrapper .primary {
    background-color: #2563eb;   /* your brand blue */
    color: #fff;
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    transition: all 0.25s ease;
}

.actions-wrapper .primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.20);
}

/* Secondary Button */
.actions-wrapper .secondary {
    background-color: #f8f9fa;   /* clean light background */
    color: #333;
    border: 1px solid #d1d5db;
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.actions-wrapper .secondary:hover {
    background-color: #e5e7eb;
    transform: translateY(-2px);
}

/* Hover effects */
.actions-wrapper button:hover {
    opacity: 0.9;
}

.actions-wrapper:hover {
    box-shadow: 0 -6px 18px rgba(0,0,0,0.12);
    transition: box-shadow 0.25s ease;
}

/* Mobile adjustments */
@media (max-width: 600px) {
    .btn-flex {
        flex: 1 1 100%;
        width: 100%;
    }

    .actions-wrapper {
        padding: 10px 12px;
        gap: 10px;
    }

    .actions-wrapper button {
        padding: 10px 14px;
        font-size: 14px;
    }
    
    .actions-wrapper .btn-flex {
        padding: 8px 14px;
        font-size: 13px;
        border-radius: 26px;
    }

    .floating-actions {
        bottom: 12px;
        padding: 8px 16px;
        gap: 10px;
    }
}

/* Mobile View */
@media (max-width: 768px) {
    .user-info-grid {
        grid-template-columns: 1fr;
    }
}

.btn-flex {
    flex: 0 0 auto;        /* prevents stretching */
    width: 160px;          /* wider buttons */
    padding: 12px 20px;    /* balanced size */
    text-align: center;
    font-size: 15px;
    border-radius: 30px;   /* matches pill bar */
}

.primary,
.secondary {
    background: none;
    color: inherit;
    border: none;
    padding: 0;
}

.primary.btn-flex {
    background-color: #2563eb;   /* strong clean blue */
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
    transition: all 0.25s ease;
}

.primary.btn-flex:hover {
    background-color: #1d4ed8;   /* deeper hover */
    transform: translateY(-2px);
}

.secondary.btn-flex {
    background-color: #f8fafc;       /* soft clean grey-blue */
    color: #333;
    border: 1px solid #d8dee4;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    transition: all 0.25s ease;
}

.secondary.btn-flex:hover {
    background-color: #e2e8f0;       /* soft hover */
    transform: translateY(-2px);
}

.note {
    margin-top: 12px;
    font-size: 0.9rem;
    color: #555;
}

/* Extra bottom spacing for last question visibility */
.bottom-padding {
    height: 100px; /* adjust as needed for PDF / mobile scrolling */
}

/* Floating Scroll-to-Top Button */
.floating-top-btn {
    position: fixed;
    bottom: 70px;
    right: 20px;
    background-color: #333;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

#questionnaireForm,
#pdf-content,
.container {
    padding-bottom: 120px;   /* or 140px if needed */
}

/* ===== Section Completion States ===== */

.collapsible-toggle.section-empty {
    background: #ef4444 !important; /* red */
}

.collapsible-toggle.section-partial {
    background: #22c55e !important; /* green */
}

.collapsible-toggle.section-complete {
    background: #2563eb !important; /* blue */
}

/* Sticky compact header */
.sticky-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 52px;
    background: #ffffff;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    z-index: 1000;

    transform: translateY(-100%);
    transition: transform 0.25s ease;
}

.sticky-header.show {
    transform: translateY(0);
}

/* Logo animation */
.sticky-logo {
    height: 40px;
    transition: height 0.3s ease;
}

.sticky-header.compact .sticky-logo {
    height: 26px;
}

/* Title */
.sticky-title {
    font-size: 14px;
    font-weight: 600;
    color: #1f3a5f;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 45%;
}

/* Progress bar */
.sticky-progress {
    flex: 1;
    height: 6px;
    background: #e6eaf0;
    border-radius: 4px;
    overflow: hidden;
}

.sticky-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #1f6fd6, #3b82f6);
    transition: width 0.3s ease;
}

/* Progress text */
.sticky-progress-text {
    font-size: 12px;
    font-weight: 600;
    color: #1f3a5f;
    min-width: 36px;
    text-align: right;
}

/* Mobile tweaks */
@media (max-width: 600px) {
    .sticky-title {
        display: none;
    }
}

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #1f4fd8;
    color: #fff;
    padding: 12px 18px;
    border-radius: 6px;
    font-size: 14px;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 9999;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* Populate the City and Country of Residence */
/* ------------------------------------------ */
/* Suggestions dropdown */
.suggestions {
    /* border: 1px solid #ccc; */
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 150px;
    overflow-y: auto;
    position: absolute;
    background: #fff;
    width: 100%;
    z-index: 1000;
}

.suggestions li {
    cursor: pointer;
    padding: 5px 10px;
}

.suggestions li:hover {
    background: #eee;
}



/* -------------------------- END -------------------------- */
/* Populate the City and Country of Residence */
