:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --secondary: #64748b;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --background: #f8fafc;
    --surface: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --text-lighter: #94a3b8;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --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);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

.header {
    text-align: center;
    margin-bottom: 40px;
    padding: 40px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--success));
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 12px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header p {
    font-size: 1.2rem;
    color: var(--text-light);
    font-weight: 500;
}

.form-section {
    background: var(--surface);
    padding: 32px;
    margin-bottom: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
    transition: var(--transition);
    position: relative;
}

.form-section:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.form-section h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 24px;
    color: var(--primary);
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 12px;
}

.form-section h3::before {
    content: '';
    width: 4px;
    height: 24px;
    background: var(--primary);
    border-radius: 2px;
}

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

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

.form-group.full-width {
    grid-column: 1 / -1;
}

label {
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.required {
    color: var(--error);
    font-weight: 600;
}

input, select, textarea {
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 16px;
    transition: var(--transition);
    background: var(--surface);
    font-family: inherit;
    width: 100%;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
    transform: translateY(-1px);
}

input:invalid:not(:focus):not(:placeholder-shown) {
    border-color: var(--error);
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 16px;
    padding-right: 48px;
}

textarea {
    resize: vertical;
    min-height: 100px;
}

.field-hint {
    font-size: 13px;
    color: var(--text-lighter);
    margin-top: 6px;
    line-height: 1.4;
}

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

.terms-checkbox {
    background: var(--primary-light);
    padding: 24px;
    margin: 32px 0;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.terms-checkbox:hover {
    background: #e0f2fe;
    transform: translateY(-1px);
}

.terms-checkbox label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-weight: normal;
    cursor: pointer;
    margin: 0;
    font-size: 15px;
}

.terms-checkbox input[type="checkbox"] {
    margin-top: 2px;
    transform: scale(1.2);
    width: auto;
}

button[type="submit"] {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

button[type="submit"]::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

button[type="submit"]:hover::before {
    left: 100%;
}

button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

button[type="submit"]:active {
    transform: translateY(0);
}

button[type="submit"]:disabled {
    background: var(--secondary);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

button[type="submit"]:disabled::before {
    display: none;
}

.loading {
    display: none;
    text-align: center;
    padding: 20px;
    background: var(--warning);
    color: white;
    border-radius: var(--radius);
    margin-bottom: 24px;
    font-weight: 500;
    box-shadow: var(--shadow);
}

.success-message {
    background: var(--success);
    color: white;
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    text-align: center;
    font-weight: 500;
    box-shadow: var(--shadow);
    animation: slideDown 0.3s ease-out;
}

.error-message {
    background: var(--error);
    color: white;
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    text-align: center;
    font-weight: 500;
    box-shadow: var(--shadow);
    animation: slideDown 0.3s ease-out;
}

.form-group .error-message {
    background: transparent;
    color: var(--error);
    padding: 8px 0 0 0;
    margin: 0;
    text-align: left;
    font-size: 13px;
    box-shadow: none;
    animation: none;
}

/* Password field styles */
.password-field {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    color: var(--text-light);
    transition: var(--transition);
    z-index: 2;
}

.password-toggle:hover {
    background: var(--border-light);
    color: var(--primary);
}

.password-toggle:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--primary-light);
}

/* Password strength indicators */
.password-strength {
    font-size: 13px;
    margin-top: 8px;
    font-weight: 500;
    transition: var(--transition);
    padding: 4px 8px;
    border-radius: 4px;
    background: var(--background);
}

.password-strength.weak {
    background: #fee2e2;
    border-left: 3px solid var(--error);
    color: var(--error);
}

.password-strength.fair {
    background: #fef3c7;
    border-left: 3px solid var(--warning);
    color: var(--warning);
}

.password-strength.good,
.password-strength.strong {
    background: #d1fae5;
    border-left: 3px solid var(--success);
    color: var(--success);
}

.password-match {
    font-size: 13px;
    margin-top: 8px;
    font-weight: 500;
    transition: var(--transition);
    padding: 4px 8px;
    border-radius: 4px;
}

/* Make sure password fields have enough padding for the toggle */
.password-field input[type="password"],
.password-field input[type="text"] {
    padding-right: 50px;
}

/* Loading spinner */
.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-right: 8px;
}

/* Progress indicator */
.progress-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 40px;
    position: relative;
    counter-reset: step;
}

.progress-steps::before {
    content: '';
    position: absolute;
    top: 15px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--border);
    z-index: 1;
}

.progress-step {
    position: relative;
    z-index: 2;
    text-align: center;
    flex: 1;
}

.progress-step::before {
    counter-increment: step;
    content: counter(step);
    width: 32px;
    height: 32px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px;
    font-weight: 600;
    color: var(--text-light);
    transition: var(--transition);
}

.progress-step.active::before {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.progress-step.completed::before {
    background: var(--success);
    border-color: var(--success);
    color: white;
    content: '✓';
}

.progress-step span {
    font-size: 14px;
    color: var(--text-light);
    font-weight: 500;
}

.progress-step.active span {
    color: var(--primary);
    font-weight: 600;
}

/* Animations */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.form-section {
    animation: fadeInUp 0.6s ease-out;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 16px;
    }
    
    .container {
        max-width: 100%;
    }
    
    .header {
        padding: 30px 20px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .form-section {
        padding: 24px 20px;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .progress-steps {
        flex-wrap: wrap;
        gap: 16px;
    }
    
    .progress-step {
        flex: none;
        width: calc(50% - 8px);
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.75rem;
    }
    
    .header p {
        font-size: 1rem;
    }
    
    .form-section {
        padding: 20px 16px;
    }
    
    .progress-step {
        width: 100%;
    }
    
    input, select, textarea {
        padding: 12px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Print styles */
@media print {
    .header {
        background: white !important;
        color: black !important;
        box-shadow: none !important;
    }
    
    button {
        display: none;
    }
    
    .form-section {
        break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #ccc !important;
    }
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--border-light);
}

::-webkit-scrollbar-thumb {
    background: var(--secondary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* Focus styles for accessibility */
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border: #000000;
        --text: #000000;
        --background: #ffffff;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}