/* Forms Base CSS - Core UI Framework */
/* Shared across all forms */

/* ============================================
   CSS Custom Properties
   ============================================ */
:root {
    /* Brand Colors - Optimised Blue */
    --primary: #1DA1F2;
    --primary-hover: #1a8cd8;
    --primary-light: rgba(29, 161, 242, 0.1);
    --primary-border: rgba(29, 161, 242, 0.3);
    
    /* Neutral Colors */
    --text-primary: #1a1a1a;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border: #d1d5db;
    --border-light: #e5e7eb;
    --background: #f9fafb;
    --surface: #ffffff;
    
    /* Status Colors */
    --success: #10b981;
    --success-light: #d1fae5;
    --error: #dc2626;
    --error-light: #fef2f2;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    
    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;
    
    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-size-xs: 12px;
    --font-size-sm: 14px;
    --font-size-base: 16px;
    --font-size-lg: 18px;
    --font-size-xl: 24px;
    --font-size-2xl: 32px;
    --font-size-3xl: 40px;
    
    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 300ms ease;
    --transition-slow: 500ms ease;
}

/* ============================================
   Reset & Base Styles
   ============================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ============================================
   Header
   ============================================ */
.form-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #e1e5e9;
    padding: 16px 24px;
}

.header-content {
    max-width: 560px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.form-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 16px;
    color: #1a1a1a;
}

.form-logo.form-logo-brand-image {
    gap: 0;
}

.form-logo.form-logo-brand-image .brand-text-logo {
    display: block;
    height: 28px;
    width: auto;
    aspect-ratio: 626.0417 / 79.1667;
    max-width: 100%;
    object-fit: contain;
}

.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
}

.logo-icon svg {
    width: 100%;
    height: 100%;
}

.form-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: #6b7280;
}

.form-progress span {
    display: none;
}

.progress-bar {
    width: 180px;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #1DA1F2;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 2px;
}

/* ============================================
   Main Layout
   ============================================ */
.form-app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
    padding-top: 80px;
    position: relative;
}

.form-container {
    width: 100%;
    max-width: 640px;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* ============================================
   Step Container & Animations
   ============================================ */
.step-wrapper {
    width: 100%;
    position: relative;
    overflow: visible;
    padding: 0 4px;
}

.step {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity var(--transition-slow), transform var(--transition-slow);
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

.step.active {
    opacity: 1;
    transform: translateY(0);
    position: relative;
    pointer-events: auto;
}

.step.exiting {
    opacity: 0;
    transform: translateY(-20px);
    pointer-events: none;
}

/* Staggered Animation Classes */
.step.active .step-icon {
    animation: fadeSlideIn 400ms ease forwards;
    animation-delay: 0ms;
}

.step.active .step-title {
    animation: fadeSlideIn 400ms ease forwards;
    animation-delay: 80ms;
}

.step.active .step-description {
    animation: fadeSlideIn 400ms ease forwards;
    animation-delay: 160ms;
}

.step.active .step-content {
    animation: fadeSlideIn 400ms ease forwards;
    animation-delay: 240ms;
}

.step.active .step-actions {
    animation: fadeSlideIn 400ms ease forwards;
    animation-delay: 320ms;
}

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeSlideOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-16px);
    }
}

/* ============================================
   Step Content Elements
   ============================================ */
.step-icon {
    width: 80px;
    height: 80px;
    margin-bottom: var(--space-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
}

.step-icon img,
.step-icon svg {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.step-title {
    font-size: var(--font-size-2xl);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-md);
    line-height: 1.2;
    opacity: 0;
}

.step-description {
    font-size: var(--font-size-base);
    color: var(--text-secondary);
    margin-bottom: var(--space-xl);
    max-width: 480px;
    line-height: 1.6;
    opacity: 0;
}

.step-description a {
    color: var(--primary);
    text-decoration: none;
}

.step-description a:hover {
    text-decoration: underline;
}

.step-content {
    width: 100%;
    opacity: 0;
}

.step-actions {
    margin-top: var(--space-xl);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    opacity: 0;
}

/* ============================================
   Form Card (for multi-field steps)
   ============================================ */
.form-card {
    width: 100%;
    max-width: 560px;
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: var(--space-xl);
    padding-bottom: calc(var(--space-xl) + 8px);
    text-align: left;
    margin-bottom: 16px;
}

.form-card .step-title {
    text-align: left;
    font-size: var(--font-size-xl);
    margin-bottom: var(--space-sm);
}

.form-card .step-description {
    text-align: left;
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-lg);
}

/* Welcome Card - specific styling for welcome page */
.welcome-card {
    max-width: 560px;
    text-align: center;
    padding: var(--space-2xl) var(--space-xl);
}

.welcome-title {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 0;
    margin-bottom: var(--space-lg);
    line-height: 1.2;
}

.welcome-description {
    font-size: var(--font-size-base);
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: var(--space-xl);
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}

.welcome-card .step-actions {
    margin-top: var(--space-2xl);
    display: flex;
    justify-content: center;
}

/* ============================================
   Primary Button
   ============================================ */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    min-width: 200px;
    padding: 14px 32px;
    background: var(--primary);
    color: white;
    font-size: var(--font-size-base);
    font-weight: 500;
    font-family: inherit;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary.loading {
    position: relative;
    pointer-events: none;
}

.btn-primary.loading .btn-text {
    display: none;
}

.btn-primary.loading .loading-text {
    opacity: 1;
    transition: opacity 300ms ease;
}

.btn-primary.loading .loading-text.fade-out {
    opacity: 0;
}

.btn-primary.loading .loading-indicator {
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-left: 10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
}

/* Reduced motion: disable animations */
@media (prefers-reduced-motion: reduce) {
    .btn-primary.loading .loading-text,
    .btn-primary.loading .loading-text.fade-out {
        opacity: 1;
        transition: none;
    }
    
    .btn-primary.loading .loading-indicator {
        animation: none;
        border-color: rgba(255, 255, 255, 0.5);
    }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Secondary/Text Button */
.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 12px 24px;
    background: transparent;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    font-weight: 500;
    font-family: inherit;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--border-light);
    color: var(--text-primary);
}

.btn-text {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: var(--font-size-sm);
    font-family: inherit;
    cursor: pointer;
    padding: var(--space-sm) var(--space-md);
    transition: color var(--transition-fast);
}

.btn-text:hover {
    color: var(--text-secondary);
}

/* ============================================
   Collapsible Toggle Button
   ============================================ */
.collapsible-toggle {
    background: transparent;
    border: none;
    color: var(--primary);
    font-size: var(--font-size-sm);
    font-weight: 500;
    padding: var(--space-sm) 0;
    margin-top: var(--space-sm);
    margin-bottom: var(--space-md);
    cursor: pointer;
    text-align: left;
    transition: color var(--transition-fast);
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
}

.collapsible-toggle:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.collapsible-toggle:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

.collapsible-toggle[aria-expanded="false"] .toggle-text-expanded {
    display: none;
}

.collapsible-toggle[aria-expanded="true"] .toggle-text-collapsed {
    display: none;
}

/* ============================================
   Collapsible Fields Container
   ============================================ */
.collapsible-fields {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height var(--transition-base), opacity var(--transition-base);
}

.collapsible-fields.expanded {
    max-height: 500px;
    opacity: 1;
    margin-top: var(--space-md);
}

.collapsible-field {
    transition: opacity var(--transition-base);
}

/* ============================================
   Form Fields
   ============================================ */
.field-group {
    margin-bottom: var(--space-lg);
}

.field-group:last-child {
    margin-bottom: 0;
}

.field-label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.field-label .required {
    color: var(--error);
    margin-left: 2px;
}

.field-helper {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-top: var(--space-xs);
    margin-bottom: 12px;
    line-height: 1.5;
}

.field-helper a {
    color: var(--primary);
}

.field-error {
    font-size: var(--font-size-xs);
    color: var(--error);
    margin-top: var(--space-xs);
    display: none;
}

.field-error.show {
    display: block;
}

/* Text Input */
.input-field {
    width: 100%;
    padding: 12px 16px;
    font-size: var(--font-size-base);
    font-family: inherit;
    color: var(--text-primary);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast);
    outline: none;
}

.input-field::placeholder,
.textarea-field::placeholder,
.select-field::placeholder {
    color: var(--text-secondary);
    opacity: 0.8;
}

.input-field:focus {
    border-color: var(--primary);
}

.input-field:disabled {
    background: var(--border-light);
    cursor: not-allowed;
}

.input-field.error {
    border-color: var(--error);
}

.input-field.error:focus {
    border-color: var(--error);
}

/* Textarea */
.textarea-field {
    width: 100%;
    min-height: 120px;
    padding: 12px 16px;
    font-size: var(--font-size-base);
    font-family: inherit;
    color: var(--text-primary);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast);
    outline: none;
    resize: vertical;
}

.textarea-field:focus {
    border-color: var(--primary);
}

/* Select Dropdown */
.select-field {
    width: 100%;
    padding: 12px 16px;
    padding-right: 40px;
    font-size: var(--font-size-base);
    font-family: inherit;
    color: var(--text-primary);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

/* Placeholder state - lighter text */
.select-field:invalid {
    color: var(--text-muted);
}

.select-field:focus {
    border-color: var(--primary);
}

/* Options styling */
.select-field option {
    color: var(--text-primary);
    background: var(--surface);
    padding: 8px;
}

.select-field option:hover {
    background: var(--border-light);
}

.select-field option:disabled {
    color: var(--text-muted);
}

/* ============================================
   Autocomplete Field
   ============================================ */
.autocomplete-wrapper {
    position: relative;
    width: 100%;
}

.autocomplete-input {
    width: 100%;
    padding: 12px 16px;
    font-size: var(--font-size-base);
    font-family: inherit;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast);
    cursor: text;
}

.autocomplete-input:focus {
    border-color: var(--primary);
    outline: none;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
}

.autocomplete-list {
    padding: 4px;
}

.autocomplete-item {
    padding: 10px 12px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background-color var(--transition-fast);
    font-size: var(--font-size-base);
    color: var(--text-primary);
}

.autocomplete-item:hover,
.autocomplete-item.highlighted {
    background: var(--primary-light);
    color: var(--primary);
}

.autocomplete-empty {
    padding: 16px 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}

/* Scrollbar styling for autocomplete dropdown */
.autocomplete-dropdown::-webkit-scrollbar {
    width: 8px;
}

.autocomplete-dropdown::-webkit-scrollbar-track {
    background: var(--background);
    border-radius: var(--radius-sm);
}

.autocomplete-dropdown::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: var(--radius-sm);
}

.autocomplete-dropdown::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================
   Multiple Choice Options
   ============================================ */
.choice-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.choice-option {
    position: relative;
}

.choice-option input[type="radio"],
.choice-option input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.choice-label {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.choice-label:hover {
    border-color: var(--primary);
    background: rgba(29, 161, 242, 0.02);
}

.choice-option input:checked + .choice-label {
    border-color: var(--primary);
    background: rgba(29, 161, 242, 0.05);
}

.choice-indicator {
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--text-muted);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.choice-option input:checked + .choice-label .choice-indicator {
    border-color: var(--primary);
    background: var(--primary);
}

.choice-option input:checked + .choice-label .choice-indicator::after {
    content: '';
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
}

/* Checkbox indicator */
.choice-option input[type="checkbox"] + .choice-label .choice-indicator {
    border-radius: 4px;
}

.choice-option input[type="checkbox"]:checked + .choice-label .choice-indicator {
    background: var(--primary);
    border-color: var(--primary);
}

.choice-option input[type="checkbox"]:checked + .choice-label .choice-indicator::after {
    content: '✓';
    font-size: 11px;
    font-weight: 600;
    color: white;
    background: none;
    width: auto;
    height: auto;
}

.choice-text {
    font-size: 15px;
    font-weight: 400;
    color: var(--text-primary);
}

/* ============================================
   Condensed Choice Options Variant
   ============================================ */
.choice-options-condensed {
    gap: 4px;
}

.choice-options-condensed .choice-label {
    padding: 6px 8px;
    background: transparent;
    border: none;
    border-radius: 4px;
}

.choice-options-condensed .choice-label:hover {
    background: rgba(29, 161, 242, 0.04);
    border: none;
}

.choice-options-condensed .choice-option input:checked + .choice-label {
    background: rgba(29, 161, 242, 0.08);
    border: none;
}

.choice-options-condensed .choice-indicator {
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--text-muted);
}

.choice-options-condensed .choice-option input:checked + .choice-label .choice-indicator {
    border-color: var(--primary);
    background: var(--primary);
}

.choice-options-condensed .choice-option input:checked + .choice-label .choice-indicator::after {
    width: 5px;
    height: 5px;
}

.choice-options-condensed .choice-text {
    font-size: 14px;
}

/* ============================================
   Multi-Select Checkboxes
   ============================================ */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.checkbox-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.checkbox-option:hover {
    border-color: var(--primary);
    background: rgba(29, 161, 242, 0.02);
}

.checkbox-option.selected {
    border-color: var(--primary);
    background: rgba(29, 161, 242, 0.05);
}

.checkbox-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
    border: 1.5px solid var(--text-muted);
    border-radius: 4px;
}

/* ============================================
   Field Width Variants
   ============================================ */
.fields-row {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
    margin-bottom: var(--space-md);
}

.field-half {
    flex: 1 1 calc(50% - var(--space-sm));
    min-width: 200px;
}

.field-quarter {
    flex: 0 0 calc(25% - var(--space-sm));
    min-width: 100px;
}

.field-three-quarter {
    flex: 0 0 calc(75% - var(--space-sm));
    min-width: 200px;
}

/* ============================================
   File Upload - Drag & Drop Style
   ============================================ */
.file-upload-wrapper {
    width: 100%;
}

.file-upload-input {
    display: none;
}

.file-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 24px;
    background: var(--surface);
    border: 1.5px dashed var(--border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: center;
}

.file-upload-label:hover {
    border-color: var(--primary);
    background: rgba(29, 161, 242, 0.02);
}

.file-upload-label.drag-over {
    border-color: var(--primary);
    background: rgba(29, 161, 242, 0.08);
    border-style: solid;
}

.file-upload-icon {
    width: 32px;
    height: 32px;
    color: var(--text-muted);
}

.file-upload-text {
    font-size: 14px;
    color: var(--text-secondary);
}

.file-upload-hint {
    font-size: 12px;
    color: var(--text-muted);
}

.file-upload-success {
    display: none;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    background: var(--success-light);
    border: 1px solid var(--success);
    border-radius: var(--radius-md);
    color: var(--success);
    font-size: var(--font-size-sm);
    margin-top: var(--space-sm);
}

.file-upload-success.show {
    display: flex;
}

/* ============================================
   Signature Pad
   ============================================ */
.signature-wrapper {
    width: 100%;
}

.signature-hint {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    margin-bottom: var(--space-sm);
}

.signature-canvas {
    width: 100%;
    height: 200px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    cursor: crosshair;
    touch-action: none;
}

.signature-canvas:focus {
    border-color: var(--primary);
    outline: none;
}

.signature-canvas.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.signature-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: var(--space-sm);
}

.btn-clear-signature {
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-clear-signature:hover {
    color: var(--error);
    border-color: var(--error);
}

/* ============================================
   PDF Viewer
   ============================================ */
.pdf-viewer-wrapper {
    width: 100%;
    margin-bottom: var(--space-md);
}

.pdf-viewer-title {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.pdf-viewer-container {
    width: 100%;
    height: 400px;
    background: var(--border-light);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow-y: auto;
    overflow-x: hidden;
}

.pdf-canvas-container {
    padding: var(--space-md);
}

.pdf-canvas-container canvas {
    width: 100%;
    height: auto;
    display: block;
    margin-bottom: var(--space-md);
}

.pdf-canvas-container canvas:last-child {
    margin-bottom: 0;
}

.pdf-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: var(--text-muted);
}

.pdf-scroll-status {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    background: var(--warning-light);
    border: 1px solid var(--warning);
    border-radius: var(--radius-md);
    color: #92400e;
    font-size: var(--font-size-sm);
    margin-top: var(--space-sm);
}

.pdf-scroll-acknowledged {
    display: none;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    background: var(--success-light);
    border: 1px solid var(--success);
    border-radius: var(--radius-md);
    color: #065f46;
    font-size: var(--font-size-sm);
    margin-top: var(--space-sm);
}

.pdf-scroll-acknowledged.show {
    display: flex;
}

/* ============================================
   Error Messages
   ============================================ */
.error-banner {
    display: none;
    padding: var(--space-md);
    background: var(--error-light);
    border: 1px solid rgba(220, 38, 38, 0.3);
    border-radius: var(--radius-md);
    color: var(--error);
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-lg);
    text-align: center;
}

.error-banner.show {
    display: block;
}

/* ============================================
   Success Screen
   ============================================ */
.success-screen {
    text-align: center;
}

.success-icon {
    width: 80px;
    height: 80px;
    background: var(--success);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-xl);
    color: white;
    font-size: 36px;
}

.success-title {
    font-size: var(--font-size-2xl);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-md);
}

.success-message {
    font-size: var(--font-size-base);
    color: var(--text-secondary);
    margin-bottom: var(--space-xl);
}

/* ============================================
   Modal
   ============================================ */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.modal-backdrop.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--surface);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    max-width: 480px;
    width: calc(100% - var(--space-xl));
    text-align: center;
    transform: scale(0.95) translateY(20px);
    transition: transform var(--transition-base);
}

.modal-backdrop.show .modal-content {
    transform: scale(1) translateY(0);
}

.modal-icon {
    font-size: 48px;
    margin-bottom: var(--space-md);
}

.modal-title {
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-md);
}

.modal-message {
    font-size: var(--font-size-base);
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: var(--space-xl);
}

.modal-content.modal-scrollable {
    max-width: 760px;
    max-height: 85vh;
    overflow-y: auto;
    text-align: left;
}

.modal-content.modal-scrollable .modal-icon {
    font-size: 32px;
    margin-bottom: var(--space-sm);
}

.modal-content.modal-scrollable .modal-title {
    margin-bottom: var(--space-sm);
}

.modal-message.modal-message-rich {
    margin-bottom: var(--space-lg);
}

.modal-message.modal-message-rich p {
    margin: 0 0 var(--space-md) 0;
}

.modal-message.modal-message-rich h4 {
    margin: var(--space-md) 0 var(--space-xs) 0;
    color: var(--text-primary);
    font-size: var(--font-size-base);
    font-weight: 600;
}

.modal-close {
    min-width: 120px;
}

/* ============================================
   Logo
   ============================================ */
.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    margin-bottom: var(--space-xl);
}

.logo svg {
    width: 100%;
    height: 100%;
}

.logo .brand-image-logo {
    display: block;
    width: 110px;
    height: auto;
    max-width: 100%;
}

/* ============================================
   Loading State
   ============================================ */
.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    color: var(--text-muted);
}

.loading-dots {
    display: flex;
    gap: 8px;
    margin-bottom: var(--space-md);
}

.loading-dot {
    width: 12px;
    height: 12px;
    background: #374151;
    border-radius: 50%;
    animation: dotPulse 1.4s ease-in-out infinite;
}

.loading-dot:nth-child(1) {
    animation-delay: 0s;
}

.loading-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dotPulse {
    0%, 80%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    40% {
        transform: scale(1.3);
        opacity: 0.8;
    }
}

.loading-text-container {
    color: #6b7280;
    font-size: var(--font-size-base);
    min-height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
}

.loading-text {
    opacity: 1;
    transition: opacity 300ms ease;
}

.loading-text.fade-out {
    opacity: 0;
}

/* Reduced motion: disable animations */
@media (prefers-reduced-motion: reduce) {
    .loading-dot {
        animation: none;
        opacity: 1;
        transform: scale(1);
    }
    
    .loading-text,
    .loading-text.fade-out {
        opacity: 1;
        transition: none;
    }
}

/* ============================================
   Email Lookup (Initial Screen)
   ============================================ */
.email-lookup-wrapper {
    width: 100%;
    max-width: 440px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.step.active .email-lookup-wrapper .step-title {
    animation: fadeSlideIn 400ms ease forwards;
    animation-delay: 0ms;
    opacity: 0;
}

.step.active .email-lookup-wrapper .step-description {
    animation: fadeSlideIn 400ms ease forwards;
    animation-delay: 80ms;
    opacity: 0;
}

.step.active .email-lookup-card {
    animation: fadeSlideIn 400ms ease forwards;
    animation-delay: 160ms;
    opacity: 0;
}

.email-lookup-card {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: var(--space-xl);
    text-align: center;
}

.email-lookup-title {
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.email-lookup-subtitle {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-xl);
}

.email-lookup-form {
    text-align: left;
}

.email-lookup-message {
    display: none;
    padding: var(--space-md);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    margin-top: var(--space-md);
}

.email-lookup-message.error {
    display: block;
    background: var(--error-light);
    color: var(--error);
}

.email-lookup-message.error a {
    color: var(--error);
    text-decoration: underline;
    font-weight: 500;
}

.email-lookup-message.error a:hover {
    text-decoration: none;
}

.email-lookup-message.success {
    display: block;
    background: var(--success-light);
    color: var(--success);
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 768px) {
    .form-header {
        padding: 12px 16px;
    }
    
    .header-content {
        max-width: 100%;
        padding: 0;
    }
    
    .progress-bar {
        width: 120px;
    }
    
    .form-app {
        padding: var(--space-lg);
        padding-top: 70px;
    }
    
    .step-title {
        font-size: var(--font-size-xl);
    }
    
    .step-description {
        font-size: var(--font-size-sm);
    }
    
    .form-card {
        padding: var(--space-lg);
        border-radius: var(--radius-lg);
    }
    
    .form-card .step-title {
        font-size: var(--font-size-lg);
    }
    
    .btn-primary {
        width: 100%;
        min-width: auto;
    }
    
    .btn-secondary {
        width: 100%;
    }
    
    .fields-row {
        flex-direction: column;
    }
    
    .field-half,
    .field-quarter,
    .field-three-quarter {
        flex: 1 1 100%;
        min-width: 100%;
    }
    
    .choice-label {
        padding: 12px 14px;
    }
    
    .choice-text {
        font-size: var(--font-size-sm);
    }
}

@media (max-width: 480px) {
    .form-header {
        padding: 12px 12px;
    }
    
    .progress-bar {
        width: 80px;
    }
    
    .form-logo {
        font-size: 13px;
        gap: 6px;
    }

    .form-logo.form-logo-brand-image {
        gap: 0;
    }

    .form-logo.form-logo-brand-image .brand-text-logo {
        height: 22px;
        width: auto;
        aspect-ratio: 626.0417 / 79.1667;
    }
    
    .logo-icon {
        width: 16px;
        height: 16px;
    }
    
    .form-app {
        padding: var(--space-md);
        padding-top: 70px;
    }
    
    .step-title {
        font-size: var(--font-size-lg);
    }
    
    .logo {
        width: 64px;
        height: 64px;
    }
    
    .success-icon {
        width: 64px;
        height: 64px;
        font-size: 28px;
    }
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    .form-header,
    .step-actions {
        display: none;
    }
    
    .form-app {
        min-height: auto;
        padding: 0;
        padding-top: 0;
    }
}

/* ============================================
   Accessibility
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible for keyboard navigation */
.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.choice-label:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Remove outline for input fields - they already have border color change */
.input-field:focus-visible,
.select-field:focus-visible,
.textarea-field:focus-visible {
    outline: none;
}

/* Skip Link */
.skip-link {
    display: none;
}

