:root {
    --navy-dark: #0a1628;
    --navy: #1a2d50;
    --navy-light: #0d2137;
    --crimson: #c0392b;
    --crimson-light: #e74c3c;
    --white: #ffffff;
    --gray-50: #f8f9fa;
    --gray-100: #f0f1f3;
    --gray-200: #e0e2e6;
    --gray-300: #c5c8ce;
    --gray-500: #6c757d;
    --gray-700: #3a3f47;
    --radius: 8px;
    --shadow: 0 2px 12px rgba(10, 22, 40, 0.08);
    --shadow-lg: 0 8px 32px rgba(10, 22, 40, 0.12);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: var(--gray-50);
    color: var(--gray-700);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.page-content {
    flex: 1;
}

/* ── Header ── */
.header {
    background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 100%);
    color: var(--white);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.header-accent {
    height: 4px;
    background: linear-gradient(90deg, var(--crimson), var(--crimson-light), var(--crimson));
}
.header-inner {
    max-width: 900px;
    margin: 0 auto;
    padding: 18px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
}
.header-logo {
    width: 72px; height: 72px;
    object-fit: contain;
    flex-shrink: 0;
}
.header-text h1 {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.3px;
}
.header-text p {
    font-size: 0.82rem;
    opacity: 0.75;
    margin-top: 2px;
}

/* ── Progress Bar ── */
.progress-container {
    max-width: 900px;
    margin: 24px auto 0;
    padding: 0 24px;
}
.progress-bar-bg {
    height: 6px;
    background: var(--gray-200);
    border-radius: 3px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--crimson), var(--crimson-light));
    border-radius: 3px;
    transition: width 0.4s ease;
    width: 0%;
}
.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    color: var(--gray-500);
    margin-top: 8px;
}

/* ── Form Container ── */
.form-container {
    max-width: 900px;
    margin: 20px auto 40px;
    padding: 0 24px;
}

/* ── Sections ── */
.form-section {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 32px;
    margin-bottom: 24px;
    border-left: 4px solid var(--navy);
    display: none;
}
.form-section.active { display: block; }
.form-section.section-highlight { border-left-color: var(--crimson); }

.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--gray-100);
}
.section-number {
    width: 32px; height: 32px;
    background: var(--navy);
    color: var(--white);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    flex-shrink: 0;
}
.section-highlight .section-number { background: var(--crimson); }
.section-title {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1.15rem;
    color: var(--navy-dark);
    font-weight: 700;
}

/* ── Form Fields ── */
.form-group { margin-bottom: 22px; }
.form-group:last-child { margin-bottom: 0; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

label {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--navy-dark);
    margin-bottom: 6px;
}
label .required {
    color: var(--crimson);
    margin-left: 2px;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
textarea,
select {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--gray-200);
    border-radius: 6px;
    font-size: 0.92rem;
    font-family: inherit;
    color: var(--gray-700);
    background: var(--white);
    transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--navy);
    box-shadow: 0 0 0 3px rgba(26, 45, 80, 0.1);
}
textarea { resize: vertical; min-height: 80px; }

/* ── Radio / Checkbox groups ── */
.option-group { display: flex; flex-direction: column; gap: 8px; }
.option-group.inline { flex-direction: row; flex-wrap: wrap; gap: 10px; }

.option-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1.5px solid var(--gray-200);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}
.option-item:hover { border-color: var(--navy); background: rgba(26, 45, 80, 0.02); }
.option-item.selected {
    border-color: var(--navy);
    background: rgba(26, 45, 80, 0.05);
}
.option-item input[type="radio"],
.option-item input[type="checkbox"] {
    accent-color: var(--navy);
    width: 16px; height: 16px;
    cursor: pointer;
}

.conditional-field {
    margin-top: 10px;
    padding: 14px;
    background: var(--gray-50);
    border-radius: 6px;
    border: 1px dashed var(--gray-300);
    display: none;
}
.conditional-field.visible { display: block; }

/* ── Checkbox grid (medical history) ── */
.checkbox-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

/* ── File Upload ── */
.upload-area {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--gray-50);
}
.upload-area:hover { border-color: var(--navy); background: rgba(26, 45, 80, 0.02); }
.upload-area.dragover { border-color: var(--crimson); background: rgba(192, 57, 43, 0.05); }
.upload-icon { font-size: 2rem; margin-bottom: 8px; }
.upload-text { font-size: 0.9rem; color: var(--gray-500); }
.upload-text strong { color: var(--navy); }
.upload-hint { font-size: 0.78rem; color: var(--gray-500); margin-top: 6px; }
.file-list { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.file-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 12px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    font-size: 0.85rem;
}
.file-item-info { display: flex; align-items: center; gap: 8px; }
.file-remove {
    background: none; border: none;
    color: var(--crimson); cursor: pointer;
    font-size: 1.1rem; padding: 2px 6px;
}

/* ── Navigation Buttons ── */
.nav-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 28px;
    gap: 12px;
}
.btn {
    padding: 12px 32px;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    font-family: inherit;
}
.btn-secondary {
    background: var(--white);
    color: var(--navy);
    border: 2px solid var(--navy);
}
.btn-secondary:hover { background: var(--gray-50); }
.btn-primary {
    background: linear-gradient(135deg, var(--navy-dark), var(--navy));
    color: var(--white);
}
.btn-primary:hover { box-shadow: 0 4px 16px rgba(26, 45, 80, 0.3); }
.btn-submit {
    background: linear-gradient(135deg, var(--crimson), var(--crimson-light));
    color: var(--white);
    padding: 14px 48px;
    font-size: 1rem;
}
.btn-submit:hover { box-shadow: 0 4px 16px rgba(192, 57, 43, 0.35); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Step Indicators ── */
.steps-nav {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px 24px 0;
    display: flex;
    gap: 4px;
}
.step-dot {
    flex: 1;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-500);
    background: var(--gray-100);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}
.step-dot.active {
    background: var(--navy);
    color: var(--white);
}
.step-dot.completed {
    background: rgba(26, 45, 80, 0.15);
    color: var(--navy);
}

/* ── Footer ── */
.footer {
    background: linear-gradient(135deg, var(--navy-dark), var(--navy));
    color: rgba(255,255,255,0.6);
    text-align: center;
    padding: 24px;
    font-size: 0.8rem;
    margin-top: auto;
}
.footer a { color: var(--white); text-decoration: none; }
.footer-brand {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--white);
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

/* ── Validation ── */
.field-error input,
.field-error textarea,
.field-error select {
    border-color: var(--crimson);
}
.error-msg {
    color: var(--crimson);
    font-size: 0.78rem;
    margin-top: 4px;
    display: none;
}
.field-error .error-msg { display: block; }

/* ── Loading overlay ── */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(10, 22, 40, 0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.loading-overlay.active { display: flex; }
.loading-spinner {
    background: var(--white);
    border-radius: var(--radius);
    padding: 40px 48px;
    text-align: center;
    box-shadow: var(--shadow-lg);
}
.loading-spinner .spinner {
    width: 40px; height: 40px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--crimson);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-spinner p {
    font-size: 0.95rem;
    color: var(--navy-dark);
    font-weight: 600;
}

/* ── Responsive ── */
@media (max-width: 640px) {
    .form-row { grid-template-columns: 1fr; }
    .checkbox-grid { grid-template-columns: 1fr; }
    .form-section { padding: 24px 18px; }
    .header-inner { padding: 14px 18px; }
    .header-text h1 { font-size: 1.05rem; }
    .steps-nav { flex-wrap: wrap; gap: 4px 4px; }
    .step-dot { min-width: 0; font-size: 0.65rem; padding: 4px 6px; white-space: nowrap; flex: 0 1 calc(33.33% - 3px); height: auto; }
    .nav-buttons { flex-direction: column; }
    .btn { width: 100%; text-align: center; }
    .option-group.inline { flex-direction: column; }
}
