:root {
    --bg-deep: #020617;
    --glass-bg: rgba(30, 41, 59, 0.6);
    --input-bg: rgba(15, 23, 42, 0.8);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent-primary: #818cf8;
    --accent-glow: #6366f1;
    --danger: #f43f5e;
    --success: #10b981;
    --radius: 16px;
}

* { box-sizing: border-box; outline: none; }

body.auth-page {
    font-family: 'Vazirmatn', sans-serif;
    background-color: var(--bg-deep);
    color: var(--text-main);
    margin: 0; min-height: 100vh;
    display: flex; flex-direction: column;
    overflow-x: hidden;
}

/* افکت پس‌زمینه (مشابه لاگین) */
.bg-glow-1, .bg-glow-2 { position: fixed; border-radius: 50%; filter: blur(100px); z-index: -1; opacity: 0.3; }
.bg-glow-1 { top: -10%; right: -5%; width: 50vw; height: 50vw; background: radial-gradient(circle, var(--accent-primary), transparent 70%); }
.bg-glow-2 { bottom: -10%; left: -10%; width: 60vw; height: 60vw; background: radial-gradient(circle, var(--accent-glow), transparent 70%); }

.page-wrapper { flex: 1; display: grid; place-items: center; padding: 2rem 1rem; }

.form-container {
    width: 100%; max-width: 600px; /* کمی عریض‌تر برای گرید ۲ ستونه */
    background: var(--glass-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    padding: 2.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: fadeUp 0.6s ease-out;
    position: relative; overflow: hidden;
}
.form-container::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 4px; background: linear-gradient(90deg, var(--accent-primary), var(--accent-glow)); }

@keyframes fadeUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }

/* هدر */
.form-header { text-align: center; margin-bottom: 2rem; }
.icon-header {
    width: 60px; height: 60px; margin: 0 auto 1rem;
    background: rgba(255,255,255,0.05); border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--border-color); color: var(--accent-primary); font-size: 1.5rem;
    box-shadow: 0 0 15px rgba(129, 140, 248, 0.2);
}
.form-header h1 { font-size: 1.6rem; margin: 0; font-weight: 800; color: white; }
.form-header p { color: var(--text-muted); font-size: 0.9rem; margin-top: 5px; }

/* استپر مراحل */
.stepper { display: flex; justify-content: space-between; margin-bottom: 2rem; position: relative; max-width: 300px; margin-left: auto; margin-right: auto; }
.step { z-index: 2; text-align: center; position: relative; }
.step-number { 
    width: 30px; height: 30px; border-radius: 50%; background: var(--bg-deep); 
    border: 1px solid var(--text-muted); display: flex; justify-content: center; align-items: center; 
    margin: 0 auto 5px; transition: 0.3s; font-weight: bold; color: var(--text-muted);
}
.step-title { font-size: 0.75rem; color: var(--text-muted); transition: 0.3s; }
.step.active .step-number { border-color: var(--accent-primary); background: var(--accent-primary); color: white; box-shadow: 0 0 10px rgba(129, 140, 248, 0.5); }
.step.active .step-title { color: white; }

.stepper-line { position: absolute; top: 15px; left: 0; width: 100%; height: 2px; background: var(--border-color); z-index: 1; }
.stepper-line-progress { height: 100%; background: var(--accent-primary); width: 0%; transition: width 0.5s; }
.step.active ~ .stepper-line .stepper-line-progress { width: 100%; }

/* --- سیستم گرید و اینپوت‌ها --- */
.input-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
.input-wrapper { position: relative; }
.full-width { grid-column: span 2; }

/* لیبل شناور */
.floating-label {
    display: block; margin-bottom: 6px; font-size: 0.85rem; color: var(--text-muted); margin-right: 5px;
}

/* استایل فیلد ورودی (دقیقاً مثل لاگین) */
.form-input {
    width: 100%; padding: 12px 40px 12px 15px; /* فضای راست برای آیکون فارسی */
    background: var(--input-bg); border: 1px solid var(--border-color);
    border-radius: 12px; color: white; font-family: inherit; font-size: 0.95rem;
    transition: all 0.3s ease;
}
.form-input:focus { border-color: var(--accent-primary); box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15); background: rgba(15, 23, 42, 0.95); }

/* textarea */
.textarea-input { min-height: 80px; resize: vertical; padding-top: 12px; }
.input-icon.top-align { top: 25px; transform: none; }

/* --- هندل کردن LTR و جای آیکون‌ها --- */

/* آیکون استاندارد (برای فارسی) -> سمت راست */
.input-icon {
    position: absolute; top: 50%; transform: translateY(10%); /* اصلاح تراز با توجه به لیبل */
    right: 15px; color: var(--text-muted); pointer-events: none; transition: 0.3s;
}
/* آیکون برای فیلد انگلیسی (موبایل/رمز) -> سمت چپ */
.input-icon-left {
    position: absolute; top: 50%; transform: translateY(10%);
    left: 15px; color: var(--text-muted); pointer-events: none; transition: 0.3s;
}
.form-input:focus ~ i { color: var(--accent-primary); }

/* استایل اینپوت چپ‌چین (LTR) */
.ltr-input {
    direction: ltr; text-align: left;
    padding-left: 40px; /* فضای سمت چپ برای آیکون */
    padding-right: 15px;
}
/* اگر دکمه چشم هم داشته باشد، باید سمت راست جا داشته باشد */
.ltr-input.password-input {
    padding-right: 40px; /* فضای سمت راست برای چشم */
}

/* دکمه چشم (همیشه سمت راست در LTR) */
.toggle-password {
    position: absolute; top: 50%; transform: translateY(10%);
    right: 15px; cursor: pointer; color: var(--text-muted); transition: 0.3s;
    padding: 5px; z-index: 5;
}
.toggle-password:hover { color: white; }

/* --- OTP Input --- */
.otp-group { display: flex; justify-content: center; gap: 10px; margin: 1.5rem 0; }
.otp-input {
    width: 48px; height: 54px; text-align: center; font-size: 1.5rem;
    border-radius: 12px; background: var(--input-bg); border: 1px solid var(--border-color);
    color: white; font-weight: bold;
}
.otp-input:focus { border-color: var(--accent-primary); box-shadow: 0 0 15px rgba(129, 140, 248, 0.2); }

/* دکمه‌ها و پیام‌ها */
.submit-btn {
    width: 100%; padding: 14px; margin-top: 10px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-glow));
    color: white; border: none; border-radius: 12px; font-weight: bold; font-size: 1rem;
    cursor: pointer; box-shadow: 0 10px 20px -10px var(--accent-primary); transition: 0.3s;
    display: flex; align-items: center; justify-content: center; gap: 10px;
}
.submit-btn:hover { transform: translateY(-2px); box-shadow: 0 15px 30px -10px var(--accent-primary); }

.alert { padding: 12px; border-radius: 12px; margin-bottom: 20px; font-size: 0.9rem; display: flex; align-items: center; gap: 8px; }
.alert-error { background: rgba(244, 63, 94, 0.1); border: 1px solid rgba(244, 63, 94, 0.3); color: var(--danger); }
.alert-success { background: rgba(16, 185, 129, 0.1); border: 1px solid rgba(16, 185, 129, 0.3); color: var(--success); }

.auth-footer { margin-top: 1.5rem; text-align: center; border-top: 1px solid var(--border-color); padding-top: 1rem; color: var(--text-muted); font-size: 0.9rem; }
.login-link, .retry-link { color: var(--accent-primary); font-weight: bold; margin-right: 5px; transition: 0.3s; }
.login-link:hover, .retry-link:hover { color: var(--accent-glow); text-decoration: underline; }

/* ریسپانسیو */
@media (max-width: 640px) {
    .input-grid { grid-template-columns: 1fr; gap: 1rem; }
    .full-width { grid-column: span 1; }
    .form-container { padding: 1.5rem; }
}