/* JEME portal — site-wide component styles (moved from the inline <style> of index.html) */

/* Typography & Bidirectional Dynamics */
html[dir="rtl"], [dir="rtl"] body {
    font-family: 'Cairo', system-ui, -apple-system, sans-serif;
    text-align: right;
}
html[dir="ltr"], [dir="ltr"] body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    text-align: left;
}
[dir="rtl"] .academic-serif {
    font-family: 'Cairo', system-ui, sans-serif !important;
    font-weight: 700;
}
[dir="ltr"] .academic-serif {
    font-family: 'Inter', system-ui, sans-serif;
}

/* RTL Layout Mirrors */
[dir="rtl"] .banner-accent {
    border-left-width: 0px !important;
    border-right-width: 4px !important;
    border-top-right-radius: 0px !important;
    border-bottom-right-radius: 0px !important;
    border-top-left-radius: 0.75rem !important;
    border-bottom-left-radius: 0.75rem !important;
}
[dir="rtl"] .search-box-icon {
    left: auto !important;
    right: 0.875rem !important;
}
[dir="rtl"] .search-box-input {
    padding-left: 0.75rem !important;
    padding-right: 2.25rem !important;
}
[dir="rtl"] .nav-login-link {
    padding-left: 0 !important;
    padding-right: 1rem !important;
}
[dir="rtl"] .modal-action-push {
    margin-left: 0 !important;
    margin-right: auto !important;
}

/* RTL Icon and Spacing Mirrors */
[dir="rtl"] .rtl-flip {
    transform: scaleX(-1);
    display: inline-block;
}
[dir="rtl"] .rtl-chevron {
    transform: rotate(180deg);
    display: inline-block;
}
[dir="rtl"] .icon-mr {
    margin-right: 0 !important;
    margin-left: 0.25rem !important;
}
[dir="rtl"] .icon-mr-md {
    margin-right: 0 !important;
    margin-left: 0.375rem !important;
}

/* ==========================================================================
   WCAG 2.1 AA ACCESSIBILITY & INTERACTION DESIGN ENHANCEMENTS
   ========================================================================== */

/* 1. Screen Reader Utilities */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border-width: 0 !important;
}

/* 2. Accessible Skip to Main Content Link */
.skip-to-content {
    position: absolute;
    top: -9999px;
    left: 50%;
    transform: translateX(-50%);
    background: #0A2239;
    color: #C19A06;
    padding: 0.75rem 1.5rem;
    font-weight: 800;
    font-size: 0.875rem;
    border-radius: 0 0 0.5rem 0.5rem;
    border: 2px solid #C19A06;
    border-top: none;
    z-index: 9999;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
    text-decoration: none;
    transition: top 0.2s ease-in-out;
}
.skip-to-content:focus,
.skip-to-content:focus-visible {
    top: 0;
    outline: 2px solid #178582 !important;
    outline-offset: 2px !important;
}

/* 3. Visible Focus Rings (WCAG 2.4.7) */
:focus-visible {
    outline: 2px solid #178582 !important;
    outline-offset: 2px !important;
}
header :focus-visible,
footer :focus-visible,
.bg-navyBrand :focus-visible,
.bg-navyDark :focus-visible,
dialog :focus-visible {
    outline: 2px solid #C19A06 !important;
    outline-offset: 2px !important;
}

/* 4. Touch Targets (WCAG 2.5.5 / 2.5.8 - Minimum 44x44px) */
.min-touch-target {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
}

/* 5. Modal Scroll Lock & Backdrops */
body.modal-open {
    overflow: hidden !important;
}
dialog::backdrop {
    background: rgba(10, 34, 57, 0.75) !important;
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
}

/* 6. Navigation Tabs Active State */
.nav-tab.active-tab {
    color: #0A2239 !important;
    background-color: #F1F5F9 !important;
    border-bottom: 3px solid #0D5C75 !important;
    font-weight: 800 !important;
}

/* 7. Active Policy & Legal Selection States */
.policy-btn-active {
    background-color: #0A2239 !important;
    color: #FFFFFF !important;
    border-left: 4px solid #C19A06 !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1) !important;
}
[dir="rtl"] .policy-btn-active {
    border-left: none !important;
    border-right: 4px solid #C19A06 !important;
}
.legal-btn-active {
    border-color: #0D5C75 !important;
    background-color: rgba(13, 92, 117, 0.08) !important;
    color: #0D5C75 !important;
    border-left: 4px solid #0D5C75 !important;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05) !important;
}
[dir="rtl"] .legal-btn-active {
    border-left: 1px solid #0D5C75 !important;
    border-right: 4px solid #0D5C75 !important;
}

/* 8. High-Contrast Evaluation Rubric (WCAG AA Compliant >= 4.5:1) */
.badge-eval-rubric {
    color: #78350F !important;
    background-color: #FEF3C7 !important;
    border: 1px solid rgba(180, 83, 9, 0.3) !important;
}
.btn-eval-rubric {
    color: #78350F !important;
    border: 1px solid rgba(180, 83, 9, 0.4) !important;
}
.btn-eval-rubric:hover {
    background-color: #B45309 !important;
    color: #FFFFFF !important;
}

/* 9. Card Micro-Interactions & Hover Polish */
.interactive-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.interactive-card:hover {
    transform: translateY(-2px);
    border-color: rgba(13, 92, 117, 0.35);
}

/* 10. Smooth Horizontal Touch Scrolling for Nav */
.nav-scroll-container {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.nav-scroll-container::-webkit-scrollbar {
    display: none;
}

/* Bilingual rich blocks: both languages are rendered, the inactive one is hidden */
html[lang="ar"] .only-en, html:not([lang="ar"]) .only-ar { display: none !important; }
