:root {
    --bg: #f8fafc;
    --surface: #ffffff;
    --text: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --danger: #ef4444;
    --success: #22c55e;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

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

html {
    min-width: 320px;
    background: var(--bg);
}

body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: max(20px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
    color: var(--text);
    background: var(--bg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.auth-card {
    width: min(100%, 440px);
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.auth-header {
    padding: 32px 28px 28px;
    color: white;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.auth-header h1 {
    margin: 0 0 8px;
    font-size: 24px;
    font-weight: 700;
}

.auth-header p {
    margin: 0;
    opacity: 0.9;
    font-size: 14px;
}

.auth-body {
    padding: 28px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
}

.form-control {
    width: 100%;
    min-height: 48px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    background: var(--surface);
    font: inherit;
    font-size: 14px;
    transition: all 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.help-text,
.form-hint,
small {
    display: block;
    margin-top: 8px;
    color: var(--text-secondary);
    font-size: 13px;
}

.form-actions {
    margin-top: 24px;
}

.btn {
    width: 100%;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    background: var(--primary);
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:hover {
    background: var(--primary-dark);
}

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

.form-footer {
    display: grid;
    gap: 8px;
    margin-top: 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

.form-footer p {
    margin: 0;
}

.form-footer a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

.form-footer a:hover {
    text-decoration: underline;
}

.error-message,
.success-message {
    display: none;
    margin-bottom: 20px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
}

.error-message {
    color: #dc2626;
    background: #fee2e2;
    border: 1px solid #fecaca;
}

.success-message {
    color: #16a34a;
    background: #dcfce7;
    border: 1px solid #bbf7d0;
}

.loading {
    display: none;
    margin-top: 16px;
    color: var(--text-secondary);
    text-align: center;
    font-size: 14px;
}

.loading::after {
    content: "";
    display: inline-block;
    width: 18px;
    height: 18px;
    margin-left: 8px;
    border: 2px solid rgba(59, 130, 246, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    vertical-align: middle;
    animation: spin 0.8s linear infinite;
}

.password-strength {
    height: 6px;
    margin-top: 10px;
    overflow: hidden;
    background: var(--border);
    border-radius: 99px;
}

.password-strength-bar {
    width: 0;
    height: 100%;
    transition: width 0.2s ease;
    border-radius: 99px;
}

.strength-weak {
    background: var(--danger);
}

.strength-medium {
    background: #f59e0b;
}

.strength-strong {
    background: var(--success);
}

.password-requirements {
    margin-top: 12px;
    color: var(--text-secondary);
    font-size: 13px;
}

.password-requirements ul {
    margin: 8px 0 0;
    padding-left: 20px;
}

.password-requirements li {
    margin-bottom: 4px;
}

.password-requirements li.met {
    color: var(--success);
    font-weight: 600;
}

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

@media (max-width: 480px) {
    .auth-card {
        border-radius: var(--radius);
    }

    .auth-header {
        padding: 24px 20px 20px;
    }

    .auth-header h1 {
        font-size: 20px;
    }

    .auth-body {
        padding: 20px;
    }
}
