/* =========================================
   تنسيقات صفحة تسجيل الدخول (Gpanel Login)
   ========================================= */
body.login-page-bg {
    background: linear-gradient(135deg, #f4f7f6 0%, #e0eafc 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    font-family: 'Cairo', sans-serif;
}

.top-bar {
    position: absolute;
    top: 20px;
    right: 30px;
}

.back-link {
    color: var(--primary-color, #1a5276);
    text-decoration: none;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.7);
    padding: 10px 20px;
    border-radius: 50px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.back-link:hover {
    background: var(--primary-color, #1a5276);
    color: white;
    transform: translateX(-5px);
}

.login-container {
    background: #ffffff;
    width: 100%;
    max-width: 480px;
    padding: 50px 40px;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 86, 179, 0.1);
    border-top: 5px solid var(--secondary-color, #d35400);
}

.login-header {
    text-align: center;
    margin-bottom: 35px;
}

.login-logo {
    width: 80px;
    margin-bottom: 15px;
}

.login-header h1 {
    font-size: 1.6rem;
    color: var(--primary-color, #1a5276);
    font-weight: 800;
    margin-bottom: 10px;
}

.login-header p {
    color: #6c757d;
    font-size: 0.95rem;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
    color: #343a40;
}

.input-icon {
    position: relative;
}

.input-icon i {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #adb5bd;
    font-size: 1.1rem;
    transition: 0.3s;
}

.input-icon input {
    width: 100%;
    padding: 15px 15px 15px 40px;
    padding-right: 45px;
    border: 1px solid #ced4da;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    background: #f8f9fa;
    transition: all 0.3s ease;
}

.input-icon input:focus {
    outline: none;
    border-color: var(--primary-color, #1a5276);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(26, 82, 118, 0.1);
}

.input-icon input:focus + i, .input-icon input:not(:placeholder-shown) + i {
    color: var(--primary-color, #1a5276);
}

.captcha-group { margin-bottom: 20px; }
.captcha-row { display: flex; align-items: stretch; gap: 10px; margin-bottom: 10px; }
.captcha-question {
    flex: 1;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed #9fb5ca;
    border-radius: 8px;
    background: #eef5fb;
    color: var(--primary-color, #1a5276);
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 1px;
}
.captcha-refresh {
    width: 50px;
    min-height: 50px;
    border: 1px solid #ced4da;
    border-radius: 8px;
    background: #fff;
    color: var(--primary-color, #1a5276);
    cursor: pointer;
    font-size: 1rem;
}
.captcha-refresh:hover { background: #eef5fb; }
.captcha-refresh:focus-visible,
.captcha-answer:focus-visible { outline: 3px solid rgba(26, 82, 118, 0.2); outline-offset: 2px; }
.captcha-refresh:disabled { cursor: wait; opacity: 0.6; }
.captcha-answer {
    width: 100%;
    min-height: 50px;
    padding: 12px 14px;
    border: 1px solid #ced4da;
    border-radius: 8px;
    background: #f8f9fa;
    color: #343a40;
    font: 700 1rem 'Cairo', sans-serif;
    text-align: center;
}
.captcha-answer:focus { outline: none; border-color: var(--primary-color, #1a5276); background: #fff; }
.captcha-help { display: block; margin-top: 6px; color: #6c757d; font-size: 0.78rem; }

.btn-login {
    width: 100%;
    background: var(--primary-color, #1a5276);
    color: white;
    border: none;
    padding: 16px;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.btn-login:hover {
    background: var(--primary-dark, #004494);
    box-shadow: 0 5px 15px rgba(26, 82, 118, 0.3);
}

.btn-login:disabled {
    background: #6c757d;
    cursor: not-allowed;
    box-shadow: none;
}

.login-footer {
    text-align: center;
    margin-top: 35px;
    padding-top: 25px;
    border-top: 1px solid #e9ecef;
}

.login-footer p {
    color: #6c757d;
    font-size: 0.95rem;
    margin-bottom: 10px;
}

.btn-register-link {
    display: inline-block;
    color: var(--secondary-color, #d35400);
    font-weight: 800;
    text-decoration: none;
    transition: 0.3s;
}

.btn-register-link:hover {
    color: var(--primary-color, #1a5276);
    text-decoration: underline;
}

/* Comment translated to English. */
.login-msg {
    margin-bottom: 20px;
    font-weight: bold;
    font-size: 0.95rem;
    text-align: center;
    padding: 10px;
    border-radius: 5px;
    display: none;
}

.login-msg.success, .login-msg.error {
    display: block;
    animation: fadeIn 0.3s ease;
}

.login-msg.success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.login-msg.error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 768px) {
    body.login-page-bg { min-width: 320px; justify-content: flex-start; padding: 16px 12px; }
    .top-bar { position: static; width: 100%; margin-bottom: 14px; }
    .back-link { display: inline-flex; min-height: 44px; padding: 9px 14px; }
    .login-container { max-width: 100%; padding: 32px 18px; border-radius: 14px; }
    .login-header { margin-bottom: 26px; }
    .login-logo { width: 68px; }
    input, select, textarea { font-size: 16px !important; }
}

@media (max-width: 576px) {
    .login-container { padding: 28px 16px; }
    .top-bar { margin-bottom: 18px; align-self: stretch; }
}


/* CSP hardening: migrated from inline <style>. */
.password-rules {
            margin: 12px 0 0;
            padding: 12px;
            border-radius: 10px;
            background: #f8fafc;
            border: 1px solid #e5e7eb;
            font-size: 13px;
            color: #555;
            line-height: 1.9;
        }

        .password-rules .valid {
            color: #16a34a;
            font-weight: 700;
        }

        .password-rules .invalid {
            color: #dc2626;
        }

        .helper-text {
            margin-top: 10px;
            color: #667085;
            font-size: 14px;
            line-height: 1.8;
        }

        .hidden {
            display: none !important;
        }

        .back-login-link {
            display: inline-block;
            margin-top: 16px;
            color: #1a5276;
            font-weight: 700;
            text-decoration: none;
        }
