* { margin:0; padding:0; box-sizing:border-box; }

:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-glow: rgba(79, 70, 229, 0.5);
    --primary-soft: rgba(79, 70, 229, 0.1);
    --success: #10b981;
    --success-dark: #059669;
    --success-glow: rgba(16, 185, 129, 0.5);
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg-dark: #0b1220;
    --bg-panel: rgba(30, 41, 59, 0.85);
    --bg-input: rgba(15, 23, 42, 0.8);
    --border: rgba(226, 232, 240, 0.1);
    --text: #ffffff;
    --text-muted: rgba(248, 250, 252, 0.68);
    --text-dim: rgba(248, 250, 252, 0.42);
    --shadow-lg: 0 25px 50px -12px rgba(15, 23, 42, 0.6);
    --transition: cubic-bezier(0.34, 1.56, 0.64, 1);
}

html, body {
    width: 100%;
    min-height: 100vh;
    background: var(--bg-dark);
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 15% 20%, rgba(79, 70, 229, 0.15), transparent 40%),
        radial-gradient(circle at 85% 80%, rgba(124, 58, 237, 0.1), transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(14, 165, 233, 0.08), transparent 50%);
    pointer-events: none;
    z-index: 0;
    animation: bgPulse 8s ease-in-out infinite;
}

@keyframes bgPulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

.particles {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--primary);
    border-radius: 50%;
    opacity: 0.3;
    animation: float 15s infinite ease-in-out;
    box-shadow: 0 0 10px var(--primary);
}

@keyframes float {
    0%, 100% { transform: translateY(100vh) translateX(0); opacity: 0; }
    10% { opacity: 0.5; }
    90% { opacity: 0.5; }
    100% { transform: translateY(-100px) translateX(50px); opacity: 0; }
}

.login-container {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 460px;
    background: var(--bg-panel);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid var(--border);
    border-radius: 28px;
    padding: 40px 36px;
    box-shadow: var(--shadow-lg), 0 0 80px rgba(79, 70, 229, 0.15);
    animation: containerIn 0.8s var(--transition);
    overflow: hidden;
}

@keyframes containerIn {
    from { opacity: 0; transform: translateY(40px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-container::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark), var(--primary));
    background-size: 200% 100%;
    animation: gradientMove 3s linear infinite;
}

@keyframes gradientMove {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

.logo {
    text-align: center;
    margin-bottom: 28px;
}

.logo-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 16px;
    border-radius: 20px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    box-shadow: none;
    animation: logoFloat 3s ease-in-out infinite;
    position: relative;
    overflow: hidden;
}

.logo-icon::before {
    content: '';
    position: absolute;
    inset: 0;
    background: transparent;
    transform: translateX(-100%);
    animation: logoShine 3s ease-in-out infinite;
}

@keyframes logoShine {
    0%, 100% { transform: translateX(-100%); }
    50% { transform: translateX(100%); }
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.logo h1 {
    font-size: 24px;
    font-weight: 800;
    background: linear-gradient(135deg, #fff, var(--text-muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 6px;
    letter-spacing: 0.3px;
}

.logo p {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
}

.tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 14px;
    padding: 5px;
    margin-bottom: 24px;
    position: relative;
}

.tab {
    flex: 1;
    padding: 11px;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.3s var(--transition);
    user-select: none;
    position: relative;
    z-index: 2;
}

.tab.active { color: white; }

.tab-indicator {
    position: absolute;
    top: 5px;
    bottom: 5px;
    width: calc(50% - 5px);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 10px;
    transition: all 0.4s var(--transition);
    box-shadow: 0 4px 16px var(--primary-glow);
    z-index: 1;
}

.tab-indicator.right { right: 5px; }
.tab-indicator.left { right: calc(50%); }

.form-content { transition: all 0.3s; }

.form-group {
    margin-bottom: 14px;
    animation: fieldIn 0.4s var(--transition);
}

@keyframes fieldIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
    letter-spacing: 0.3px;
}

.form-group label .required { color: var(--danger); }

.input-wrapper { position: relative; }

.input-wrapper .input-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    pointer-events: none;
    opacity: 0.5;
    transition: opacity 0.3s;
}

.input-wrapper input {
    width: 100%;
    padding: 14px 48px 14px 48px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 14px;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    transition: all 0.25s;
    outline: none;
}

.input-wrapper input:focus {
    border-color: var(--primary);
    background: rgba(15, 23, 42, 0.95);
    box-shadow: 0 0 0 4px var(--primary-soft);
}

.input-wrapper input:focus + .input-icon,
.input-wrapper input:not(:placeholder-shown) + .input-icon {
    opacity: 1;
}

.input-wrapper input::placeholder { color: var(--text-dim); }

.password-toggle {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 8px;
    transition: all 0.2s;
    font-size: 16px;
    font-family: inherit;
    z-index: 2;
    line-height: 1;
}

.password-toggle:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
}

/* Password Strength */
.password-strength {
    margin-top: 8px;
    display: none;
}

.password-strength.show { display: block; }

.strength-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 8px;
}

.strength-fill {
    height: 100%;
    width: 0%;
    border-radius: 2px;
    transition: all 0.3s;
}

.strength-fill.weak { width: 33%; background: var(--danger); }
.strength-fill.medium { width: 66%; background: var(--warning); }
.strength-fill.strong { width: 100%; background: var(--success); }

.strength-text {
    font-size: 11px;
    font-weight: 600;
    text-align: right;
}

.strength-text.weak { color: var(--danger); }
.strength-text.medium { color: var(--warning); }
.strength-text.strong { color: var(--success); }

.password-requirements {
    margin-top: 8px;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    font-size: 11px;
    display: none;
}

.password-requirements.show { display: block; }

.requirement {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-dim);
    margin: 3px 0;
    transition: color 0.2s;
}

.requirement.met { color: var(--success); }

.requirement .check {
    font-size: 12px;
    width: 14px;
    text-align: center;
    font-weight: 700;
}

.error-message, .success-message {
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 14px;
    display: none;
}

.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
    animation: shake 0.4s;
}

.success-message {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--success);
}

.error-message.show, .success-message.show {
    display: flex;
    align-items: center;
    gap: 8px;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

.btn-submit {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s var(--transition);
    box-shadow: 0 8px 24px var(--primary-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 6px;
    position: relative;
    overflow: hidden;
}

.btn-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.6s;
}

.btn-submit:hover::before { left: 100%; }

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px var(--primary-glow);
}

.btn-submit:active { transform: translateY(0) scale(0.98); }
.btn-submit:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-submit .spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: none;
}

.btn-submit.loading .spinner { display: block; }
.btn-submit.loading .btn-text { display: none; }

@keyframes spin { to { transform: rotate(360deg); } }

.btn-secondary {
    width: 100%;
    padding: 13px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 14px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
}

.footer {
    text-align: center;
    margin-top: 20px;
    color: var(--text-dim);
    font-size: 11px;
    line-height: 1.7;
}

.footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.forgot-link {
    text-align: left;
    margin-top: -6px;
    margin-bottom: 14px;
}

.forgot-link a {
    color: var(--primary);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.2s;
}

.forgot-link a:hover { opacity: 0.8; text-decoration: underline; }

.success-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 20px;
}

.success-overlay.show {
    display: flex;
    animation: fadeIn 0.3s;
}

.success-check {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--success), var(--success-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 42px;
    color: white;
    box-shadow: 0 0 40px var(--success-glow);
    animation: checkPop 0.5s var(--transition);
}

@keyframes checkPop {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.success-text {
    color: var(--text);
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    padding: 0 20px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Reset Steps */
.reset-steps {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
}

.step-dot {
    width: 32px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.15);
    transition: all 0.3s;
}

.step-dot.active {
    background: var(--primary);
    box-shadow: 0 0 12px var(--primary-glow);
}

.step-dot.done { background: var(--success); }

.code-inputs {
    display: flex;
    gap: 8px;
    justify-content: center;
    direction: ltr;
    margin: 18px 0;
}

.code-input {
    width: 46px;
    height: 56px;
    background: var(--bg-input);
    border: 2px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    font-family: 'Courier New', monospace;
    transition: all 0.25s;
    outline: none;
}

.code-input:focus {
    border-color: var(--primary);
    background: rgba(15, 23, 42, 0.95);
    box-shadow: 0 0 0 4px var(--primary-soft);
    transform: scale(1.05);
}

.code-input.filled {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.05);
}

.timer-text {
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    margin-bottom: 14px;
}

.timer-text strong { color: var(--primary); font-weight: 700; }

.email-display {
    text-align: center;
    background: rgba(79, 70, 229, 0.08);
    border: 1px solid rgba(79, 70, 229, 0.2);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 18px;
    font-size: 13px;
    color: var(--text);
}

.email-display strong { color: var(--primary); }

.step-title {
    text-align: center;
    margin-bottom: 18px;
}

.step-title .icon {
    font-size: 40px;
    margin-bottom: 8px;
}

.step-title h2 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 6px;
}

.step-title p {
    color: var(--text-muted);
    font-size: 12px;
}

@media (max-width: 480px) {
    .login-container { padding: 28px 22px; border-radius: 24px; }
    .logo-icon { width: 60px; height: 60px; font-size: 30px; }
    .logo h1 { font-size: 20px; }
    .code-input { width: 40px; height: 50px; font-size: 18px; }
    .input-wrapper input { padding: 14px 44px 14px 44px; }
    .password-toggle { left: 12px; font-size: 15px; }
}


/* 🆕 دکمه بازگشت به صفحه اصلی */
.back-home {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
    padding: 13px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 14px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.25s;
}

.back-home:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 8px 24px var(--primary-soft);
}

.back-home:active {
    transform: translateY(0) scale(0.98);
}

.back-home svg {
    flex-shrink: 0;
}

@media (max-width: 480px) {
    .back-home {
        margin-top: 16px;
        padding: 11px;
        font-size: 12px;
        border-radius: 12px;
    }
}