/**
 * استایل صفحه ورود - طراحی شبیه به baam.bmi.ir
 * با استفاده از فونت کلمه
 * 
 * @package TabaeiAiTests
 */

/* ========== تنظیمات کلی و فونت ========== */

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

body.tabaei-login-page {
    font-family: 'Kalameh', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    direction: rtl;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========== کانتینر اصلی ========== */

.tabaei-login-wrapper {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    box-sizing: border-box;
}

.tabaei-login-container {
    display: grid;
    grid-template-columns: 45% 55%;
    background: #ffffff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 1200px;
    animation: fadeInScale 0.5s ease-out;
}

/* آزمون‌های پر فروش */
.login-bestsellers {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 12px;
    margin: 40px auto 0;
    max-width: 300px;
    justify-items: center;
}

.bestseller-item {
    display: block;
    width: 80px;
    height: 80px;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    text-decoration: none;
}

.bestseller-item:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.bestseller-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.bestseller-placeholder {
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.bestseller-placeholder:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ========== بخش تصویر سمت چپ ========== */

.tabaei-login-image-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
    overflow: hidden;
}

/* انیمیشن پس‌زمینه */
.tabaei-login-image-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: moveBackground 20s linear infinite;
    pointer-events: none;
}

@keyframes moveBackground {
    0% {
        transform: translate(0, 0);
    }
    100% {
        transform: translate(50px, 50px);
    }
}

.login-image-overlay {
    position: relative;
    z-index: 1;
    color: white;
    text-align: center;
    width: 100%;
}

/* برند و لوگو */
.login-brand {
    margin-bottom: 60px;
}

/* تصویر تست - مینیمال و زیبا */
.test-image-container {
    margin: 0 auto 30px;
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.test-image {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 16px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    border: 3px solid rgba(255, 255, 255, 0.9);
    transition: all 0.3s ease;
    animation: fadeIn 0.8s ease-out;
}

.test-image:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.4);
    border-color: white;
}

/* آیکون پیش‌فرض برای تست‌هایی که عکس ندارند */
.test-image-placeholder {
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    animation: fadeIn 0.8s ease-out;
}

.test-image-placeholder:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.login-brand h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 15px;
    color: white;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.login-brand p {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 400;
    line-height: 1.8;
    max-width: 350px;
    margin: 0 auto;
}

/* ویژگی‌ها */
.login-features {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 40px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.feature-item:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateX(-5px);
}

.feature-icon {
    width: 30px;
    height: 30px;
    background: white;
    color: #667eea;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}

.feature-item span {
    font-size: 15px;
    color: white;
    font-weight: 500;
}

/* ========== بخش فرم ورود سمت راست ========== */

.tabaei-login-form-section {
    background: white;
    padding: 30px 50px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow-y: auto;
    max-height: 95vh;
}

.login-form-container {
    width: 100%;
    max-width: 450px;
    margin: 0 auto;
}

/* لوگو در موبایل (پنهان در دسکتاپ) */
.mobile-logo {
    display: none;
    text-align: center;
    margin-bottom: 20px;
    animation: bounceIn 0.6s ease-out;
}

.mobile-logo-image {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(0, 122, 255, 0.3);
    transition: all 0.3s ease;
    animation: fadeIn 0.8s ease-out;
}

.mobile-logo-image:hover {
    border-color: #007AFF;
    transform: scale(1.05);
}

/* هدر فرم */
.login-header {
    margin-bottom: 20px;
    text-align: center;
}

.login-header h2 {
    font-size: 28px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 10px;
}

.login-header .test-title {
    font-size: 16px;
    color: #667eea;
    font-weight: 600;
    margin-bottom: 12px;
    padding: 8px 16px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    border-radius: 8px;
    display: inline-block;
}

.login-header .login-description {
    font-size: 14px;
    color: #6c757d;
    font-weight: 400;
    line-height: 1.6;
}

/* فرم ورود Mobitsh */
.login-form-wrapper {
    margin-bottom: 15px;
}

/* استایل‌دهی به فرم Mobitsh */
.login-form-wrapper .mobitsh-form,
.login-form-wrapper form {
    direction: rtl;
}

.login-form-wrapper input[type="text"],
.login-form-wrapper input[type="tel"],
.login-form-wrapper input[type="password"],
.login-form-wrapper input[type="email"] {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    font-size: 15px;
    font-family: 'Kalameh', sans-serif;
    transition: all 0.3s ease;
    background: #f8f9fa;
    color: #1a1a2e;
}

.login-form-wrapper input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

/* استایل placeholder */
.login-form-wrapper input::placeholder {
    color: #b0b0b0;
    opacity: 1;
    font-family: 'Kalameh', sans-serif;
    font-size: 14px;
    letter-spacing: 0.5px;
}

.login-form-wrapper input::-webkit-input-placeholder {
    color: #b0b0b0;
    opacity: 1;
}

.login-form-wrapper input::-moz-placeholder {
    color: #b0b0b0;
    opacity: 1;
}

.login-form-wrapper input:-ms-input-placeholder {
    color: #b0b0b0;
    opacity: 1;
}

.login-form-wrapper button[type="submit"],
.login-form-wrapper .digit_btn {
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    font-family: 'Kalameh', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.login-form-wrapper button[type="submit"]:hover,
.login-form-wrapper .digit_btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

/* پیام خطا برای عدم نصب Mobitsh */
.mobitsh-not-found {
    text-align: center;
    padding: 20px;
}

.alert {
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    text-align: right;
    line-height: 1.8;
}

.alert-warning {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
}

.btn-alternative-login {
    display: inline-block;
    padding: 12px 30px;
    background: #667eea;
    color: white;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-alternative-login:hover {
    background: #764ba2;
    transform: translateY(-2px);
    color: white;
}

/* دکمه بازگشت */
.login-back-link {
    text-align: center;
    margin-bottom: 15px;
}

.back-to-home {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #6c757d;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.back-to-home:hover {
    color: #667eea;
    transform: translateX(-3px);
}

.back-to-home svg {
    transition: transform 0.3s ease;
}

.back-to-home:hover svg {
    transform: translateX(-3px);
}


/* ========== انیمیشن‌ها ========== */

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* ========== ریسپانسیو - تبلت ========== */

@media (max-width: 1024px) {
    .tabaei-login-wrapper {
        padding: 20px;
    }

    .tabaei-login-container {
        grid-template-columns: 1fr;
        max-width: 550px;
    }

    .tabaei-login-image-section {
        display: none;
    }

    .mobile-logo {
        display: block;
    }

    .tabaei-login-form-section {
        padding: 40px 50px;
    }

    /* آزمون‌های پر فروش در موبایل مخفی شوند */
    .login-bestsellers {
        display: none;
    }
}

/* ========== ریسپانسیو - موبایل ========== */

@media (max-width: 768px) {
    .tabaei-login-wrapper {
        padding: 15px;
    }

    .tabaei-login-container {
        border-radius: 16px;
    }

    .tabaei-login-form-section {
        padding: 35px 30px;
    }

    .login-form-container {
        max-width: 100%;
    }

    .login-header h2 {
        font-size: 24px;
    }

    .login-header .test-title {
        font-size: 14px;
        padding: 6px 12px;
    }

    .login-header .login-description {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .tabaei-login-wrapper {
        padding: 10px;
    }

    .tabaei-login-form-section {
        padding: 25px 20px;
    }

    .login-header {
        margin-bottom: 25px;
    }

    .login-header h2 {
        font-size: 22px;
    }

    .mobile-logo {
        margin-bottom: 20px;
    }

    .mobile-logo svg,
    .mobile-logo-image {
        width: 45px;
        height: 45px;
    }

    .login-form-wrapper input[type="text"],
    .login-form-wrapper input[type="tel"],
    .login-form-wrapper input[type="password"],
    .login-form-wrapper input[type="email"] {
        padding: 10px 14px;
        font-size: 13px;
    }
}

/* ========== حالت افقی موبایل ========== */

@media (max-height: 600px) and (orientation: landscape) {
    .tabaei-login-wrapper {
        padding: 10px;
        min-height: auto;
    }

    .tabaei-login-container {
        min-height: auto;
    }

    .tabaei-login-form-section {
        padding: 20px 30px;
    }

    .login-header {
        margin-bottom: 20px;
    }

    .mobile-logo {
        margin-bottom: 15px;
    }

    .login-form-wrapper input[type="text"],
    .login-form-wrapper input[type="tel"],
    .login-form-wrapper input[type="password"],
    .login-form-wrapper input[type="email"] {
        padding: 8px 12px;
        font-size: 12px;
    }
}

/* ========== پرینت ========== */

@media print {
    body.tabaei-login-page {
        background: white;
    }

    .tabaei-login-image-section,
    .login-back-link {
        display: none;
    }

    .tabaei-login-container {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* ========== دسترسی‌پذیری ========== */

.login-form-wrapper input:focus,
.back-to-home:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* ========== حالت تاریک ========== */

@media (prefers-color-scheme: dark) {
    body.tabaei-login-page {
        background: linear-gradient(135deg, #434343 0%, #000000 100%);
    }

    .tabaei-login-container {
        background: #1a1a2e;
    }

    .tabaei-login-form-section {
        background: #1a1a2e;
    }

    .login-header h2 {
        color: #ffffff;
    }

    .login-header .login-description {
        color: #b0b0b0;
    }

    .login-form-wrapper input {
        background: #2d2d44;
        border-color: #3d3d5c;
        color: white;
    }

    .login-form-wrapper input:focus {
        background: #363654;
    }

    .back-to-home {
        color: #b0b0b0;
    }

    .back-to-home:hover {
        color: #667eea;
    }

    /* تصویر تست در Dark Mode */
    .test-image {
        border-color: rgba(255, 255, 255, 0.7);
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    }

    .test-image:hover {
        border-color: rgba(255, 255, 255, 0.9);
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
    }

    .test-image-placeholder {
        background: rgba(255, 255, 255, 0.1);
        border-color: rgba(255, 255, 255, 0.2);
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    }

    .test-image-placeholder:hover {
        background: rgba(255, 255, 255, 0.15);
    }

    .stat-item {
        background: #2d2d44;
        color: #b0b0b0;
    }

    .alert-warning {
        background: #3d3520;
        border-color: #5c5030;
        color: #d4b86a;
    }
    
    /* فرم Expat در Dark Mode */
        background: #2d2d44;
        border-color: #3d3d5c;
        color: #b0b0b0;
    }

        background: #363654;
    }

        background: #667eea;
        color: white;
        border-color: #667eea;
    }

        background: #2d2d44;
        border-top-color: #3d3d5c;
    }

        color: #e0e0e0;
    }

        background: #2d2d44;
        border-color: #3d3d5c;
        color: white;
    }

        background: #363654;
        border-color: #667eea;
        color: white;
    }
    
        color: #909090;
    }
    
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    }
    
    .message-success {
        background: #1e4620;
        border-color: #2d6a30;
        color: #4ade80;
    }
    
    .message-error {
        background: #4a1e1e;
        border-color: #6a2d2d;
        color: #f87171;
    }

    /* آزمون‌های پر فروش در Dark Mode */
    .bestseller-item {
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    }

    .bestseller-item:hover {
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
    }

    .bestseller-placeholder {
        background: rgba(255, 255, 255, 0.1);
        border-color: rgba(255, 255, 255, 0.2);
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    }

    .bestseller-placeholder:hover {
        background: rgba(255, 255, 255, 0.15);
    }
}



    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px 20px;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Kalameh', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #1a1a2e;
}

    background: #e9ecef;
}

    background: #667eea;
    color: white;
    border-color: #667eea;
}

    flex-shrink: 0;
}

    flex-shrink: 0;
    transition: transform 0.3s ease;
}

    transform: rotate(180deg);
}

    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, padding 0.4s ease;
    background: white;
}

    max-height: 600px;
    padding: 20px;
    border-top: 1px solid #e9ecef;
}

    display: flex;
    flex-direction: column;
    gap: 16px;
}

    display: flex;
    flex-direction: column;
    gap: 6px;
}

    font-family: 'Kalameh', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 4px;
}

    color: #ef4444;
    font-size: 16px;
}

    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    font-size: 15px;
    font-family: 'Kalameh', sans-serif;
    transition: all 0.3s ease;
    background: #f8f9fa;
    color: #1a1a2e;
    outline: none;
}

    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

    color: #b0b0b0;
    opacity: 1;
    font-family: 'Kalameh', sans-serif;
    font-size: 14px;
    letter-spacing: 0.5px;
}

    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M10.293 3.293L6 7.586 1.707 3.293A1 1 0 00.293 4.707l5 5a1 1 0 001.414 0l5-5a1 1 0 10-1.414-1.414z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 12px center;
    padding-left: 36px;
}

    font-size: 11px;
    color: #6b7280;
    font-family: 'Kalameh', sans-serif;
    margin-top: -2px;
}

    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-family: 'Kalameh', sans-serif;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

    opacity: 0.7;
    cursor: not-allowed;
}

    animation: spin 1s linear infinite;
}

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

    margin-top: 12px;
    font-family: 'Kalameh', sans-serif;
}

    padding: 12px 16px;
    background: #d1fae5;
    border: 1px solid #6ee7b7;
    border-radius: 8px;
    color: #065f46;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

    content: "✓";
    font-size: 18px;
    font-weight: bold;
}

    padding: 12px 16px;
    background: #fee2e2;
    border: 1px solid #fca5a5;
    border-radius: 8px;
    color: #991b1b;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

    content: "✕";
    font-size: 18px;
    font-weight: bold;
}

/* Responsive */
@media (max-width: 768px) {
    .login-form-wrapper input[type="text"],
    .login-form-wrapper input[type="tel"],
    .login-form-wrapper input[type="password"],
    .login-form-wrapper input[type="email"] {
        padding: 12px 16px;
        font-size: 14px;
    }

        font-size: 13px;
        padding: 12px 16px;
    }

        padding: 16px;
    }

        padding: 12px 16px;
        font-size: 14px;
    }

        padding: 12px 18px;
        font-size: 15px;
    }
}

/* ورود با تلگرام (ویجت رسمی) */
.login-header + .tabaei-telegram-login {
    margin-top: 0.35rem;
}

.tabaei-login-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1.25rem 0;
    color: #8e8e93;
    font-size: 14px;
    font-weight: 500;
}

.tabaei-login-divider::before,
.tabaei-login-divider::after {
    content: "";
    flex: 1;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.tabaei-login-divider span {
    padding: 0 12px;
}

.tabaei-telegram-login {
    display: flex;
    justify-content: center;
    margin-bottom: 0.5rem;
}

.tabaei-telegram-login + .tabaei-login-divider {
    margin-top: 0.75rem;
}

.tabaei-telegram-error {
    margin: 0.75rem 0 0;
    padding: 10px 14px;
    border-radius: 10px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
    font-size: 14px;
    line-height: 1.5;
}

@media (prefers-color-scheme: dark) {
    .tabaei-login-divider::before,
    .tabaei-login-divider::after {
        border-bottom-color: rgba(255, 255, 255, 0.12);
    }

    .tabaei-login-divider {
        color: #b0b0b0;
    }

    .tabaei-telegram-error {
        background: #3d3020;
        border-color: #a67c00;
        color: #f5e6c8;
    }
}

