/* --- أنظمة التصميم الحديث والألوان الاحترافية لجامعة النيل الأبيض --- */
:root {
    --univ-maroon-dark: #4a1313;
    --univ-maroon-main: #6c2323;
    --univ-maroon-light: #fdf6f6;
    --gold-bright: #d4af37;
    --gold-dark: #b59410;
    --slate-text: #5c626e;
    --slate-border: #ebdada;
}

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

body {
    font-family: "Cairo", sans-serif;
    background: linear-gradient(135deg, #f5f5f5 0%, #ebdada 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    direction: rtl !important;
    text-align: right !important;
}

/* --- شاشة التحميل الافتراضية المنسقة دلالياً --- */
.preloader-area {
    position: fixed;
    background: #ffffff;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.preloader-logo-assembly {
    position: relative;
    display: inline-block;
    width: 90px;
    height: 90px;
}
.university-preload-img {
    width: 70px;
    height: auto;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}
.preloader-ring-progress {
    display: block;
    width: 90px;
    height: 90px;
    border: 4px solid var(--slate-border);
    border-radius: 50%;
    border-top-color: var(--univ-maroon-main);
    animation: spin 1s linear infinite;
}
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* --- حاوية اللوحة المنقسمة المستجابة والمطابقة بالكامل لباقي الصفحات --- */
.modern-login-container {
    display: flex;
    width: 100%;
    max-width: 1050px;
    min-height: 600px;
    background: #ffffff;
    border: 1px solid var(--slate-border);
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(108, 35, 35, 0.06);
    overflow: hidden;
}

/* الجانب الأيمن الهوياتي: ترحيبي فاخر */
.login-branding-side {
    flex: 1;
    background: linear-gradient(
        135deg,
        var(--univ-maroon-dark) 0%,
        var(--univ-maroon-main) 100%
    );
    padding: 3.5rem 2.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: #ffffff;
    position: relative;
}
.login-branding-side::before {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(
        90deg,
        var(--univ-maroon-main),
        var(--gold-bright),
        var(--univ-maroon-main)
    );
}
.branding-logo-box {
    background: rgba(255, 255, 255, 0.1);
    padding: 1.25rem;
    border-radius: 18px;
    margin-bottom: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
}
.branding-logo-box img {
    width: 95px;
    height: auto;
}
.login-branding-side h2 {
    font-size: 1.75rem;
    font-weight: 850;
    margin-bottom: 1rem;
    color: #ffffff;
}
.login-branding-side p {
    font-size: 0.95rem;
    opacity: 0.85;
    max-width: 320px;
    line-height: 1.6;
}

/* الجانب الأيسر: استمارة طلب الرابط وعلاجات الـ RTL والرموز المحاذية يميناً */
.login-form-side {
    flex: 1.1;
    padding: 3.5rem 4rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: #ffffff;
    direction: rtl !important;
    text-align: right !important;
}
.form-side-header {
    margin-bottom: 2.5rem;
    text-align: right;
}
.form-side-header h4 {
    font-size: 1.45rem;
    font-weight: 850;
    color: var(--univ-maroon-dark);
    margin-bottom: 0.5rem;
}
.form-side-header p {
    font-size: 0.85rem;
    color: var(--slate-text);
    margin: 0;
}

/* تنسيق الحقل وتثبيت موضع الأيقونة بالجانب الأيمن للـ RTL */
.modern-form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 1.5rem;
    text-align: right;
}
.modern-input-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--univ-maroon-main);
    margin-bottom: 0.6rem;
    display: block;
}
.input-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}
.input-icon-wrapper i {
    position: absolute;
    right: 1.25rem;
    color: var(--gold-dark);
    font-size: 1rem;
    pointer-events: none;
    z-index: 5;
}
.modern-form-control {
    width: 100%;
    height: 48px;
    padding: 0.375rem 3.2rem 0.375rem 1.25rem; /* مسافة يمين للأيقونة وبادينج عادي يسار */
    font-size: 0.95rem;
    color: var(--univ-maroon-dark);
    background-color: #ffffff;
    border: 1px solid var(--slate-border);
    border-radius: 10px;
    outline: none;
    transition: all 0.2s ease-in-out;
    text-align: right;
    direction: rtl;
}
.modern-form-control:focus {
    border-color: var(--univ-maroon-main);
    box-shadow: 0 0 0 3px rgba(108, 35, 35, 0.08);
}

/* رسائل الخطأ والتنبيهات المنسقة */
.modern-error-block {
    color: #ef4444;
    font-size: 0.75rem;
    margin-top: 0.4rem;
    font-weight: 600;
    text-align: right;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.alert-toast-style {
    background-color: #e8f5e9;
    border: 1px solid #c8e6c9;
    color: #2e7d32;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    direction: rtl;
}

/* أزرار الإرسال المحدثة */
.modern-btn-submit {
    width: 100%;
    height: 48px;
    background: linear-gradient(
        135deg,
        var(--univ-maroon-main) 0%,
        var(--univ-maroon-dark) 100%
    );
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(108, 35, 35, 0.15);
    transition: all 0.2s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}
.modern-btn-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(108, 35, 35, 0.25);
}
.modern-forgot-link {
    text-align: center;
    margin-top: 1.5rem;
}
.modern-forgot-link a {
    color: var(--slate-text);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s ease;
}

/* ✅ تكميل وإصلاح الكلاس المقطوع برميًا للرابط التفاعلي */
.modern-forgot-link a:hover {
    color: var(--univ-maroon-main);
}

.modern-login-footer {
    text-align: center;
    margin-top: 2rem;
    border-top: 1px dashed var(--slate-border);
    padding-top: 1rem;
    font-size: 0.8rem;
    color: #94a3b5;
}
.modern-login-footer a {
    color: var(--univ-maroon-main);
    text-decoration: none;
    font-weight: 600;
}

/* ========================================================================= */
/* --- ✅ الإضافة: نظام الاستجابة الشامل والتكيف مع الجوال والشاشات ---      */
/* ========================================================================= */
@media (max-width: 992px) {
    .modern-login-container {
        max-width: 720px;
        min-height: auto;
    }
    .login-form-side {
        padding: 3rem 2.5rem;
    }
    .login-branding-side {
        padding: 3rem 1.5rem;
    }
    .login-branding-side h2 {
        font-size: 1.45rem;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
        overflow-y: auto;
    }
    .modern-login-container {
        max-width: 450px;
        flex-direction: column; /* قلب الواجهة العريضة لعمود طولي منسق للجوال */
        border-radius: 16px;
    }
    .login-branding-side {
        padding: 2.5rem 1.5rem;
    }
    .branding-logo-box {
        margin-bottom: 1rem;
        padding: 1rem;
    }
    .branding-logo-box img {
        width: 75px;
    }
    .login-branding-side h2 {
        font-size: 1.35rem;
        margin-bottom: 0.5rem;
    }
    .login-branding-side p {
        font-size: 0.85rem;
    }
    .login-branding-side p {
        font-size: 0.85rem;
    }
    .login-form-side {
        padding: 2.5rem 1.5rem;
    }
    .form-side-header {
        margin-bottom: 1.75rem;
        text-align: center;
    }
}
