/* ==========================================================================
   صفحات احراز هویت (Login / Register)
   ========================================================================== */

/* پس‌زمینه صفحه */
body.auth-page {
    background: linear-gradient(135deg, var(--primary-50) 0%, var(--secondary-light) 100%);
    min-height: 100vh;
}

/* کانتینر اصلی */
.auth-container {
    max-width: 520px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.auth-container-wide {
    max-width: 640px;
}

/* کارت اصلی */
.auth-card {
    background: white;
    padding: 30px 25px;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(214, 51, 132, 0.15);
    border: 1px solid rgba(214, 51, 132, 0.05);
}

/* هدر کارت */
.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: var(--radius-circle);
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: white;
    box-shadow: 0 10px 25px rgba(214, 51, 132, 0.3);
}

.auth-title {
    font-size: var(--text-2xl);
    font-weight: 900;
    color: var(--text-dark);
    margin: 0 0 8px;
}

.auth-subtitle {
    color: var(--text-medium);
    font-size: var(--text-sm);
    margin: 0;
    line-height: 1.6;
}

/* باکس اطلاعات next_url */
.auth-next-hint {
    background: var(--info-light);
    color: #1e40af;
    padding: 12px;
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    margin-top: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

/* ==========================================================================
   فیلدهای فرم
   ========================================================================== */
.auth-form-group {
    margin-bottom: 20px;
}

.auth-form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
    color: var(--text-dark);
    font-size: var(--text-sm);
}

.auth-form-label .required {
    color: var(--danger);
    margin-right: 3px;
}

.auth-form-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 16px; /* جلوگیری از زوم خودکار iOS */
    background: white;
    transition: all var(--transition-fast);
    min-height: 52px;
    box-sizing: border-box;
}

.auth-form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(214, 51, 132, 0.1);
}

.auth-form-input.ltr {
    direction: ltr;
    text-align: left;
}

.auth-form-input.otp {
    text-align: center;
    direction: ltr;
    letter-spacing: 8px;
    font-size: 20px;
    font-weight: 900;
    font-family: monospace;
}

.auth-form-hint {
    color: var(--text-light);
    font-size: 11px;
    margin-top: 6px;
    display: block;
    line-height: 1.5;
}

/* ==========================================================================
   انتخاب نقش (Role Selection Cards)
   ========================================================================== */
.role-selection-label {
    display: block;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 12px;
    font-size: var(--text-sm);
}

.role-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.role-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: var(--bg-light);
    border-radius: var(--radius-md);
    cursor: pointer;
    border: 2px solid transparent;
    transition: all var(--transition-fast);
    min-height: 64px;
}

.role-card:hover {
    background: var(--primary-50);
    border-color: var(--primary-light);
}

.role-card.selected {
    background: linear-gradient(135deg, var(--primary-50) 0%, var(--secondary-light) 100%);
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(214, 51, 132, 0.15);
}

.role-card input[type="radio"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
    flex-shrink: 0;
}

.role-card-icon {
    font-size: 1.8rem;
    flex-shrink: 0;
    width: 40px;
    text-align: center;
}

.role-card-content {
    flex: 1;
    min-width: 0;
}

.role-card-title {
    font-weight: 900;
    color: var(--text-dark);
    font-size: var(--text-base);
    margin-bottom: 2px;
}

.role-card-description {
    font-size: 11px;
    color: var(--text-light);
    line-height: 1.4;
}

/* ==========================================================================
   📍 بخش نقشه (Neshan Map) - یکپارچه و تمیز
   ========================================================================== */
.map-section {
    margin-bottom: 25px;
}

.map-container {
    width: 100%;
    height: 300px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
    margin-bottom: 12px;
    overflow: hidden;
    background: var(--bg-light);
    position: relative;
    z-index: 0;
}

/* لودینگ نقشه */
.map-container::before {
    content: '🗺️ در حال بارگذاری نقشه...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-medium);
    font-size: 14px;
    font-weight: 600;
    z-index: 1;
    background: rgba(255, 255, 255, 0.9);
    padding: 15px 25px;
    border-radius: 8px;
}

.map-container.loaded::before {
    display: none;
}

/* دکمه‌های نقشه */
.map-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.map-locate-btn {
    flex: 1;
    padding: 12px 16px;
    background: white;
    color: var(--primary);
    border: 2px solid var(--primary);
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all var(--transition-base);
    font-family: inherit;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.map-locate-btn:hover:not(:disabled) {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(214, 51, 132, 0.25);
}

.map-locate-btn.success {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.map-locate-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* نمایش مختصات */
.coordinates-display {
    background: var(--bg-light);
    padding: 10px 15px;
    border-radius: var(--radius-md);
    font-size: 12px;
    color: var(--text-medium);
    text-align: center;
    direction: ltr;
    font-family: monospace;
    margin-top: 8px;
    display: none;
}

.coordinates-display.active {
    display: block;
}

/* استایل‌های نشانگر Leaflet/Neshan */
.leaflet-marker-icon {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* ==========================================================================
   دکمه اصلی
   ========================================================================== */
.auth-submit-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 900;
    font-size: var(--text-lg);
    cursor: pointer;
    transition: all var(--transition-base);
    min-height: 56px;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(214, 51, 132, 0.3);
    margin-top: 10px;
}

.auth-submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(214, 51, 132, 0.4);
}

.auth-submit-btn:active:not(:disabled) {
    transform: scale(0.98);
}

.auth-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* ==========================================================================
   لینک‌های پایین کارت
   ========================================================================== */
.auth-footer {
    text-align: center;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.auth-footer-text {
    color: var(--text-medium);
    font-size: var(--text-sm);
    margin: 0;
}

.auth-footer-link {
    color: var(--primary);
    font-weight: 900;
    text-decoration: none;
    transition: color var(--transition-fast);
}

.auth-footer-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* ==========================================================================
   📱 ریسپانسیو - موبایل کوچک (زیر 480px)
   ========================================================================== */
@media (max-width: 479px) {
    .auth-container {
        padding: 15px;
    }
    
    .auth-card {
        padding: 25px 20px;
    }
    
    .auth-icon {
        width: 70px;
        height: 70px;
        font-size: 2.2rem;
    }
    
    .map-container {
        height: 250px;
    }
    
    .map-locate-btn {
        font-size: 12px;
        padding: 10px 12px;
        min-height: 44px;
    }
    
    .map-actions {
        flex-direction: column;
    }
}

/* ==========================================================================
   📱 ریسپانسیو - موبایل (480px تا 767px)
   ========================================================================== */
@media (min-width: 480px) and (max-width: 767px) {
    .map-container {
        height: 280px;
    }
    
    .map-actions {
        flex-direction: column;
    }
}

/* ==========================================================================
   💻 ریسپانسیو - تبلت (768px تا 1023px)
   ========================================================================== */
@media (min-width: 768px) and (max-width: 1023px) {
    .auth-container {
        padding: 40px 20px;
    }
    
    .auth-card {
        padding: 40px 35px;
    }
    
    .auth-title {
        font-size: var(--text-3xl);
    }
    
    .auth-icon {
        width: 90px;
        height: 90px;
        font-size: 2.8rem;
    }
    
    .map-container {
        height: 320px;
    }
}

/* ==========================================================================
   🖥️ ریسپانسیو - دسکتاپ (1024px به بالا)
   ========================================================================== */
@media (min-width: 1024px) {
    .auth-container {
        padding: 50px 20px;
    }
    
    .auth-card {
        padding: 45px 40px;
    }
    
    .auth-title {
        font-size: 2.2rem;
    }
    
    .auth-icon {
        width: 100px;
        height: 100px;
        font-size: 3rem;
    }
    
    .map-container {
        height: 380px;
    }
    
    .map-locate-btn {
        min-height: 52px;
    }
}

/* ==========================================================================
   🎯 بهینه‌سازی لمسی (موبایل)
   ========================================================================== */
@media (hover: none) and (pointer: coarse) {
    .auth-form-input,
    .auth-submit-btn,
    .map-locate-btn,
    .role-card {
        min-height: 52px;
    }
    
    .role-card:hover {
        background: var(--bg-light);
        border-color: transparent;
    }
    
    .role-card.selected:hover {
        background: linear-gradient(135deg, var(--primary-50) 0%, var(--secondary-light) 100%);
        border-color: var(--primary);
    }
    
    .map-container {
        height: 300px;
    }
}