/* =====================================================================
   /adl/assets/css/adl-header.css
   Header-only styles (Login/Logout icon buttons, ministry logo size). The three header files link it
   themselves, so the header looks right even on a page that does not load adl-theme.css.
   Colours are literal on purpose (no dependency on the theme's :root variables).
   ===================================================================== */

/* header Login / Logout buttons, next to the language switch (DevOps #292; the ribbon has no login/logout any more).
   Icon only; the word shows in a small navy label under the icon on hover or keyboard focus.
   Colours from the Adl platform: navy #1B3065, blue gradient #4A65B2 -> #365090. */
.header .header-login {
    position: relative;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background: #fff;
    border: 1px solid #cfd6e3;
    border-radius: 50%;
    color: #1B3065;
    text-decoration: none;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .18s ease, border-color .18s ease, box-shadow .18s ease, transform .12s ease;
}

/* the Logout one is a <button> */
.header button.header-login {
    appearance: none;
    -webkit-appearance: none;
    font: inherit;
}

.header .header-login img {
    width: 40px;
    height: 40px;
    display: block;
    transition: filter .18s ease;
}

.header .header-login:hover,
.header .header-login:focus-visible {
    background: linear-gradient(135deg, #4A65B2 0%, #365090 100%);
    border-color: transparent;
    box-shadow: 4px 4px 20px 0 rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
    outline: none;
}

.header .header-login:hover img,
.header .header-login:focus-visible img {
    filter: brightness(0) invert(1);
}

/* the word: both languages are in the markup, the page language decides (works without JavaScript) */
.header .header-login .hl-ar,
.header .header-login .hl-en {
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translate(-50%, -4px);
    padding: 6px 12px;
    background: #1B3065;
    color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 14px rgba(27, 48, 101, .3);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .15s ease, transform .15s ease, visibility .15s ease;
    z-index: 1100;
}

.header .header-login .hl-ar::before,
.header .header-login .hl-en::before {
    content: "";
    position: absolute;
    bottom: 100%;
    left: 50%;
    margin-left: -6px;
    border: 6px solid transparent;
    border-bottom-color: #1B3065;
}

.header .header-login:hover .hl-ar,
.header .header-login:hover .hl-en,
.header .header-login:focus-visible .hl-ar,
.header .header-login:focus-visible .hl-en {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}

.header .header-login .hl-en {
    display: none;
}

html[lang="en"] .header .header-login .hl-en {
    display: block;
}

html[lang="en"] .header .header-login .hl-ar {
    display: none;
}

/* phones: a little smaller, so the header still fits one row */
@media (max-width: 768px) {
    .header .header-login,
    .header .header-login img {
        width: 34px;
        height: 34px;
    }
}

/* small tablets: the two secondary round icons go, so nothing touches the centred "منصة عدل" */
@media (min-width: 769px) and (max-width: 900px) {
    .header .header-actions .icon-btn.desktop-only {
        display: none !important;
    }
}

/* header logo: same size as on adl pages (adlN pages do not load searchPages/style.css) */
.header .ministry-logo {
    width: 180px;
    height: auto;
    display: block;
}

@media (max-width: 768px) {
    .header .ministry-logo {
        width: 140px;
    }
}


/* ===== header like the platform's =====
   centre logo 160px (100px on phones); on desktop the actions read, left to right:
   contact, guide, login/logout, عربي | English; the menu button stays for tablets and phones */
html body .center-logo-text {
    gap: 0;
}

html body .center-logo-text img.adl-text-logo {
    width: 160px;
    height: auto;
    display: block;
}

html body .lang-switch {
    --adl-font: "AdlKufi", "AdlNaskh", Tahoma, Arial, sans-serif;
    border: 1px solid #0A3761;
    background: transparent;
    padding: 2px;
}

html body .lang-switch button {
    color: #000;
    font-size: 14px;
    padding: 6px 16px;
}

html body .lang-switch button.active {
    background: #0A3761;
    color: #fff;
}

html body .icon-btn.hdr-btn {
    width: 42px;
    height: 42px;
    background: transparent;
    border: 1px solid #1C2F5E;
}

html body .icon-btn.hdr-btn img {
    width: 27px;
    height: 24px;
}

@media (min-width: 901px) {
    html body .header-actions {
        gap: 16px;
    }

    html body .header-actions > .hdr-contact { order: 1; }
    html body .header-actions > .hdr-guide { order: 2; }
    html body .header-actions .header-login { order: 3; } /* also the logout button inside its form */
    html body .header-actions > .lang-switch { order: 4; }

    html body .header-actions > #hambBtn {
        order: 0; /* the three-lines menu button stays, first on the left, as before */
    }
}

@media (max-width: 900px) {
    html body .center-logo-text img.adl-text-logo {
        width: 100px;
    }
}

/* Login and logout buttons: the platform's icon style (arrow into a bracket) in the same ringed circle as the other buttons */
html body .header .header-login {
    width: 42px;
    height: 42px;
    background: transparent;
    border: 1px solid #1C2F5E;
}

html body .header .header-login img {
    width: 27px;
    height: 24px;
}

/* ===== guide dialog (opened by the header guide button, like the platform's) ===== */
html.adl-guide-open-page {
    overflow: hidden;
}

.adl-guide-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
}

.adl-guide-box {
    display: flex;
    flex-direction: column;
    width: 95vw;
    max-width: 95vw;
    height: 90vh;
    background: #fff;
    border: 16px solid #285a8b;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.adl-guide-title {
    padding: 16px;
    text-align: center;
    font-size: 20px;
    color: #204872;
}

.adl-guide-body {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.adl-guide-frame {
    width: 100%;
    height: 100%;
    border: 0;
}

.adl-guide-foot {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 8px;
}

.adl-guide-close,
.adl-guide-open {
    padding: 8px 24px;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    background: transparent;
    cursor: pointer;
    text-decoration: none;
}

.adl-guide-close {
    border: 1px solid #ef4444;
    color: #dc2626;
}

.adl-guide-close:hover {
    background: #fef2f2;
}

.adl-guide-open {
    border: 1px solid #285a8b;
    color: #285a8b;
}

.adl-guide-open:hover {
    background: #eef3fb;
}

@media (max-width: 900px) {
    .adl-guide-box {
        border-width: 8px;
    }
}

/* Login and User Guide icons: designed with their own ring, so the button is just the icon */
html body .header .header-login:not(.header-logout),
html body .icon-btn.hdr-btn.hdr-guide {
    width: 42px;
    height: 42px;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 50%;
    display: grid;
    place-items: center;
}

html body .header .header-login:not(.header-logout) img,
html body .icon-btn.hdr-btn.hdr-guide img {
    width: 42px;
    height: 42px;
    filter: none;
}

html body .header .header-login:not(.header-logout):hover,
html body .header .header-login:not(.header-logout):focus-visible,
html body .icon-btn.hdr-btn.hdr-guide:hover {
    background: transparent;
    box-shadow: 4px 4px 20px 0 rgba(0, 0, 0, 0.15);
}

html body .header .header-login:not(.header-logout):hover img,
html body .header .header-login:not(.header-logout):focus-visible img {
    filter: none;
}

/* ribbon titles: the same thin, clear letters as the text of the service tiles (regular weight, not bold) */
html body .hero-section .title-lg,
html body .all-panel-title .title-lg {
    font-weight: 400;
    font-size: 28px;
    letter-spacing: 0;
    -webkit-font-smoothing: antialiased;
}

html body .hero-section .title-sm,
html body .all-panel-title .title-sm {
    font-weight: 400;
    font-size: 14px;
    opacity: 1;
}
