/* CEP Header — 20261107. Scoped to a successfully mounted CEP header. */
body.cep-header-active {
    --cep-header-navy: #02285B;
    --cep-header-blue: #003780;
    --cep-header-gold: #827746;
    --cep-header-row-height: 82px;
    --cep-header-height: 128px;
    --headerh: var(--cep-header-height) !important;
}
html { scroll-padding-top: calc(var(--cep-header-offset, 0px) + 12px); }
body.cep-header-active #main-header {
    position: sticky !important;
    top: 0 !important;
    z-index: 1045 !important;
    background: #FFFFFF !important;
    box-shadow: 0 6px 24px rgba(3,21,52,.07);
}
body.cep-header-active #master-header,
body.cep-header-active #master-header.sticky-el {
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    transform: none !important;
    z-index: auto !important;
}
body.cep-header-active #master-header .master-header-inner,
body.cep-header-active #master-header .master-header-inner-bg {
    background: #FFFFFF !important;
    box-shadow: none !important;
    border: 0 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}
body.cep-header-active #master-header .master-header-inner::before,
body.cep-header-active #master-header .master-header-inner::after { display: none !important; }
body.cep-header-active.cep-header-single-row #main-navigation,
body.cep-header-active #main-header .sticky-replace-el,
body.cep-header-active #master-header .cep-header-row > .menu-toggle { display: none !important; }
body.cep-header-active #master-header .cep-header-row {
    position: relative;
    width: min(1180px, calc(100vw - 40px));
    max-width: 100%;
    margin-inline: auto;
    min-height: var(--cep-header-row-height) !important;
    height: auto !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 18px;
    isolation: isolate;
    overflow: visible !important;
}
/* Reuse the platform typefaces without affecting icon-font controls. */
body.cep-header-active #main-header { font-family: "Inter", Arial, sans-serif; }
html[lang^="ar"] body.cep-header-active #main-header {
    font-family: "IBM Plex Sans Arabic", Tahoma, Arial, sans-serif;
}
.cep-primary-nav a,
.cep-topbar a,
.cep-header-language-button { font-family: inherit !important; }

/* Upper bar: contact at the start, privacy and course proposals at the end. */
.cep-topbar {
    position: relative;
    background: #02285B;
    color: #FFFFFF;
    border-bottom: 1px solid rgba(184,169,95,.4);
}
.cep-topbar__inner {
    box-sizing: border-box;
    width: min(1180px, calc(100% - 40px));
    min-height: 46px;
    margin-inline: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-block: 5px;
}
.cep-topbar__actions { display: flex; align-items: center; gap: 16px; }
.cep-topbar .cep-primary-nav__utility-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 34px;
    padding: 3px 0;
    color: #FFFFFF !important;
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1.6;
    text-decoration: none !important;
    white-space: nowrap;
}
.cep-topbar .cep-topbar__contact { flex-wrap: wrap; gap: 8px; }
.cep-topbar__contact-label { color: #E3EAF5; }
.cep-topbar__contact bdi { font-family: "Inter", Arial, sans-serif; font-size: 12px; letter-spacing: .015em; }
.cep-topbar .cep-topbar__offer {
    gap: 8px;
    padding: 4px 12px;
    border: 1px solid rgba(184,169,95,.7);
    border-radius: 7px;
    background: rgba(255,255,255,.06);
    font-weight: 600;
}
/* Keep every topbar link on the same subtle navy/gold hover treatment.
   Specificity prevents the main navigation's light hover from leaking in. */
.cep-topbar .cep-primary-nav__utility-link:hover,
.cep-topbar .cep-primary-nav__utility-link:focus-visible {
    background: rgba(255,255,255,.13);
    color: #EEE5BD !important;
}
.cep-topbar .cep-topbar__contact:hover .cep-topbar__contact-label,
.cep-topbar .cep-topbar__contact:focus-visible .cep-topbar__contact-label {
    color: inherit;
}

/* Logo, links, language, and native Moodle tools share the main row. */
body.cep-header-active #master-header .logo-wrap {
    flex: 0 0 auto;
    width: auto;
    max-width: 165px !important;
    margin: 0 !important;
    position: relative;
    z-index: 2200;
}
body.cep-header-active #master-header .main-logo a { display: flex !important; align-items: center; }
body.cep-header-active #master-header .main-logo img,
body.cep-header-active #master-header.sticky-el .main-logo img {
    width: auto !important;
    max-width: 165px !important;
    height: 54px !important;
    object-fit: contain;
}
.cep-primary-nav {
    flex: 1 1 auto;
    min-width: 0;
    position: relative !important;
    z-index: 2250;
    pointer-events: auto;
}
.cep-primary-nav__panel { display: flex; align-items: center; justify-content: center; gap: 10px; }
.cep-primary-nav__links { display: flex; align-items: center; justify-content: center; gap: 3px; }
.cep-primary-nav__link,
.cep-primary-nav__utility-link {
    box-sizing: border-box;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 44px;
    padding: 9px 11px;
    border-radius: 9px;
    color: #02285B !important;
    text-decoration: none !important;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.7;
    transition: color .18s ease, background-color .18s ease;
}
html[lang^="ar"] .cep-primary-nav__link { font-size: 15px; }
.cep-primary-nav__link::after {
    content: "";
    position: absolute;
    inset-inline: 12px;
    bottom: 4px;
    height: 2px;
    border-radius: 2px;
    background: #827746;
    transform: scaleX(0);
    transition: transform .18s ease;
}
.cep-primary-nav__link:hover,
.cep-primary-nav__link:focus-visible,
.cep-primary-nav__link.is-active,
.cep-primary-nav__utility-link:hover { background: #F1F5FA; color: #003780 !important; }
.cep-primary-nav__link:hover::after,
.cep-primary-nav__link:focus-visible::after,
.cep-primary-nav__link.is-active::after { transform: scaleX(1); }
.cep-primary-nav__utility { border-inline-start: 1px solid #E2E8F0; padding-inline-start: 5px; }
.cep-primary-nav__utility-icon { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 20px; width: 20px; height: 20px; }
.cep-primary-nav__utility-icon svg { display: block; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
/* Search remains available, with a visible label on small screens. */
@media (min-width: 1101px) {
    .cep-primary-nav__utility-link[data-cep-nav="search"] { width: 40px; padding-inline: 9px; font-size: 0; gap: 0; }
}
body.cep-header-active .cep-header-controls { flex: 0 0 auto; display: inline-flex; align-items: center; z-index: 2300; }
body.cep-header-active .header-tools-wrap,
body.cep-header-active .cep-header-row > .header-tools {
    position: relative !important;
    z-index: 2350;
    flex: 0 0 auto;
    margin: 0 !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: max-content !important;
    pointer-events: auto;
}
body.cep-header-active #master-header .header-tools,
body.cep-header-active #master-header .theme-plugins {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    width: auto !important;
    max-width: max-content !important;
    overflow: visible !important;
}
body.cep-header-active .header-tools .header-tools-link:not(.loginbtn),
body.cep-header-active .header-tools .popover-region-toggle {
    min-width: 36px;
    min-height: 36px;
    max-width: none !important;
    padding: 4px !important;
    border-radius: 10px;
    color: #02285B !important;
    background: transparent !important;
}
body.cep-header-active .header-tools .header-tools-link:not(.loginbtn):hover,
body.cep-header-active .header-tools .popover-region-toggle:hover { background: #F1F5FA !important; }
body.cep-header-active .header-tools .text1 { color: inherit; }
body.cep-header-active .cep-header-language-button {
    position: relative !important;
    flex: 0 0 auto !important;
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    align-items: center;
    justify-content: center;
    min-width: 38px !important;
    height: 38px !important;
    margin: 0 !important;
    padding: 0 8px !important;
    border: 1px solid #D7DFE9 !important;
    border-radius: 10px !important;
    background: #FFFFFF !important;
    color: #02285B !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    line-height: 1 !important;
    text-decoration: none !important;
}
body.cep-header-active .cep-header-language-button:hover { background: #F1F5FA !important; }
/* Own areas remain separate from New Learning click overlays. */
.cep-primary-nav::before,
.cep-primary-nav::after,
.cep-primary-nav__links::before,
.cep-primary-nav__links::after { pointer-events: none !important; }
body.cep-header-active .cep-primary-nav a,
body.cep-header-active .cep-topbar a,
body.cep-header-active .logo-wrap a { position: relative !important; pointer-events: auto !important; }

/* One mobile menu panel prevents separate blocks overlapping each other. */
.cep-primary-nav__toggle {
    display: none;
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid #D7DFE9;
    border-radius: 10px;
    background: #FFFFFF;
    color: #02285B;
    cursor: pointer;
}
.cep-primary-nav__toggle-lines,
.cep-primary-nav__toggle-lines::before,
.cep-primary-nav__toggle-lines::after { display: block; width: 18px; height: 2px; border-radius: 2px; background: currentColor; }
.cep-primary-nav__toggle-lines { position: relative; margin: auto; }
.cep-primary-nav__toggle-lines::before,
.cep-primary-nav__toggle-lines::after { content: ""; position: absolute; inset-inline-start: 0; }
.cep-primary-nav__toggle-lines::before { top: -6px; }
.cep-primary-nav__toggle-lines::after { top: 6px; }
.cep-primary-nav__toggle[aria-expanded="true"] .cep-primary-nav__toggle-lines { background: transparent; }
.cep-primary-nav__toggle[aria-expanded="true"] .cep-primary-nav__toggle-lines::before { transform: translateY(6px) rotate(45deg); }
.cep-primary-nav__toggle[aria-expanded="true"] .cep-primary-nav__toggle-lines::after { transform: translateY(-6px) rotate(-45deg); }
@media (max-width: 1100px) {
    body.cep-header-active { --cep-header-row-height: 72px; }
    body.cep-header-active #master-header .cep-header-row { gap: 9px; }
    body.cep-header-active #master-header .logo-wrap { max-width: 145px !important; }
    body.cep-header-active #master-header .main-logo img { max-width: 145px !important; height: 46px !important; }
    body.cep-header-active .cep-header-controls { margin-inline-start: auto; }
    body.cep-header-active .header-tools .text1 { display: none !important; }
    .cep-primary-nav__toggle { display: grid; place-items: center; }
    .cep-primary-nav__panel {
        position: fixed;
        top: calc(var(--cep-header-height) + 8px);
        inset-inline: 14px;
        display: none;
        max-height: calc(100vh - var(--cep-header-height) - 22px);
        max-height: calc(100dvh - var(--cep-header-height) - 22px);
        overflow-y: auto;
        padding: 12px;
        border: 1px solid #E2E8F0;
        border-radius: 14px;
        background: #FFFFFF;
        box-shadow: 0 15px 40px rgba(3,21,52,.16);
    }
    .cep-primary-nav.is-open .cep-primary-nav__panel { display: block; }
    .cep-primary-nav__links { flex-direction: column; align-items: stretch; gap: 4px; }
    .cep-primary-nav__link,
    .cep-primary-nav__panel .cep-primary-nav__utility-link { width: 100%; justify-content: flex-start; padding: 11px 14px; text-align: start; }
    .cep-primary-nav__link::after { display: none; }
    .cep-primary-nav__utility { margin-top: 8px; padding: 8px 0 0; border-inline-start: 0; border-top: 1px solid #E2E8F0; }
    body.cep-mobile-menu-open { overflow: hidden !important; }
}
@media (max-width: 620px) {
    body.cep-header-active { --cep-header-row-height: 66px; }
    .cep-topbar__inner { width: calc(100% - 28px); flex-direction: column; gap: 0; padding-block: 5px; }
    .cep-topbar .cep-topbar__contact { min-height: 27px; }
    .cep-topbar__actions { justify-content: space-between; width: 100%; gap: 10px; }
    .cep-topbar .cep-primary-nav__utility-link { font-size: 11px; min-height: 31px; }
    .cep-topbar .cep-topbar__offer { padding: 3px 7px; }
    .cep-topbar__contact bdi { font-size: 11px; }
    body.cep-header-active #master-header .cep-header-row { width: calc(100vw - 24px); gap: 5px; }
    body.cep-header-active #master-header .logo-wrap { max-width: 100px !important; }
    body.cep-header-active #master-header .main-logo img { max-width: 100px !important; height: 38px !important; }
    body.cep-header-active #master-header .header-tools,
    body.cep-header-active #master-header .theme-plugins { gap: 2px !important; }
    body.cep-header-active .header-tools .header-tools-link:not(.loginbtn),
    body.cep-header-active .header-tools .popover-region-toggle { min-width: 30px; min-height: 34px; padding: 2px !important; }
    body.cep-header-active .cep-header-language-button { min-width: 32px !important; height: 34px !important; padding: 0 5px !important; font-size: 11px !important; }
    .cep-primary-nav__toggle { width: 34px; height: 34px; }
}
/* Match the theme's mobile popover breakpoint. The added utility bar must
   not become extra spacing inside native notification/message panels. */
@media (max-width: 576px) {
    body.cep-header-active #master-header .header-tools-wrap,
    body.cep-header-active #master-header .cep-header-row > .header-tools {
        position: static !important;
    }
    body.cep-header-active #master-header .popover-region-container {
        width: min(340px, calc(100vw - 28px));
        max-width: calc(100vw - 28px);
        top: 100%;
        left: 50%;
        right: auto;
        margin: 0;
        transform: translateX(-50%);
    }
}
.cep-primary-nav a:focus-visible,
.cep-topbar a:focus-visible,
.cep-header-language-button:focus-visible,
.cep-header-controls button:focus-visible { outline: 3px solid #B8A95F; outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) {
    .cep-primary-nav *, .cep-topbar * { transition: none !important; }
}
