/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #0052FF;
    --primary-hover: #0041CC;
    --primary-light: #E6EFFF;
    --success-color: #00C853;
    --success-light: #E8F5E9;
    --error-color: #FF3B30;
    --text-primary: #1A1A1A;
    --text-secondary: #6B7280;
    --text-muted: #9CA3AF;
    --bg-primary: #FFFFFF;
    --bg-secondary: #F9FAFB;
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --border-color: #E5E7EB;
    --border-focus: #0052FF;
    --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);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
    background-image: 
        radial-gradient(at 0% 0%, rgba(0, 82, 255, 0.08) 0%, transparent 50%),
        radial-gradient(at 100% 100%, rgba(118, 75, 162, 0.08) 0%, transparent 50%);
}

/* Container */
.container {
    width: 100%;
    max-width: 480px;
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    position: relative;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(180deg, #FFFFFF 0%, #FAFBFC 100%);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    width: 36px;
    height: 36px;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.secure-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--success-light);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--success-color);
}

.secure-badge svg {
    width: 14px;
    height: 14px;
}

/* Progress Bar */
.progress-container {
    padding: 24px 24px 0;
}

.progress-bar {
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 16px;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    border-radius: 2px;
    transition: width 0.5s ease;
    width: 33.33%;
}

.progress-steps {
    display: flex;
    justify-content: space-between;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.step-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--border-color);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
    transition: var(--transition);
}

.progress-step.active .step-circle {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 0 0 4px var(--primary-light);
}

.progress-step.completed .step-circle {
    background: var(--success-color);
    color: white;
}

.progress-step span {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    transition: var(--transition);
}

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

.progress-step.completed span {
    color: var(--success-color);
}

/* Form Steps */
.form-step {
    display: none;
    padding: 32px 24px;
    animation: fadeIn 0.4s ease;
}

.form-step.active {
    display: block;
}

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

.step-content {
    text-align: center;
}

.step-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    background: var(--primary-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.step-icon svg {
    width: 32px;
    height: 32px;
    stroke: var(--primary-color);
}

.step-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.step-description {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    margin-bottom: 32px;
    line-height: 1.6;
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.input-wrapper {
    position: relative;
}

.input-wrapper input {
    width: 100%;
    padding: 14px 16px;
    padding-right: 48px;
    font-size: 1rem;
    font-family: inherit;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: var(--transition);
    -webkit-appearance: none;
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.input-wrapper input::placeholder {
    color: var(--text-muted);
}

.input-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.input-icon svg {
    width: 20px;
    height: 20px;
}

.error-message {
    display: block;
    font-size: 0.8125rem;
    color: var(--error-color);
    margin-top: 8px;
    min-height: 20px;
}

/* Buttons */
.btn-primary,
.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    border: none;
    -webkit-tap-highlight-color: transparent;
}

.btn-primary {
    width: 100%;
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-md);
}

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

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

.btn-primary:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    transform: none;
}

.btn-primary svg,
.btn-secondary svg {
    width: 18px;
    height: 18px;
}

.btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-secondary);
    border-color: var(--text-muted);
}

.button-group {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.button-group .btn-secondary {
    flex: 0 0 auto;
    padding: 14px 20px;
}

.button-group .btn-primary {
    flex: 1;
}

/* Success Animation */
.success-content {
    padding-top: 16px;
}

.success-animation {
    width: 100px;
    height: 100px;
    margin: 0 auto 24px;
}

.checkmark {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    stroke-width: 2;
    stroke: var(--success-color);
    stroke-miterlimit: 10;
    animation: scale 0.3s ease-in-out 0.4s both;
}

.checkmark-circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    stroke-width: 2;
    stroke-miterlimit: 10;
    stroke: var(--success-color);
    fill: var(--success-light);
    animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.checkmark-check {
    transform-origin: 50% 50%;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    stroke-width: 3;
    animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.6s forwards;
}

@keyframes stroke {
    100% {
        stroke-dashoffset: 0;
    }
}

@keyframes scale {
    0%, 100% {
        transform: none;
    }
    50% {
        transform: scale3d(1.1, 1.1, 1);
    }
}

.success-title {
    color: var(--success-color);
}

.success-description {
    color: var(--text-secondary);
}

.success-info {
    margin-top: 32px;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    text-align: left;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.info-item:first-child {
    border-bottom: 1px solid var(--border-color);
}

.info-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: var(--primary-color);
}

/* Footer */
.footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    text-align: center;
}

.footer-security {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-bottom: 8px;
}

.footer-security svg {
    width: 14px;
    height: 14px;
}

.copyright {
    font-size: 0.6875rem;
    color: var(--text-muted);
}

/* Loading State */
.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Mobile Responsive */
@media (max-width: 480px) {
    body {
        padding: 0;
        align-items: flex-start;
    }
    
    .container {
        max-width: 100%;
        min-height: 100vh;
        border-radius: 0;
        box-shadow: none;
    }
    
    .header {
        padding: 16px 20px;
    }
    
    .logo-icon {
        width: 32px;
        height: 32px;
    }
    
    .logo-text {
        font-size: 1.125rem;
    }
    
    .secure-badge span {
        display: none;
    }
    
    .secure-badge {
        padding: 8px;
    }
    
    .progress-container {
        padding: 20px 20px 0;
    }
    
    .step-circle {
        width: 28px;
        height: 28px;
        font-size: 0.8125rem;
    }
    
    .progress-step span {
        font-size: 0.6875rem;
    }
    
    .form-step {
        padding: 24px 20px;
    }
    
    .step-icon {
        width: 56px;
        height: 56px;
    }
    
    .step-icon svg {
        width: 28px;
        height: 28px;
    }
    
    .step-title {
        font-size: 1.25rem;
    }
    
    .step-description {
        font-size: 0.875rem;
        margin-bottom: 24px;
    }
    
    .input-wrapper input {
        padding: 12px 14px;
        padding-right: 44px;
        font-size: 1rem;
    }
    
    .btn-primary,
    .btn-secondary {
        padding: 12px 24px;
        font-size: 0.9375rem;
    }
    
    .button-group {
        flex-direction: column-reverse;
    }
    
    .button-group .btn-secondary {
        width: 100%;
    }
    
    .success-animation {
        width: 80px;
        height: 80px;
    }
    
    .footer {
        padding: 16px 20px;
    }
}

@media (max-width: 360px) {
    .progress-step span {
        display: none;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --text-primary: #F9FAFB;
        --text-secondary: #9CA3AF;
        --text-muted: #6B7280;
        --bg-primary: #1F2937;
        --bg-secondary: #111827;
        --border-color: #374151;
        --primary-light: rgba(0, 82, 255, 0.2);
        --success-light: rgba(0, 200, 83, 0.15);
    }
    
    body {
        background-image: 
            radial-gradient(at 0% 0%, rgba(0, 82, 255, 0.15) 0%, transparent 50%),
            radial-gradient(at 100% 100%, rgba(118, 75, 162, 0.15) 0%, transparent 50%);
    }
    
    .header {
        background: linear-gradient(180deg, #1F2937 0%, #1A2332 100%);
    }
    
    .input-wrapper input {
        background: var(--bg-secondary);
    }
}

/* 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,
input:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Shake animation for validation errors */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

.shake {
    animation: shake 0.5s ease-in-out;
}

.shake input,
input.shake {
    border-color: var(--error-color) !important;
}

/* Input wrapper shake */
.input-wrapper:has(.shake) {
    animation: shake 0.5s ease-in-out;
}
