﻿@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/adfs/portal/images/cairo.png') format('woff2');
}
@font-face {
  font-family: 'Tajawal';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/adfs/portal/images/tajawal1.png') format('woff2');
}
@font-face {
  font-family: 'Tajawal';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/adfs/portal/images/tajawal2.png') format('woff2');
}

/* =========================================================================
   Universal Settings & Base Resets
========================================================================= */
:root, html, body {
    color-scheme: dark !important;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Tajawal', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif !important;
    direction: rtl;
}

body, html {
    width: 100% !important;
    height: 100% !important;
    min-height: 100% !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    background-color: #080f1e !important;
    background-image: url('/adfs/portal/images/background.png') !important;
    background-size: cover !important;
    background-position: center center !important;
    background-repeat: no-repeat !important;
    background-attachment: fixed !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Reset inner containers so no ugly inner box appears */
#workArea, #authArea, #authArea > div, #authArea form, #loginArea, #updatePasswordArea, .groupMargin {
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
}

/* Hide Microsoft Defaults & Redundant Intro Headings (e.g. large "Update Password" / "تحديث كلمة المرور") */
#openingMessage, #loginMessage, #footer, #intro, .introduction, #introduction, #updatePasswordMessage,
#updatePasswordArea > h2, #updatePasswordArea > h1, #updatePasswordArea > .groupMargin:first-child:not(#oldPasswordArea):not(#userNameArea) { 
    display: none !important; 
    visibility: hidden !important; 
    height: 0 !important; 
    margin: 0 !important; 
    padding: 0 !important; 
    opacity: 0 !important; 
}
#loginArea br, #submissionArea br, #updatePasswordArea br, #passwordArea br, .groupMargin br { display: none !important; }
.groupMargin, #updatePasswordArea, #passwordArea, .fieldMargin { margin: 0 !important; padding: 0 !important; }

/* =========================================================================
   Background & Overlay (Guaranteed across all windows, popups & redirects)
========================================================================= */
#brandingWrapper, .bg-wrapper, #gov-bg-wrapper {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-image: url('/adfs/portal/images/background.png') !important;
    background-size: cover !important;
    background-position: center center !important;
    background-repeat: no-repeat !important;
    z-index: 1 !important;
    pointer-events: none !important;
}

#branding, .illustrationClass {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100% !important;
    height: 100% !important;
    background-size: cover !important;
    background-position: center center !important;
    background-repeat: no-repeat !important;
}

#brandingWrapper::after, .bg-overlay, #gov-bg-overlay, body::before {
    content: '' !important;
    position: fixed !important;
    top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
    width: 100% !important; height: 100% !important;
    background: radial-gradient(circle at center, rgba(0,0,0,0.15) 0%, rgba(5,10,25,0.65) 100%) !important;
    pointer-events: none !important;
    z-index: 2 !important;
}

/* =========================================================================
   Page Container & Flex Centering
========================================================================= */
#fullPage, .page-container {
    position: relative !important;
    z-index: 10 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 100vh !important;
    min-height: 100dvh !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 16px !important;
    margin: 0 auto !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
    background: transparent !important;
}

#contentWrapper {
    width: 100% !important;
    max-width: 420px !important;
    min-height: auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    margin: auto !important;
    padding: 0 !important;
    z-index: 10 !important;
    position: relative !important;
    box-sizing: border-box !important;
}

/* =========================================================================
   The Glass Card (#content) - Responsive & Sleek
========================================================================= */
#content, .glass-card {
    width: 100% !important;
    max-width: 400px !important;
    background: rgba(15, 23, 42, 0.72) !important;
    backdrop-filter: blur(30px) !important;
    -webkit-backdrop-filter: blur(30px) !important;
    border: 1px solid rgba(255, 255, 255, 0.16) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.35) !important;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6), inset 0 0 15px rgba(255, 255, 255, 0.04) !important;
    border-radius: 22px !important;
    padding: 24px 22px 20px 22px !important;
    text-align: center !important;
    color: #ffffff !important;
    margin: auto !important;
    box-sizing: border-box !important;
    float: none !important;
    position: relative !important;
    animation: fadeIn 0.35s ease-out !important;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.97) translateY(6px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* =========================================================================
   Header & Compact Logo (Height 65px - Never Clipped)
========================================================================= */
#header {
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    margin-bottom: 12px !important;
    padding: 0 !important;
    display: block !important;
    text-align: center !important;
    background: transparent !important;
}

#companyLogo, #header img, .logo-img {
    height: 65px !important;
    max-height: 65px !important;
    width: auto !important;
    max-width: 65px !important;
    display: block !important;
    margin: 0 auto 8px auto !important;
    object-fit: contain !important;
    filter: drop-shadow(0 3px 8px rgba(0,0,0,0.5)) !important;
}

/* Native CSS Fallback for Header Title with Proper Spaces */
#header::after {
    content: "البريد الحكومي المصري\Aتسجيل الدخول" !important;
    white-space: pre-line !important;
    display: block !important;
    font-family: 'Cairo', 'Tajawal', sans-serif !important;
    font-size: 17px !important;
    font-weight: 700 !important;
    color: #ffffff !important;
    margin-top: 6px !important;
    line-height: 1.4 !important;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5) !important;
}

#header.has-gov-title::after {
    display: none !important;
}

/* Runtime Injected Titles */
.gov-title {
    font-size: 17px !important;
    font-weight: 700 !important;
    color: #ffffff !important;
    margin-bottom: 2px !important;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5) !important;
    font-family: 'Cairo', sans-serif !important;
    display: block !important;
}

.gov-subtitle {
    font-size: 12px !important;
    color: rgba(255,255,255,0.85) !important;
    margin-bottom: 14px !important;
    font-family: 'Tajawal', sans-serif !important;
    display: block !important;
}

/* =========================================================================
   Form Groups & Labels with Right Alignment & Perfect Arabic Text
========================================================================= */
#userNameArea, #passwordArea, #oldPasswordArea, #newPasswordArea, #confirmNewPasswordArea, .form-group, .fieldMargin {
    margin-bottom: 12px !important;
    text-align: right !important;
    width: 100% !important;
    display: block !important;
}

/* 1. Username Label */
label[for="userNameInput"], #userNameArea label {
    font-size: 0 !important;
    color: transparent !important;
    display: block !important;
    text-align: right !important;
    margin-bottom: 4px !important;
}
label[for="userNameInput"]::before, #userNameArea label::before {
    content: "البريد الإلكتروني" !important;
    font-size: 12.5px !important;
    color: rgba(255, 255, 255, 0.9) !important;
    font-weight: 500 !important;
    display: block !important;
    font-family: 'Tajawal', sans-serif !important;
    direction: rtl !important;
    text-align: right !important;
}

/* 2. Login Password Label */
#loginArea label[for="passwordInput"], #passwordArea label {
    font-size: 0 !important;
    color: transparent !important;
    display: block !important;
    text-align: right !important;
    margin-bottom: 4px !important;
}
#loginArea label[for="passwordInput"]::before, #passwordArea label::before {
    content: "كلمة المرور" !important;
    font-size: 12.5px !important;
    color: rgba(255, 255, 255, 0.9) !important;
    font-weight: 500 !important;
    display: block !important;
    font-family: 'Tajawal', sans-serif !important;
    direction: rtl !important;
    text-align: right !important;
}

/* 3. Old Password Label (Update Password Page) */
label[for="oldPasswordInput"], #oldPasswordArea label {
    font-size: 0 !important;
    color: transparent !important;
    display: block !important;
    text-align: right !important;
    margin-bottom: 4px !important;
}
label[for="oldPasswordInput"]::before, #oldPasswordArea label::before {
    content: "كلمة المرور الحالية" !important;
    font-size: 12.5px !important;
    color: rgba(255, 255, 255, 0.9) !important;
    font-weight: 500 !important;
    display: block !important;
    font-family: 'Tajawal', sans-serif !important;
    direction: rtl !important;
    text-align: right !important;
}

/* 4. New Password Label (Update Password Page) */
label[for="newPasswordInput"], #newPasswordArea label {
    font-size: 0 !important;
    color: transparent !important;
    display: block !important;
    text-align: right !important;
    margin-bottom: 4px !important;
}
label[for="newPasswordInput"]::before, #newPasswordArea label::before {
    content: "كلمة المرور الجديدة" !important;
    font-size: 12.5px !important;
    color: rgba(255, 255, 255, 0.9) !important;
    font-weight: 500 !important;
    display: block !important;
    font-family: 'Tajawal', sans-serif !important;
    direction: rtl !important;
    text-align: right !important;
}

/* 5. Confirm New Password Label (Update Password Page) */
label[for="confirmNewPasswordInput"], #confirmNewPasswordArea label {
    font-size: 0 !important;
    color: transparent !important;
    display: block !important;
    text-align: right !important;
    margin-bottom: 4px !important;
}
label[for="confirmNewPasswordInput"]::before, #confirmNewPasswordArea label::before {
    content: "تأكيد كلمة المرور الجديدة" !important;
    font-size: 12.5px !important;
    color: rgba(255, 255, 255, 0.9) !important;
    font-weight: 500 !important;
    display: block !important;
    font-family: 'Tajawal', sans-serif !important;
    direction: rtl !important;
    text-align: right !important;
}

/* =========================================================================
   Inputs: Dark Styling + Strict Autofill Protection (NEVER WHITE!)
========================================================================= */
#userNameInput, #passwordInput, #oldPasswordInput, #newPasswordInput, #confirmNewPasswordInput,
.form-input, input.text, input[type="email"], input[type="text"], input[type="password"] {
    width: 100% !important;
    background: rgba(0, 0, 0, 0.45) !important;
    background-color: rgba(0, 0, 0, 0.45) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 10px !important;
    color: #ffffff !important;
    padding: 8px 12px !important;
    font-size: 13.5px !important;
    direction: ltr !important;
    text-align: left !important;
    outline: none !important;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2) !important;
    transition: all 0.25s ease !important;
    height: 40px !important;
    box-sizing: border-box !important;
    font-family: 'Segoe UI', Tahoma, sans-serif !important;
}

#userNameInput:focus, #passwordInput:focus, #oldPasswordInput:focus, #newPasswordInput:focus, #confirmNewPasswordInput:focus,
input.text:focus, input[type="text"]:focus, input[type="password"]:focus {
    border-color: rgba(255, 255, 255, 0.6) !important;
    background: rgba(0, 0, 0, 0.55) !important;
    background-color: rgba(0, 0, 0, 0.55) !important;
    box-shadow: 0 0 12px rgba(255,255,255,0.2) !important;
    color: #ffffff !important;
}

/* Total annihilation of bright white browser autofill */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus,
input:-webkit-autofill:active,
input:-internal-autofill-selected {
    -webkit-box-shadow: 0 0 0 1000px #131b2e inset !important;
    box-shadow: 0 0 0 1000px #131b2e inset !important;
    -webkit-text-fill-color: #ffffff !important;
    color: #ffffff !important;
    caret-color: #ffffff !important;
    background-color: #131b2e !important;
    transition: background-color 500000s ease-in-out 0s !important;
    border-color: rgba(255, 255, 255, 0.4) !important;
}

#userNameInput::placeholder, #passwordInput::placeholder, #oldPasswordInput::placeholder, #newPasswordInput::placeholder, #confirmNewPasswordInput::placeholder {
    color: rgba(255, 255, 255, 0.4) !important;
    font-size: 13px !important;
}

/* =========================================================================
   Keep Me Signed In Checkbox
========================================================================= */
#kmsiArea, .kmsi-wrapper {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    justify-content: flex-start !important;
    margin: 6px 0 10px 0 !important;
    direction: rtl !important;
    text-align: right !important;
    width: 100% !important;
}

#kmsiInput, .kmsi-wrapper input[type="checkbox"] {
    accent-color: #0078d4 !important;
    cursor: pointer !important;
    width: 16px !important;
    height: 16px !important;
    margin: 0 !important;
    margin-left: 8px !important;
    flex-shrink: 0 !important;
}

label[for="kmsiInput"], #kmsiArea label, .kmsi-wrapper label {
    font-size: 0 !important;
    color: transparent !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
}

label[for="kmsiInput"]::before, #kmsiArea label::before, .kmsi-wrapper label::before {
    content: "البقاء قيد تسجيل الدخول" !important;
    font-size: 12px !important;
    color: rgba(255, 255, 255, 0.85) !important;
    font-weight: 400 !important;
    font-family: 'Tajawal', sans-serif !important;
}

/* =========================================================================
   Submission Area: Primary Submit & Sleek Cancel Button (Fixed for <input>)
========================================================================= */
#submissionArea {
    width: 100% !important;
    margin: 8px 0 8px 0 !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
}

/* 1. Primary Action Button */
#submitButton, .btn-submit, input[type="submit"]#submitButton, span.submit {
    width: 100% !important;
    background: linear-gradient(135deg, #0078d4 0%, #005a9e 100%) !important;
    color: #ffffff !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    border-radius: 10px !important;
    padding: 8px 16px !important;
    border: none !important;
    cursor: pointer !important;
    box-shadow: 0 4px 14px rgba(0, 120, 212, 0.4) !important;
    transition: all 0.25s ease !important;
    height: 40px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    text-decoration: none !important;
    font-family: 'Tajawal', sans-serif !important;
}

/* Fallback for <span> elements */
span#submitButton {
    font-size: 0 !important;
    color: transparent !important;
}
span#submitButton::before {
    content: "الدخول" !important;
    font-size: 14px !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    font-family: 'Tajawal', sans-serif !important;
}
#updatePasswordArea span#submitButton::before,
#updatePasswordForm span#submitButton::before {
    content: "حفظ كلمة المرور" !important;
}

#submitButton:hover, .btn-submit:hover, input[type="submit"]#submitButton:hover {
    background: linear-gradient(135deg, #1084d8 0%, #0067b8 100%) !important;
    box-shadow: 0 6px 18px rgba(0, 120, 212, 0.6) !important;
    transform: translateY(-1px) !important;
}

/* 2. Sleek Secondary Cancel Button */
#cancelButton, input#cancelButton, span.cancel, a#cancelButton, .btn-cancel {
    width: 100% !important;
    height: 38px !important;
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 10px !important;
    color: #cbd5e1 !important;
    font-size: 13.5px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    text-decoration: none !important;
    box-sizing: border-box !important;
    font-family: 'Tajawal', sans-serif !important;
    text-align: center !important;
}

span#cancelButton {
    font-size: 0 !important;
    color: transparent !important;
}
span#cancelButton::before {
    content: "إلغاء والعودة" !important;
    font-size: 13.5px !important;
    color: #cbd5e1 !important;
    font-weight: 600 !important;
    font-family: 'Tajawal', sans-serif !important;
}

#cancelButton:hover, input#cancelButton:hover, span.cancel:hover, a#cancelButton:hover {
    background: rgba(255, 255, 255, 0.16) !important;
    border-color: rgba(255, 255, 255, 0.35) !important;
    color: #ffffff !important;
    transform: translateY(-1px) !important;
}

/* =========================================================================
   Custom Links Below Submit
========================================================================= */
.gov-custom-links {
    width: 100% !important;
    margin-top: 10px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
}

.custom-link {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 5px !important;
    font-size: 11.5px !important;
    color: rgba(255, 255, 255, 0.85) !important;
    text-decoration: none !important;
    transition: all 0.2s ease !important;
    font-family: 'Tajawal', sans-serif !important;
}

.custom-link:hover {
    color: #ffffff !important;
    text-decoration: underline !important;
}

.custom-link svg {
    width: 14px !important;
    height: 14px !important;
    flex-shrink: 0 !important;
}

/* =========================================================================
   MFA Screen Elements - Exact mfa_preview.html
========================================================================= */
.user-pill {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.16) !important;
    border-radius: 16px !important;
    padding: 4px 12px !important;
    margin: 0 auto 12px auto !important;
    font-size: 12px !important;
    color: #e2e8f0 !important;
}

.user-label {
    color: #93c5fd !important;
    font-weight: 600 !important;
    font-family: 'Tajawal', sans-serif !important;
}

.user-email {
    direction: ltr !important;
    unicode-bidi: isolate !important;
    font-weight: 600 !important;
    color: #ffffff !important;
}

.instruction-box {
    margin-bottom: 8px !important;
}

.inst-text {
    font-size: 13px !important;
    line-height: 1.55 !important;
    color: #ffffff !important;
    text-shadow: 0 1px 3px rgba(0,0,0,0.6) !important;
    margin-bottom: 2px !important;
    font-family: 'Tajawal', sans-serif !important;
}

.inst-highlight {
    color: #93c5fd !important;
    font-weight: 600 !important;
}

.mfa-number-wrapper {
    margin: 10px 0 14px 0 !important;
    display: block !important;
    text-align: center !important;
}

.mfa-number-badge {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-family: 'Cairo', sans-serif !important;
    font-size: 2.4rem !important;
    font-weight: 900 !important;
    color: #ffffff !important;
    background: linear-gradient(135deg, rgba(30, 58, 138, 0.45) 0%, rgba(15, 23, 42, 0.65) 100%);
    border: 1.5px solid rgba(147, 197, 253, 0.5);
    border-top: 1.5px solid rgba(255, 255, 255, 0.75);
    border-radius: 15px;
    padding: 5px 26px !important;
    letter-spacing: 2px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45), 0 0 16px rgba(59, 130, 246, 0.3), inset 0 0 10px rgba(147, 197, 253, 0.12) !important;
    text-shadow: 0 0 10px rgba(147, 197, 253, 0.7), 0 2px 5px rgba(0, 0, 0, 0.8) !important;
    line-height: 1.1 !important;
}

.secondary-link, #secondaryAuthSelection, a[id*="secondary"], a[id*="choice"] {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    color: #93c5fd !important;
    text-decoration: none !important;
    font-size: 12.5px !important;
    font-weight: 600 !important;
    background: rgba(30, 58, 138, 0.3) !important;
    border: 1px solid rgba(147, 197, 253, 0.35) !important;
    border-radius: 10px !important;
    padding: 7px 16px !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 3px 10px rgba(0,0,0,0.2) !important;
    margin-top: 8px !important;
    font-family: 'Tajawal', sans-serif !important;
    cursor: pointer !important;
}

.secondary-link:hover, #secondaryAuthSelection:hover, a[id*="secondary"]:hover {
    background: rgba(59, 130, 246, 0.35) !important;
    border-color: rgba(147, 197, 253, 0.6) !important;
    color: #ffffff !important;
}

.secondary-link svg {
    width: 14px !important;
    height: 14px !important;
}

/* =========================================================================
   Error & Status Notifications (Shows cleanly only when error occurs)
========================================================================= */
#error {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    display: block !important;
}

#errorText, .error-message {
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
}

/* Only display error styling when there is actual error text inside */
#error.has-error #errorText,
#error:not(:empty) span#errorText:not(:empty),
#errorText:not(:empty) {
    display: block !important;
    background: rgba(220, 38, 38, 0.22) !important;
    border: 1px solid rgba(239, 68, 68, 0.45) !important;
    border-radius: 10px !important;
    color: #fca5a5 !important;
    font-size: 12.5px !important;
    padding: 8px 12px !important;
    margin-bottom: 12px !important;
    text-align: right !important;
    line-height: 1.45 !important;
    font-family: 'Tajawal', sans-serif !important;
    direction: rtl !important;
}

/* =========================================================================
   Mobile Optimization (Proper Comfortable Width on Phones & Popups)
========================================================================= */
@media screen and (max-width: 600px) {
    #fullPage, .page-container {
        padding: 16px 14px !important;
        align-items: center !important;
    }
    #contentWrapper {
        width: 100% !important;
        max-width: 100% !important;
    }
    #content, .glass-card {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        padding: 24px 18px 20px 18px !important;
        border-radius: 20px !important;
        margin: 0 auto !important;
    }
    .gov-title {
        font-size: 17px !important;
    }
    .gov-subtitle {
        font-size: 12px !important;
        margin-bottom: 12px !important;
    }
    #companyLogo, #header img, .logo-img {
        height: 60px !important;
        max-height: 60px !important;
        max-width: 60px !important;
        margin: 0 auto 6px auto !important;
    }
    #userNameInput, #passwordInput, #oldPasswordInput, #newPasswordInput, #confirmNewPasswordInput, .form-input {
        height: 42px !important;
        font-size: 14px !important;
    }
    #submitButton, .btn-submit, input[type="submit"]#submitButton {
        height: 42px !important;
    }
    #cancelButton, input#cancelButton, span.cancel, a#cancelButton {
        height: 40px !important;
    }
}
