.wa { background: #25D366; }
.wa img { filter: drop-shadow(0 0 1px #075e54) drop-shadow(0 1px 1px #075e54); }

/* تبديل نصوص الأقسام الجديدة عبر CSS مباشرة دون الاعتماد على JS */
[data-lang] { display: none; }
html[lang="ar"] [data-lang="ar"],
html[lang="en"] [data-lang="en"],
html[lang="tr"] [data-lang="tr"],
html[lang="de"] [data-lang="de"],
html:not([lang]) [data-lang="ar"] { display: inline; }

.back-top { display: none; }
@media (max-width: 680px) {
    .back-top:not([hidden]) {
        display: grid;
        position: fixed;
        inset-inline-start: 16px;
        bottom: calc(16px + env(safe-area-inset-bottom, 0px));
        z-index: 30;
        place-items: center;
        width: 52px;
        height: 52px;
        border: 1px solid var(--lav);
        border-radius: 50%;
        background: var(--dp);
        color: #fff;
        box-shadow: 0 6px 20px #0004;
        font-size: 24px;
        cursor: pointer;
    }
    body:has(#cmp:not([hidden])) > .back-top { visibility: hidden; }
}
.footer-legal {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px 20px;
    margin-block-start: 18px;
    padding-block-start: 14px;
    border-top: 1px solid #d9a6d655;
    color: var(--lav);
    font-size: 13px;
}
.footer-legal { align-items: center; }
.footer-legal p { margin: 0; }
.footer-sponsor {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
}
.footer-sponsor a { flex: none; border-radius: 6px; }
.footer-sponsor a:focus-visible { outline: 2px solid var(--lav); outline-offset: 3px; }
.footer-sponsor img {
    display: block;
    width: auto;
    height: 40px;
    object-fit: contain;
    border-radius: 6px;
}
@media (width < 640px) {
    .footer-legal { justify-content: center; text-align: center; }
    .footer-legal-links { justify-content: center; }
    .footer-sponsor { width: 100%; }
}
.footer-legal-links { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.legal-page { max-width: 820px; padding-block: 32px 20px; }
.legal-page h1 { margin-block-end: 16px; }
.legal-page h2 { font-size: 20px; margin-block-end: 4px; }
.legal-page section { padding: 15px 0; border-block-end: 1px solid var(--bd); }
.legal-page p { margin: 0; }

/* --- قسم لماذا وافدين؟ --- */
.trust {
    padding-block: 42px 54px;
}
.trust h2 {
    text-align: center;
    margin-bottom: 24px;
}
.trust-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-block-start: 14px;
}
@media (max-width: 820px) {
    .trust-cards { grid-template-columns: minmax(0, 1fr); }
}
.trust-card {
    position: relative;
    background: var(--card);
    border: 1.5px solid var(--bd);
    border-radius: 22px;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow: hidden;
    transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.trust-card::before {
    content: "";
    position: absolute;
    inset-inline: 0;
    top: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--pk), var(--vi));
    opacity: .85;
}
.trust-card:hover {
    transform: translateY(-5px);
    border-color: var(--vi);
    box-shadow: 0 14px 32px color-mix(in srgb, var(--dp) 16%, transparent);
}
.trust-head {
    display: flex;
    align-items: center;
    gap: 12px;
}
.trust-check {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--pk), var(--vi));
    color: #fff;
    display: grid;
    place-items: center;
    box-shadow: 0 6px 16px color-mix(in srgb, var(--pk) 35%, transparent);
}
.trust-card h3 {
    font-size: 18px;
    font-weight: 800;
    color: var(--tx);
    line-height: 1.4;
}
.trust-cards p {
    margin: 0;
    font-size: 14.5px;
    color: var(--mut);
    line-height: 1.65;
}

/* --- قسم إنجازات وأرقام وافدين (الخلفية الداكنة والنص الذهبي) --- */
.stats-section {
    position: relative;
    background: radial-gradient(ellipse at 85% 20%, color-mix(in srgb, var(--vi) 45%, transparent), transparent 60%),
                radial-gradient(ellipse at 15% 85%, color-mix(in srgb, var(--pk) 28%, transparent), transparent 55%),
                var(--dk);
    color: #fff;
    padding-block: 56px 64px;
    margin-block-start: 12px;
    border-top: 1px solid #d9a6d633;
    border-bottom: 1px solid #d9a6d633;
}
.stats-header {
    text-align: center;
    margin-bottom: 32px;
}
.stats-header h2 {
    color: #fff;
    font-size: clamp(24px, 3.5vw, 32px);
}
.stats-header p {
    color: var(--lav);
    margin: 6px auto 0;
    max-width: 560px;
    font-size: 15px;
}
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}
@media (max-width: 900px) {
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: minmax(0, 1fr); }
}
.stat-card {
    position: relative;
    background: linear-gradient(160deg, #2f1654 0%, #230f40 100%);
    border: 1.5px solid #d9a6d638;
    border-radius: 22px;
    padding: 26px 18px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    box-shadow: 0 10px 28px #0d041a66;
    transition: transform .28s cubic-bezier(.2,.8,.2,1),
                box-shadow .28s ease,
                border-color .28s ease,
                background .28s ease;
}
.stat-card:hover {
    transform: translateY(-6px) scale(1.015);
    border-color: #f5c77e99;
    background: linear-gradient(160deg, #3a1c66 0%, #281149 100%);
    box-shadow: 0 18px 40px #09021299, 0 0 22px #f5c77e22;
}
.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: #f5c77e1a;
    border: 1px solid #f5c77e44;
    color: #F5C77E;
    display: grid;
    place-items: center;
    margin-bottom: 2px;
    transition: transform .28s ease, background .28s ease;
}
.stat-card:hover .stat-icon {
    transform: scale(1.08);
    background: #f5c77e2b;
}
.stat-value {
    font-family: Poppins, Cairo, sans-serif;
    font-size: clamp(32px, 4vw, 42px);
    font-weight: 800;
    line-height: 1.1;
    color: #F5C77E;
    direction: ltr;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    text-shadow: 0 4px 18px #f5c77e33;
}
.stat-suffix {
    color: #E2A857;
    font-weight: 800;
}
.stat-label {
    font-size: 15px;
    font-weight: 700;
    color: #F3E5F7;
    margin: 0;
}
main[data-page="index"] + footer {
    margin-top: 0;
}

@media (prefers-reduced-motion: no-preference) {
    .section-reveal {
        opacity: 0;
        transform: translateY(12px);
        transition: opacity 450ms ease-out, transform 450ms ease-out;
    }
    .section-reveal:nth-child(2n) { transition-delay: 55ms; }
    .section-reveal:nth-child(3n) { transition-delay: 110ms; }
    .section-reveal.section-revealed, .section-reveal:focus-within {
        opacity: 1;
        transform: none;
    }
    .section-reveal:focus-within { transition: none; }
}

/* University profile */
main[data-page="university"] {
    --profile-ink: #3B1B5E;
    --profile-muted: #5B4B6E;
    --profile-tint: #F8F4FA;
    --profile-border: #E9D8F2;
    --profile-rule: #EFE6F5;
    --profile-accent: #8E3FB0;
    color: var(--profile-ink);
    background: #fff;
    color-scheme: light;
}
#university-detail a:not(.btn) { color: var(--profile-ink); }
#university-detail :focus-visible { outline: 2px solid var(--profile-accent); outline-offset: 3px; }
.profile-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 6px 16px;
    border: 1px solid #D9A6D6;
    border-radius: 999px;
    background: #FAF5FC;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}
.profile-back:hover { text-decoration: underline; }
.profile-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: center;
    gap: clamp(20px, 4vw, 48px);
    padding-block: 24px;
    border-block-end: 1px solid var(--profile-rule);
}
.profile-hero-no-gallery { grid-template-columns: minmax(0, 1fr); }
.profile-heading {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: clamp(10px, 2vw, 18px);
}
.profile-heading > div:only-child { grid-column: 1 / -1; }
.profile-heading h1 { color: var(--profile-ink); font-size: clamp(24px, 3vw, 40px); }
.profile-heading .university-logo {
    inline-size: clamp(55px, 8vw, 88px);
    block-size: clamp(55px, 8vw, 88px);
    border-color: var(--profile-border);
}
.profile-badges, .university-ranking-cards {
    display: flex;
    flex-wrap: wrap;
    padding: 0;
    list-style: none;
}
.profile-badges { gap: 6px; margin: 8px 0 0; }
.profile-badges li {
    padding: 3px 10px;
    border: 1px solid var(--profile-border);
    border-radius: 999px;
    background: var(--profile-tint);
    color: var(--profile-muted);
    font-size: 13px;
}
.university-rankings { padding: 0; margin-block: 16px; }
.university-rankings .note { color: var(--profile-muted); }
.university-ranking-cards {
    align-items: stretch;
    margin: 0;
    border: 1px solid var(--profile-border);
    border-radius: 12px;
    background: var(--profile-tint);
}
.university-ranking-card {
    display: grid;
    flex: 1 1 0;
    min-inline-size: 0;
    align-content: start;
    justify-items: start;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--profile-muted);
}
.university-ranking-card:not(:last-child) { border-inline-end: 1px solid var(--profile-border); }
#university-detail .university-ranking-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    color: var(--profile-accent);
    font-size: 22px;
    font-weight: 700;
    text-underline-offset: 4px;
}
.university-ranking-link span { font-size: 13px; }
.profile-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.profile-actions .btn {
    min-height: 44px;
    padding: 7px 14px;
    font-family: inherit;
    font-size: 13px;
    text-align: center;
}
.profile-actions .p { background: #D1327A; color: #fff; }
.profile-actions .p:hover { background: #A3235F; }
.profile-actions .o {
    border: 1px solid var(--profile-border);
    color: var(--profile-ink);
    background: var(--profile-tint);
}
.profile-actions .o:hover, .profile-actions .o[aria-expanded="true"] { border-color: var(--profile-accent); }
.profile-campus { min-width: 0; margin: 0; }
.profile-campus .campus-photo {
    aspect-ratio: 4 / 3;
    border: 1px solid var(--profile-border);
    background: var(--profile-tint);
}
.profile-campus .campus-photo-portrait, #map-selected .campus-photo-portrait { object-fit: contain; }
.profile-campus figcaption {
    margin-top: 5px;
    color: var(--profile-muted);
    font-size: 11px;
}
.profile-map, .profile-fee-references, .profile-programs { padding-block: 20px; }
.profile-map, .profile-fee-references { border-block-end: 1px solid var(--profile-rule); }
.profile-program-table,
.fee-table-two-column { table-layout: fixed; }
.profile-program-table th:first-child,
.fee-table-two-column th:first-child { width: 54%; }
.profile-program-price { font-weight: 700; }
.profile-program-table .note { margin: 3px 0 0; font-size: 12px; }
.profile-program-details {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 8px;
    margin-block-start: 2px;
    font-size: 12px;
}
.profile-program-details a {
    display: inline-block;
    padding-block: 4px;
    text-underline-offset: 2px;
}
@media (max-width: 760px) {
    .profile-hero { grid-template-columns: minmax(0, 1fr); }
}

.fee-audience {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-block: 20px;
    width: fit-content;
    max-width: 100%;
    padding: 5px;
    background: #F8F4FA;
    border: 1px solid #E9D8F2;
    border-radius: 14px;
}
.fee-audience a {
    display: grid;
    align-items: center;
    min-block-size: 44px;
    padding-inline: 14px;
    border-radius: 9px;
    color: #3B1B5E;
    font-weight: 700;
    text-decoration: none;
    white-space: normal;
}
#university-detail .fee-audience a[aria-current],
.fee-audience a[aria-current] { background: #3B1B5E; color: #fff; }
.fee-audience a:focus-visible { outline: 2px solid #8E3FB0; outline-offset: 2px; }

.fee-table-frame {
    --fee-base: #fff;
    --fee-ink: #3B1B5E;
    --fee-muted: #5B4B6E;
    --fee-rule: #E9D8F2;
    --fee-tint: #F8F4FA;
    margin-block-start: 12px;
    border: 1px solid var(--fee-rule);
    border-radius: 14px;
    overflow: hidden;
}
.fee-table-frame > table {
    width: 100%;
    margin: 0;
    border: 0;
    border-radius: 0;
    border-collapse: separate;
    border-spacing: 0;
    overflow: visible;
    background: var(--fee-base);
}
.fee-table-frame > table tr > :is(th, td) {
    padding: 12px clamp(10px, 1.7vw, 18px);
    border: 0;
    border-block-end: 1px solid var(--fee-rule);
    background: var(--fee-base);
    color: var(--fee-ink);
    text-align: start;
    vertical-align: top;
    white-space: normal;
    overflow-wrap: anywhere;
}
.fee-table-frame > table tr > :not(:last-child) { border-inline-end: 1px solid var(--fee-rule); }
.fee-table-frame > table thead th,
.fee-table-frame > table tbody tr:nth-child(even) > *,
.fee-table-frame > table tbody tr:target > * { background: var(--fee-tint); }
.fee-table-frame > table tbody tr:last-child > * { border-block-end: 0; }
.fee-table-frame > table tbody td { font-variant-numeric: tabular-nums; }
.fee-table-frame > table a { color: #3B1B5E; }
.fee-table-frame > table .note, .fee-table-frame .profile-program-year { color: var(--fee-muted); }
.fee-table-frame > table tbody tr:target > th { box-shadow: inset 0 -2px 0 #8E3FB0; }
.fee-cell-label { display: none; }
.fee-breakdown { margin: 0; }
.fee-breakdown > div + div { margin-block-start: 6px; }
.fee-breakdown dt { color: var(--fee-muted); font-size: .85em; }
.fee-breakdown dd { margin: 0; font-weight: 600; }
#university-detail .fee-section > .note { color: var(--profile-muted); }
[id^="public-fee-"] { scroll-margin-block-start: 88px; }

@media (max-width: 640px) {
    #university-detail .profile-programs > h2,
    #university-detail .fee-section > h2 { font-size: clamp(1.25rem, 4vw, 1.55rem); }
    .fee-table-frame > table tr > :is(th, td) {
        padding: 9px 10px;
        line-height: 1.55;
    }
    .fee-table-frame > :is(.profile-program-table, .fee-table-two-column) tbody td {
        font-size: 13px;
    }

    /* Only schedules with multiple fee columns need a second row on narrow screens. */
    .fee-table-frame > table:not(.profile-program-table, .fee-table-two-column),
    .fee-table-frame > table:not(.profile-program-table, .fee-table-two-column) tbody {
        display: block;
    }
    .fee-table-frame > table:not(.profile-program-table, .fee-table-two-column) thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
    }
    .fee-table-frame > table:not(.profile-program-table, .fee-table-two-column) tbody tr {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        border-block-end: 1px solid var(--fee-rule);
        background: var(--fee-base);
    }
    .fee-table-frame > table:not(.profile-program-table, .fee-table-two-column) tbody tr:nth-child(even),
    .fee-table-frame > table:not(.profile-program-table, .fee-table-two-column) tbody tr:target {
        background: var(--fee-tint);
    }
    .fee-table-frame > table:not(.profile-program-table, .fee-table-two-column) tbody tr:last-child {
        border-block-end: 0;
    }
    .fee-table-frame > table:not(.profile-program-table, .fee-table-two-column) tbody tr > * {
        display: block;
        border: 0;
        background: transparent;
    }
    .fee-table-frame > table:not(.profile-program-table, .fee-table-two-column) tbody th {
        grid-column: 1 / -1;
        padding-block-end: 1px;
    }
    .fee-table-frame > table:not(.profile-program-table, .fee-table-two-column) .fee-cell-label {
        display: block;
        color: var(--fee-muted);
        font-size: .81em;
        line-height: 1.4;
    }
}

#university-detail .reference-fee-amount, .reference-fee-amount {
    display: inline-block;
    color: var(--link);
    font-size: inherit;
    font-weight: 700;
    text-underline-offset: 3px;
}
#university-detail .reference-fee-amount { color: var(--profile-accent); }

.directory-map-layout { display: grid; gap: 16px; }
.directory-map-sidebar, .directory-map-view { min-inline-size: 0; }
.directory-map-sidebar {
    padding: 14px;
    border: 1px solid var(--bd);
    border-radius: 14px;
    background: var(--card);
}
.directory-map-sidebar label { display: block; margin-block-end: 6px; font-weight: 700; }
.directory-map-sidebar #campus-picker { width: 100%; }
#map-selected:empty, #map-status:empty { display: none; }
#map-selected .campus-card { background: var(--bg); }
#directory-map.leaflet-container { font-family: inherit; }
#directory-map .leaflet-popup-content { text-align: start; font-family: inherit; }
#directory-map .campus-popup a { color: #D1327A; font-weight: 700; }
#directory-map .leaflet-top.leaflet-left { top: 10px; }
@media (min-width: 900px) {
    .directory-map-layout { grid-template-columns: 360px minmax(0, 1fr); align-items: start; }
    #directory-map { min-height: 480px; }
}

.home-explore-section {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding-block: 0 42px;
}
.home-explore-section h2 { overflow-wrap: anywhere; }
.home-explore-section .ad-side-corner {
    inline-size: 100%;
    max-inline-size: 400px;
    margin-inline: auto;
}
.home-explore-section .explore-divider {
    block-size: 1px;
    background: #e5d8f0;
}
.home-explore-section .home-links { min-inline-size: 0; }
.home-explore-section .cards {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
}
.home-explore-section .section-link {
    min-block-size: 70px;
    padding: 10px 12px;
    border-radius: 14px;
    overflow-wrap: anywhere;
}
.home-explore-section .section-preview,
.home-explore-section .course-promo-preview {
    inline-size: 42px;
    block-size: 42px;
    flex: 0 0 42px;
    border-radius: 8px;
}
.home-explore-section .course-promo-preview { object-fit: cover; }
.phase2-ad {
    display: block;
    inline-size: 100%;
    overflow: hidden;
    border: 1px solid var(--bd);
    border-radius: 18px;
    background: var(--dp);
    color: #fff;
    text-decoration: none;
}
.phase2-ad img { display: block; width: 100%; height: auto; }
.phase2-ad-caption {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 14px;
    border-block-start: 2px solid #e8ba56;
    text-align: center;
    font-weight: 700;
}
.phase2-ad:hover .phase2-ad-caption,
.phase2-ad:focus-visible .phase2-ad-caption { text-decoration: underline; }

.phase2-ad-arrow {
    flex: none;
    color: #e8ba56;
    font-size: 1.15em;
}
[dir="rtl"] .phase2-ad-arrow { transform: scaleX(-1); }
@media (prefers-reduced-motion: no-preference) {
    .phase2-ad:is(:hover, :focus-visible) .phase2-ad-arrow {
        animation: phase2-arrow-pulse 650ms ease-in-out;
    }
    @keyframes phase2-arrow-pulse {
        50% { scale: 1.2; }
    }
}

@media (min-width: 480px) {
    .home-explore-section .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 992px) {
    .home-explore-section.explore-container {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 1px 340px;
        grid-template-rows: auto 1fr;
        gap: 0 2rem;
        align-items: stretch;
    }
    .home-explore-section .explore-content,
    .home-explore-section .ad-side-corner {
        display: grid;
        grid-template-rows: subgrid;
        grid-row: 1 / 3;
    }
    .home-explore-section .explore-content { grid-column: 1; }
    .home-explore-section .explore-divider {
        grid-column: 2;
        grid-row: 1 / 3;
        block-size: auto;
    }
    .home-explore-section .ad-side-corner { grid-column: 3; }
    .home-explore-section .compact-cards { grid-template-rows: repeat(3, 1fr); }
    .home-explore-section .phase2-ad {
        display: flex;
        flex-direction: column;
    }
    .home-explore-section .phase2-ad img { flex: none; }
    .home-explore-section .phase2-ad-caption { flex: 1; }
}

.phase2-intro { padding-block: 44px 20px; }
.phase2-intro h1, .phase2-table-section h2, .phase2-apply h2 { overflow-wrap: anywhere; }
.phase2-dates {
    border-inline-start: 3px solid #e8ba56;
    padding-inline-start: 12px;
    font-weight: 800;
}
#phase2-filter { max-inline-size: 36rem; }
.phase2-jump-panel { margin-block-start: 16px; }
.phase2-jump-toggle { display: none; }
.phase2-jump { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 767px) {
    .phase2-jump-toggle {
        display: flex;
        justify-content: space-between;
        inline-size: 100%;
        min-block-size: 44px;
        background: var(--card);
        text-align: start;
    }
    .phase2-jump-toggle::after {
        content: "";
        inline-size: .5em;
        block-size: .5em;
        border-inline-end: 2px solid currentColor;
        border-block-end: 2px solid currentColor;
        transform: rotate(45deg);
    }
    [dir="rtl"] .phase2-jump-toggle::after { transform: rotate(-45deg); }
    .phase2-jump-toggle[aria-expanded="true"]::after { rotate: 180deg; }
    .phase2-jump-toggle[aria-expanded="false"] + .phase2-jump { display: none; }
    .phase2-jump {
        flex-direction: column;
        margin-block-start: 8px;
    }
    .phase2-jump .btn { justify-content: start; min-block-size: 44px; }
}
.phase2-jump .btn {
    max-inline-size: 100%;
    min-inline-size: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    text-align: start;
    font-size: .9rem;
}
.phase2-table-section { padding-block: 16px; scroll-margin-block-start: 95px; }
.phase2-table { table-layout: fixed; border-color: var(--bd); font-size: .95rem; }
.phase2-table th, .phase2-table td { text-align: start; overflow-wrap: anywhere; }
.phase2-table thead th:first-child { width: 36%; }
.phase2-table thead th:last-child { width: 30%; }
.phase2-table .phase2-category th {
    background: var(--card);
    color: var(--tx);
    border-block-start: 2px solid #e8ba56;
}
.phase2-table .phase2-program th {
    color: var(--tx);
    background: transparent;
    border-block-start: 1px solid var(--bd);
}
.phase2-apply { padding-block: 32px 44px; }
@media (max-width: 479px) {
    .phase2-table { font-size: .875rem; }
    .phase2-table th, .phase2-table td { padding: 7px 5px; }
}
