:root {
    /* پالت رنگی سازمانی */
    --primary-color: #00BCD4;     /* فیروزه‌ای */
    --primary-hover: #0097A7;
    --accent-color: #FF5722;      /* نارنجی */
    --bg-color: #121212;          /* پس‌زمینه اصلی تاریک */
    --surface-color: #1E1E1E;     /* رنگ کارت‌ها */
    --text-color: #E0E0E0;        /* متن روشن */
    --text-light: #BDBDBD;        /* متن کمرنگ‌تر */
    --border-color: #333333;
    --error-color: #FF5252;
    --success-color: #4CAF50;
    --radius: 12px;
    --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

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

body {
    font-family: 'Vazirmatn', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow-x: hidden;
}

.login-container {
    display: flex;
    width: 100%;
    max-width: 1000px;
    background: var(--surface-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    min-height: 600px;
    margin: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.visual-side {
    flex: 1.2;
    background: linear-gradient(135deg, #1E1E1E, #121212);
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
    text-align: center;
    overflow: hidden;
    border-left: 1px solid rgba(255, 255, 255, 0.05);
}

.visual-side::before {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(0,188,212,0.1) 0%, rgba(18,18,18,0) 70%);
    animation: zoomPan 15s infinite alternate;
}

.visual-content { position: relative; z-index: 2; }
.visual-content h2 { font-size: 2.5rem; margin-bottom: 1rem; color: var(--primary-color); }
.visual-content p { font-size: 1.1rem; color: var(--text-light); }

.form-side {
    flex: 1;
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 30px;
    font-weight: bold;
    font-size: 1.5rem;
    color: var(--primary-color);
}

.step {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: absolute;
    width: 85%;
    opacity: 0;
    transform: translateX(30px);
    pointer-events: none;
    visibility: hidden;
}

.step.active {
    position: relative;
    width: 100%;
    opacity: 1;
    transform: translateX(0);
    pointer-events: all;
    visibility: visible;
}

.step-title { font-size: 1.5rem; margin-bottom: 10px; color: var(--text-color); }
.step-desc { color: var(--text-light); margin-bottom: 30px; font-size: 0.95rem; line-height: 1.6; }
.highlight-text { color: var(--accent-color); font-weight: bold; }

.input-group { margin-bottom: 20px; position: relative; }

.input-field {
    width: 100%;
    padding: 16px;
    background: #2A2A2A;
    color: var(--text-color);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-family: 'Vazirmatn', sans-serif;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.input-field:focus { border-color: var(--primary-color); background: #333333; }

.btn {
    width: 100%;
    padding: 16px;
    background-color: var(--primary-color);
    color: #121212;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: bold;
    font-family: 'Vazirmatn', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.btn:hover { background-color: var(--primary-hover); transform: translateY(-2px); }
.btn:disabled { background-color: var(--border-color); color: var(--text-light); cursor: not-allowed; transform: none; }

.btn-text { background: none; color: var(--text-light); padding: 10px; font-size: 0.9rem; margin-top: 10px; border: none; width: 100%; cursor: pointer;}
.btn-text:hover { color: var(--primary-color); }

.otp-container { display: flex; gap: 10px; margin-bottom: 25px; direction: ltr; }
.otp-input {
    width: 100%;
    height: 60px;
    font-size: 1.5rem;
    text-align: center;
    background: #2A2A2A;
    color: var(--text-color);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.3s;
}
.otp-input:focus { border-color: var(--primary-color); box-shadow: 0 0 0 4px rgba(0, 188, 212, 0.1); transform: scale(1.05); }

.timer-section {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-bottom: 25px;
    font-size: 0.9rem;
    background: #2A2A2A;
    padding: 12px;
    border-radius: 8px;
}
.timer-count { font-weight: bold; color: var(--accent-color); direction: ltr; }
.resend-link { color: var(--primary-color); font-weight: bold; cursor: pointer; border: none; background: none; }
.resend-link:disabled { color: var(--text-light); cursor: not-allowed; }

/* استایل آپلود فایل */
.file-upload-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 15px;
    background: rgba(0, 188, 212, 0.1);
    color: var(--primary-color);
    border: 2px dashed var(--primary-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.3s;
}
.file-upload-label:hover { background: rgba(0, 188, 212, 0.2); }
.file-name { margin-top: 10px; font-size: 0.85rem; color: var(--text-light); text-align: center; }

.toast-container { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 1000; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--surface-color); color: var(--text-color); padding: 12px 24px; border-radius: 8px; border: 1px solid var(--border-color); box-shadow: var(--shadow); display: flex; align-items: center; gap: 10px; font-size: 0.9rem; animation: slideDown 0.3s forwards; }
.toast.success { border-right: 4px solid var(--success-color); }
.toast.error { border-right: 4px solid var(--error-color); }

.spinner { width: 20px; height: 20px; border: 3px solid rgba(0,0,0,0.3); border-radius: 50%; border-top-color: #121212; animation: spin 0.8s linear infinite; display: none; }
.btn.loading .spinner { display: block; }
.btn.loading span { display: none; }

@keyframes slideDown { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeOutUp { to { opacity: 0; transform: translateY(-20px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes zoomPan { 0% { transform: scale(1); } 100% { transform: scale(1.1); } }

@media (max-width: 768px) {
    .login-container { flex-direction: column; margin: 0; min-height: 100vh; border-radius: 0; border: none; }
    .visual-side { flex: 0 0 120px; padding: 20px; }
    .visual-side h2 { font-size: 1.5rem; }
    .visual-side p { display: none; }
    .form-side { border-top-left-radius: 20px; border-top-right-radius: 20px; margin-top: -20px; background: var(--surface-color); padding: 30px 20px; }
    .otp-container { gap: 8px; }
    .otp-input { height: 52px; font-size: 1.25rem; }
    .visual-content h2 { font-size: 1.5rem; }
    .step-title { font-size: 1.25rem; }
    .brand-logo { font-size: 1.3rem; margin-bottom: 20px; }
}

/* === Small Mobile Fixes === */
@media (max-width: 480px) {
    .otp-container { gap: 6px; }
    .otp-input { height: 48px; font-size: 1.1rem; }
    .input-field { padding: 14px; font-size: 0.95rem; }
    .btn { padding: 14px; font-size: 0.95rem; }
    .btn-text { padding: 12px; font-size: 0.85rem; min-height: 44px; }
    .resend-link { padding: 6px 10px; min-height: 36px; }
    .timer-section { padding: 10px; font-size: 0.85rem; }
    .form-side { padding: 25px 16px; }
    .visual-side { flex: 0 0 100px; padding: 15px; }
    .visual-content h2 { font-size: 1.3rem; }
    .step-title { font-size: 1.1rem; }
    .step-desc { font-size: 0.85rem; margin-bottom: 20px; }
    .input-group { margin-bottom: 15px; }
    .input-group[style*="flex"] { flex-direction: column !important; }
    .file-upload-label { padding: 12px; font-size: 0.9rem; }
    .brand-logo { font-size: 1.2rem; margin-bottom: 18px; }
}

@media (max-width: 360px) {
    .otp-container { gap: 4px; }
    .otp-input { height: 44px; font-size: 1rem; }
    .form-side { padding: 20px 12px; }
}

/* === F2: Additional fixes for login page === */

/* iOS zoom prevention — 16px font for all inputs on mobile */
@media (max-width: 768px) {
    .input-field,
    .otp-input {
        font-family: 'Vazirmatn', sans-serif;
    }
    /* input-field is already 1rem (16px) — keep it. OTP inputs are larger display fonts. */
}

/* Touch-friendly: 44x44 min for buttons */
@media (max-width: 768px) {
    .btn { min-height: 48px; }
    .btn-text { min-height: 44px; display: flex; align-items: center; justify-content: center; }
    .resend-link { min-height: 36px; display: inline-flex; align-items: center; padding: 6px 10px; }
    .file-upload-label { min-height: 48px; }
}

/* Better stacking for province/city row on small screens */
@media (max-width: 600px) {
    .input-group[style*="display: flex"][style*="gap: 10px"] {
        flex-direction: column !important;
        gap: 10px !important;
    }
    .input-group[style*="display: flex"][style*="gap: 10px"] > select {
        width: 100% !important;
        flex: none !important;
    }
}

/* OTP container: prevent overflow on very narrow screens */
@media (max-width: 380px) {
    .otp-container { gap: 4px; }
    .otp-input { height: 44px; font-size: 1rem; padding: 4px; }
}

/* Form-side padding adjustments */
@media (max-width: 360px) {
    .form-side { padding: 16px 10px; }
    .visual-side { flex: 0 0 80px; padding: 12px; }
    .visual-content h2 { font-size: 1.1rem; }
    .step-title { font-size: 1rem; }
    .brand-logo { font-size: 1.1rem; margin-bottom: 14px; }
    .btn { padding: 12px; font-size: 0.9rem; }
}

/* ============================================
   Tabbed Login Interface
   ============================================ */
.auth-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    background: #2A2A2A;
    padding: 4px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}
.auth-tab {
    flex: 1;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 44px;
}
.auth-tab:hover {
    color: var(--text-color);
}
.auth-tab.active {
    background: #333333;
    color: var(--primary-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.auth-tab-content { display: none; }
.auth-tab-content.active { display: block; }

/* ===== Password field with toggle ===== */
.password-group {
    position: relative;
}
.password-group .input-field {
    padding-left: 44px !important;
}
.toggle-password {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    padding: 4px;
    border-radius: 4px;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.toggle-password:hover { color: var(--primary-color); }

/* ===== Captcha ===== */
.captcha-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 20px;
}
.captcha-img {
    height: 45px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    flex-shrink: 0;
    background: #fff;
}
.captcha-refresh {
    background: #2A2A2A;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px;
    cursor: pointer;
    color: var(--text-light);
    flex-shrink: 0;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
}
.captcha-refresh:hover {
    background: #333333;
    color: var(--primary-color);
}
.captcha-input {
    flex: 1;
    text-align: center;
    font-weight: bold;
    letter-spacing: 2px;
    text-transform: lowercase;
}

/* ===== Forgot password link ===== */
.forgot-link {
    display: block;
    text-align: center;
    margin-top: 12px;
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s;
}
.forgot-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* ===== Password strength indicator ===== */
.password-strength {
    height: 4px;
    border-radius: 2px;
    margin-top: -12px;
    margin-bottom: 16px;
    background: var(--border-color);
    overflow: hidden;
}
.password-strength-bar {
    height: 100%;
    width: 0%;
    transition: width 0.3s ease, background 0.3s ease;
}

/* ===== Mobile adjustments for tabs and captcha ===== */
@media (max-width: 768px) {
    .auth-tab { font-size: 0.85rem; padding: 10px 8px; }
    .captcha-row { flex-wrap: wrap; }
    .captcha-img { height: 42px; }
}

@media (max-width: 480px) {
    .auth-tab { font-size: 0.8rem; padding: 10px 6px; }
    .captcha-input { font-size: 0.9rem; padding: 12px; }
    .captcha-img { height: 40px; }
    .password-group .input-field { padding-left: 40px !important; }
}
