/* 🔐 تصميم المودال */
:root {
    --main: #ff6f61;
    --bg: #f8f9fa;
    --text: #333;
    --radius: 10px;
    --shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.modal-backdrop.show {
    z-index: 1040 !important;
    backdrop-filter: blur(5px);
    background: rgba(0, 0, 0, 0.45);
}

.modal {
    z-index: 1055 !important;
    overflow: hidden !important;
}

.auth-modal-content {
    z-index: 1060 !important;
    position: relative;
    border-radius: 1rem;
    overflow: hidden;
    background: #fff;
    animation: scaleIn 0.3s ease-out;
}

/* تأكد أن زر الإغلاق ظاهر فوق أي عناصر أخرى */
#authModal .btn-close {
    z-index: 1056 !important;
    /* أعلى من modal-content (1055) */
    position: absolute;
    top: 1rem;
    inset-inline-end: 1rem !important;
    /* يعمل في الاتجاهين LTR/RTL */
    background-color: rgba(255, 255, 255, 0.8);
    /* لون خلفي نصف شفاف */
    border-radius: 50%;
    padding: 0.5rem;
    filter: invert(0);
    /* يجعل X داكنة لو الخلفية فاتحة */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* في الوضع الداكن أو الخلفية الغامقة */
body.dark #authModal .btn-close {
    background-color: rgba(0, 0, 0, 0.5);
    filter: invert(1);
    /* يجعل X بيضاء */
}


/* الجزء الأيسر (صورة وخلفية تفاعلية) */
.auth-illustration {
    background: linear-gradient(135deg, var(--main-color), var(--secondary-color));
    color: white;
    width: 40%;
    text-align: center;
    animation: slideInLeft 0.4s ease;
    flex: 1;
    min-height: 400px;
}

[dir="ltr"] .auth-illustration {
    border-top-left-radius: 15px;
    border-bottom-left-radius: 15px;
}

[dir="rtl"] .auth-illustration {
    border-top-right-radius: 15px;
    border-bottom-right-radius: 15px;
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}




.auth-illustration h4 {
    font-weight: 700;
    letter-spacing: 1px;
}

.auth-illustration p {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* الجزء الأيمن */
.auth-modal-forms {
    width: 60%;
    background-color: #fff;
    animation: fadeIn 0.5s ease;
}

/* نماذج التسجيل / الدخول داخل المودال */
#authModalFormsContainer .auth-form {
    animation: fadeSlideIn 0.5s ease;
}

@keyframes slideInLeft {
    from {
        transform: translateX(-50%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 🎯 تحسين الزر */
.auth-modal-content .btn-primary {
    background: linear-gradient(90deg, var(--main-color), var(--secondary-color));
    border: none;
    font-weight: 600;
    border-radius: 8px;
}

.auth-modal-content .btn-primary:hover {
    opacity: 0.9;
}

/* 🔄 شاشة أصغر */
@media (max-width: 768px) {
    .auth-illustration {
        display: none !important;
    }

    .auth-modal-forms {
        width: 100%;
    }
}

.auth-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    width: 100%;
    max-width: 400px;
    animation: fadeIn 0.5s ease-out;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 5px;
    animation: fadeSlideIn 0.4s ease-out;
}

.auth-form.d-none {
    display: none;
}

.auth-form h2 {
    font-size: 24px;
    text-align: center;
    color: var(--text);
}

.input-group {
    position: relative;
}

.input-group i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--main);
}

.input-group input {
    width: 100%;
    padding: 12px 15px 12px 40px;
    border-radius: var(--radius);
    border: 1px solid #ddd;
    transition: 0.3s;
}

.input-group input:focus {
    border-color: var(--main);
    box-shadow: 0 0 0 3px rgba(255, 111, 97, 0.15);
    outline: none;
}

.btn-primary {
    background: var(--main);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    padding: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
}

.btn-primary:hover {
    background: #e85c50;
}

.divider {
    text-align: center;
    color: #999;
    margin: 10px 0;
    position: relative;
}

.divider span {
    background: #fff;
    padding: 0 10px;
    position: relative;
    z-index: 2;
}

.divider::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
    background: #ddd;
    z-index: 1;
}

.toggle-text {
    text-align: center;
    color: #555;
    font-size: 0.9rem;
}

.toggle-text a {
    color: var(--main);
    text-decoration: none;
    font-weight: 600;
}

.toggle-text a:hover {
    text-decoration: underline;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 🧱 عناصر الإدخال */
.form-group {
    margin-bottom: 5px !important;
    position: relative;
}

.form-group i {
    position: absolute;
    left: 14px;
    top: 65%;
    transform: translateY(-50%);
    color: #777;
}

.form-control {
    width: 100%;
    margin-bottom: 5px !important;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.form-control:focus {
    border-color: #007bff;
    outline: none;
    box-shadow: 0 0 6px rgba(0, 123, 255, 0.2);
}

/* 🎯 أزرار الدخول والتبديل */
.login-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(90deg, #007bff, #00b4d8);
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
    margin-top: 10px;
}

.login-btn:hover {
    background: linear-gradient(90deg, #0056b3, #0096c7);
    transform: translateY(-1px);
}

.login-links {
    margin-top: 15px;
    text-align: center;
}

.login-links a {
    text-decoration: none;
    color: #007bff;
    font-weight: 500;
    transition: color 0.2s ease;
}

.login-links a:hover {
    color: #0056b3;
}