/* Keep the shared logo link free of inline baseline spacing. */
.header .logo > a {
    display: flex;
    align-items: center;
}

/* Compact desktop dropdowns with a restrained fade/slide transition.
   Scope the overrides to the shared public header; mobile accordion is unchanged. */
@media (min-width: 992px) and (pointer: fine), (min-width: 992px) and (pointer: none), (min-width: 1200px) {
    .header .desktop-nav .menu-item-has-children > .sub-menu {
        gap: 0 !important;
        min-width: 185px;
        padding: 4px 8px !important;
        box-sizing: border-box;
        align-items: stretch;
        border: 1px solid #e9ebee;
        border-radius: 10px;
        max-height: min(70vh, 480px);
        overflow-y: auto;
        box-shadow: 0 8px 24px rgba(23, 43, 77, .10), 0 2px 6px rgba(23, 43, 77, .04);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: translateY(-4px) scale(.98);
        transform-origin: top right;
        transition: opacity 140ms ease, transform 180ms cubic-bezier(.2,.8,.2,1), visibility 0s linear 180ms;
    }

    .header .desktop-nav .menu-item-has-children:focus-within > .sub-menu,
    .header .desktop-nav .menu-item-has-children:hover > .sub-menu {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translateY(0) scale(1);
        transition-delay: 0s;
    }

    .header .desktop-nav .menu-item-has-children > .sub-menu > li + li {
        border-top: 1px solid #edf0f2;
    }

    .header .desktop-nav .menu-item-has-children > .sub-menu > li > a {
        min-height: 32px;
        box-sizing: border-box;
        padding: 6px 8px !important;
        font-size: 12px;
        font-weight: 400;
        line-height: 1.5;
        text-shadow: none;
        border-radius: 4px;
        transition: background-color 120ms ease, color 120ms ease;
    }

    .header .desktop-nav .menu-item-has-children > .sub-menu > li > a:focus-visible {
        outline: 2px solid var(--primary-color);
        outline-offset: -2px;
    }
}

@media (min-width: 992px) and (pointer: fine) and (prefers-reduced-motion: reduce), (min-width: 992px) and (pointer: none) and (prefers-reduced-motion: reduce), (min-width: 1200px) and (prefers-reduced-motion: reduce) {
    .header .desktop-nav .menu-item-has-children > .sub-menu,
    .header .desktop-nav .menu-item-has-children > .sub-menu > li > a {
        transition: none;
        transform: none;
    }
    .header .desktop-nav .menu-item-has-children:focus-within > .sub-menu,
    .header .desktop-nav .menu-item-has-children:hover > .sub-menu {
        transform: none;
    }
}

@media (max-width: 991.98px), (max-width: 1199.98px) and (pointer: coarse) {
    /* Center the menu button itself, without an inline line box below it. */
    .header-right-menu {
        display: flex;
        align-items: center;
    }

    .mobile-menu-panel {
        width: min(82%, 340px);
        max-width: 340px;
        height: 100dvh;
        overflow-y: auto;
        overscroll-behavior: contain;
        padding: 16px 16px calc(24px + env(safe-area-inset-bottom, 0px));
    }

    .mobile-menu-panel .menu-panel-header {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 62px;
        margin-bottom: 16px;
        padding-bottom: 12px;
        border-bottom: 0.5px solid var(--primary-color, #4187ff);
    }

    .mobile-menu-panel .mobile-menu-logo {
        display: flex;
        align-items: center;
        justify-content: center;
        max-width: calc(100% - 86px);
    }

    .mobile-menu-panel .mobile-menu-logo img {
        display: block;
        width: auto;
        max-width: 138px;
        max-height: 48px;
        object-fit: contain;
    }

    .mobile-menu-panel .menu-close-btn {
        position: absolute;
        right: 0;
        top: 50%;
        transform: translateY(-65%);
        display: flex;
        align-items: center;
        justify-content: center;
        width: 38px;
        height: 38px;
        background: #f5f7fa;
        border: 1px solid #e4e9ef;
        border-radius: 10px;
        font-size: 17px;
    }

    .mobile-menu-panel .search-wrapper {
        display: flex;
        align-items: center;
        gap: 6px;
        width: 100%;
        margin: 0 0 18px;
        padding: 5px 6px 5px 5px;
        box-sizing: border-box;
        border: 1px solid #dce5ef;
        border-radius: 12px;
        background: #f7f9fc;
        transition: border-color .2s ease, box-shadow .2s ease;
    }

    .mobile-menu-panel .search-wrapper:focus-within {
        border-color: var(--primary-color);
        box-shadow: 0 0 0 3px rgba(48, 118, 208, .1);
        background: #fff;
    }

    .mobile-menu-panel .search-wrapper input[type="search"] {
        flex: 1;
        min-width: 0;
        width: auto;
        padding: 9px 8px;
        border: 0;
        border-radius: 0;
        background: transparent;
        color: #263447;
        font: inherit;
        font-size: 13px;
        line-height: 1.6;
        box-shadow: none;
        outline: none;
    }

    .mobile-menu-panel .search-wrapper input::placeholder {
        color: #8a97a8;
        opacity: 1;
    }

    .mobile-menu-panel .search-wrapper .mobile-menu-search-submit {
        position: relative;
        flex: 0 0 38px;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 38px;
        height: 36px;
        padding: 0;
        border: 0;
        border-radius: 9px;
        color: #fff;
        background: transparent;
        box-shadow: none;
        overflow: visible;
        cursor: pointer;
    }

    .mobile-menu-panel .search-wrapper .mobile-menu-search-submit i {
        position: static;
        transform: none;
        color: inherit;
        font-size: 16px;
        width: auto;
    }

    .mobile-menu-panel .mobile-menu-links { padding: 0; margin: 0; }
    .mobile-menu-panel .mobile-menu-links > li { list-style: none; }
    .mobile-menu-panel .mobile-menu-links > li > a { min-height: 40px; border-bottom: 0.5px solid var(--primary-color, #4187ff); }
    .mobile-menu-panel .mobile-menu-links > li > a .icon-size { flex-shrink: 0; }
    /* Shared accordion card for all present and future menu-item-has-children entries. */
    .mobile-menu-panel .mobile-menu-links li.menu-item-has-children > ul.sub-menu {
        box-sizing: border-box;
        margin: 4px 0 8px;
        padding: 6px 8px !important;
        border: 0.5px solid rgba(65, 135, 255, 0.4);
        border-radius: 4px;
        background: #f8fafc;
        box-shadow: 0 3px 12px rgba(32, 66, 109, 0.06);
        overflow: hidden;
    }
    .mobile-menu-panel .mobile-menu-links li.menu-item-has-children.open > a {
        background: rgba(65, 135, 255, 0.06);
        border-radius: 4px;
    }

    .mobile-menu-panel .mobile-menu-links li.menu-item-has-children ul.sub-menu li a {
        padding: 8px 11px !important;
        gap: 10px;
        line-height: 1.6;
        color: #526178;
    }

    .mobile-menu-panel .mobile-menu-links li.menu-item-has-children ul.sub-menu li a:focus-visible,
    .mobile-menu-panel .mobile-menu-links > li > a:focus-visible,
    .mobile-menu-panel .menu-close-btn:focus-visible,
    .mobile-menu-panel .mobile-menu-logo:focus-visible,
    .mobile-menu-panel .mobile-menu-search-submit:focus-visible {
        outline: 2px solid var(--primary-color);
        outline-offset: 2px;
    }
}

/* The public site navigation (and its nested links) belongs to the right-hand drawer. */
@media (max-width: 991.98px), (max-width: 1199.98px) and (pointer: coarse) {
    .mobile-menu-panel {
        right: 0;
        left: auto;
        visibility: hidden;
        transform: translate3d(100%, 0, 0);
        transition: transform .35s ease, visibility 0s .35s;
        box-shadow: -4px 0 15px rgba(0,0,0,.1);
    }
    .mobile-menu-panel.open {
        right: 0;
        left: auto;
        visibility: visible;
        transform: translate3d(0, 0, 0);
        transition-delay: 0s;
    }
}
@media (prefers-reduced-motion: reduce) {
    .mobile-menu-panel, .mobile-menu-panel .search-wrapper { transition: none; }
}

/* Shared account dropdown actions: matched SVG size, text weight and spacing. */
.user-menu-container .user-dropdown .user-logout-form {
    display: block;
    width: 100%;
    margin: 0;
}

.user-menu-container .user-dropdown .user-dropdown-action {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 36px;
    margin: 0;
    padding: 9px 10px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #000;
    font-family: inherit;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.5;
    text-align: right;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .2s ease, color .2s ease;
}

.user-menu-container .user-dropdown .user-dropdown-icon {
    display: block;
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    color: var(--primary-color);
}

.user-menu-container .user-dropdown .user-dropdown-action:hover {
    background: rgba(65, 135, 255, .08) !important;
    color: var(--primary-color);
}

.user-menu-container .user-dropdown .user-dropdown-action:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: -2px;
}


/* Match the floating smart finder glass on the public header and mobile drawer. */
.header,
.mobile-menu-panel {
    background: rgba(255, 255, 255, 0.7);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

/* Make the open mobile drawer background more obscuring without changing the header. */
@media (max-width: 991.98px), (max-width: 1199.98px) and (pointer: coarse) {
    .mobile-menu-panel {
        -webkit-backdrop-filter: blur(16px);
        backdrop-filter: blur(16px);
    }
}

/* Public header theme; keep drawers and dropdown surfaces unchanged. */
.header {
    --header-theme: #2477D3;
    --header-foreground: #fff;
    background: var(--header-theme);
    color: var(--header-foreground);
}
.header .desktop-nav > ul > li > a,
.header .desktop-nav > ul > li > a:hover,
.header .desktop-nav > ul > li > a.active,
.header .desktop-nav > ul > li > a > i,
.header .header-doctor-link,
.header .header-doctor-link:hover,
.header .menu-toggle { color: var(--header-foreground) !important; }
.header .desktop-nav > ul > li > a:hover,
.header .desktop-nav > ul > li > a.active,
.header .header-doctor-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.header .menu-toggle .site-menu-icon { filter: brightness(0) invert(1); }
.header .desktop-nav > ul > li > a:focus-visible,
.header .header-doctor-link:focus-visible,
.header .logo > a:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
/* Increase mobile header height and its fixed-header placeholder together. */
@media (max-width: 991.98px), (max-width: 1199.98px) and (pointer: coarse) {
    .header { height: 60.5px !important; }
    [x-persist="site-header"] { height: 60.5px; }
}

/* Enlarge the public header logo while keeping header height unchanged. */
.header .logo img { height: 44px; width: auto; }
@media (max-width: 991.98px), (max-width: 1199.98px) and (pointer: coarse) {
    .header .logo img { height: 42px; }
}

/* Desktop-only compact RTL menu, matching the supplied header reference.
   Keep the mobile layout, header color, logo artwork and account controls intact. */
@media (min-width: 992px) and (pointer: fine), (min-width: 992px) and (pointer: none), (min-width: 1200px) {
    .header {
        height: 50px !important;
        padding-block: 0;
    }
    [x-persist="site-header"] {
        height: 50px;
    }
    .header .header-inner {
        direction: rtl;
        justify-content: flex-start;
        gap: 0;
        --desktop-menu-inset: 8px;
        --desktop-menu-font-size: 13px;
        --desktop-menu-divider: rgba(255, 255, 255, .72);
    }

    .header .header-inner > .desktop-nav {
        order: 0;
        flex: 0 0 auto;
        justify-content: flex-start;
        gap: 0;
        direction: rtl;
    }

    .header .desktop-nav > ul {
        display: flex;
        align-items: center;
        flex-wrap: nowrap;
        gap: 0;
    }

    .header .desktop-nav > ul > li {
        position: relative;
        flex: 0 0 auto;
        padding-inline: var(--desktop-menu-inset);
    }

    .header .desktop-nav > ul > li:first-child {
        padding-inline-start: 0;
    }

    .header .desktop-nav > ul > li + li::before,
    .header .header-inner > .header-left-buttons::before {
        content: "";
        position: absolute;
        inset-inline-start: 0;
        top: calc(50% - 7px);
        width: 0;
        height: 14px;
        box-sizing: content-box;
        border: 0;
        border-inline-start: 1px solid var(--desktop-menu-divider);
        background: none;
        transform: none;
        pointer-events: none;
    }

    .header .desktop-nav > ul > li > a {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        padding: 0;
        min-height: 34px;
        font-size: var(--desktop-menu-font-size);
        font-weight: 300;
        font-family: var(--font-family);
        line-height: 1.5;
        white-space: nowrap;
        text-shadow: none;
    }

    .header .desktop-nav > ul > li > a > i {
        font-size: 9px;
    }

    .header .header-inner > .header-left-buttons {
        position: relative;
        order: 1;
        flex: 0 0 auto;
        gap: 4px;
        padding-inline-start: var(--desktop-menu-inset);
        margin: 0;
    }

    /* Remove mobile-specific relative offsets from the shared action controls
       on desktop only; keep a generous hit area around the compact glyphs. */
    .header .header-inner .header-left-buttons > .user-menu-container,
    .header .header-inner .header-left-buttons > .header-search-toggle {
        left: auto;
        margin-inline: 0;
    }

    .header .header-inner .header-left-buttons .user-icon,
    .header .header-inner .header-left-buttons > .header-search-toggle {
        width: 34px;
        height: 34px;
        flex-basis: 34px;
    }

    .header .header-inner .header-left-buttons .header-outline-icon {
        width: 22px;
        height: 22px;
        flex-basis: 22px;
    }

    .header .header-inner > .logo {
        order: -1;
        flex: 0 0 auto;
        margin-inline-start: 0;
        /* In RTL, the auto end margin pushes the menu and actions to the left. */
        margin-inline-end: auto;
    }

    .header .header-inner > .header-right-menu {
        display: none;
    }
}


/* Restore the compact desktop menu for small laptops without affecting touch tablets. */
@media (min-width: 992px) and (max-width: 1199.98px) and (pointer: fine), (min-width: 992px) and (max-width: 1199.98px) and (pointer: none) {
    .header .header-inner {
        --desktop-menu-inset: 6px;
        --desktop-menu-font-size: 12.5px;
    }
}


/* Shared featured specialties: desktop mega menus and mobile six-row lists. */
.header .desktop-nav > ul > li > .specialty-mega-trigger {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 34px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--header-foreground);
    font: 300 var(--desktop-menu-font-size, 13px)/1.5 var(--font-family);
    white-space: nowrap;
    cursor: pointer;
}
.specialty-mega-trigger i { font-size: 9px; transition: transform .18s ease; }
.specialty-mega-trigger[aria-expanded="true"] i { transform: rotate(180deg); }
.specialty-mega-trigger:hover, .specialty-mega-trigger[aria-expanded="true"] {
    text-decoration: underline;
    text-underline-offset: 4px;
}
.specialty-mega-trigger:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

@media (min-width: 992px) and (pointer: fine), (min-width: 992px) and (pointer: none), (min-width: 1200px) {
    .header .header-inner { position: relative; }
    .header .desktop-nav > ul > li.specialty-mega-item { position: static; }
    .header .desktop-nav .specialty-mega-panel {
        position: absolute;
        inset-inline-end: 8px;
        top: 100%;
        z-index: 20;
        width: min(660px, calc(100vw - 32px));
        max-height: 75vh;
        overflow: auto;
        padding: 12px;
        box-sizing: border-box;
        background: #fff;
        color: #263447;
        border: 1px solid #e9ebee;
        border-radius: 10px;
        box-shadow: 0 8px 24px rgba(23,43,77,.14);
    }
    .header .desktop-nav .consultation-mega-panel {
        width: min(850px, calc(100vw - 32px));
        display: grid;
        grid-template-columns: 175px minmax(0, 1fr);
        gap: 12px;
    }
    .header .desktop-nav .featured-specialty-links {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 4px;
        margin: 0;
        padding: 0;
        list-style: none;
    }
    .header .desktop-nav .consultation-mega-panel .featured-specialty-links {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .header .desktop-nav .featured-specialty-links a {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 6px;
        min-height: 42px;
        padding: 7px 8px;
        border-radius: 6px;
        font-size: 12px;
        font-weight: 400;
        text-shadow: none;
        color: #263447;
    }
    .consultation-mega-types {
        display: flex;
        flex-direction: column;
        gap: 6px;
        padding-inline-end: 10px;
        border-inline-end: 1px solid #e9ebee;
    }
    .consultation-mega-types button {
        border: 0;
        background: transparent;
        font: inherit;
        font-size: 13px;
        color: #263447;
        padding: 12px 8px;
        text-align: start;
        border-radius: 6px;
        cursor: pointer;
    }
    .consultation-mega-types button[aria-pressed="true"],
    .header .desktop-nav .featured-specialty-links a:hover {
        background: #eef5ff;
        color: var(--primary-color, #2477d3);
    }
}
@media (max-width: 991.98px), (max-width: 1199.98px) and (pointer: coarse) {
    .mobile-menu-panel .mobile-menu-links .featured-specialty-links {
        display: block;
        list-style: none;
        max-height: 264px;
        overflow-y: auto;
        overscroll-behavior: contain;
        padding: 0;
        margin: 0;
        scrollbar-width: thin;
    }
    .mobile-menu-panel .mobile-menu-links .mobile-specialty-accordion .featured-specialty-links > li > a {
        display: flex;
        align-items: center;
        justify-content: space-between !important;
        box-sizing: border-box;
        height: 44px;
        padding: 4px 8px !important;
        border-bottom: 1px solid #e9ebee !important;
        font-size: 12px;
        line-height: 1.4;
    }
    .mobile-menu-panel .mobile-menu-links .featured-specialty-links > li > a i { flex: 0 0 auto; font-size: 10px; }
}

@media (min-width: 992px) and (pointer: fine), (min-width: 992px) and (pointer: none), (min-width: 1200px) {
    .header .desktop-nav > ul > li.specialty-mega-item::before { display: none; }
    .header .desktop-nav > ul > li.specialty-mega-item + li.specialty-mega-item > .specialty-mega-trigger { position: relative; }
    .header .desktop-nav > ul > li.specialty-mega-item + li.specialty-mega-item > .specialty-mega-trigger::before {
        content: "";
        position: absolute;
        inset-inline-start: calc(-1 * var(--desktop-menu-inset));
        top: calc(50% - 7px);
        height: 14px;
        border-inline-start: 1px solid var(--desktop-menu-divider);
        pointer-events: none;
    }
}

/* Appointment entry links land below the fixed public header. */
#my-slider-1 { scroll-margin-top: 85px; }


/* Booking navigation: one selected specialty's city list, never a full matrix. */
.booking-catalog-specialties, .booking-catalog-cities {
    list-style: none;
    padding: 0;
    margin: 0;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}
.booking-catalog-specialty {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    box-sizing: border-box;
    border: 0;
    background: transparent;
    color: #263447;
    font: inherit;
    font-size: 13px;
    text-align: start;
    cursor: pointer;
}
.booking-catalog-specialty[aria-expanded="true"],
.booking-catalog-specialty:hover {
    color: var(--primary-color, #2477d3);
    background: #eef5ff;
}
.booking-catalog-specialty:focus-visible,
.booking-catalog-results a:focus-visible {
    outline: 2px solid var(--primary-color, #2477d3);
    outline-offset: -2px;
}
.booking-catalog-empty { margin: 8px; color: #63748a; font-size: 12px; }
@media (min-width: 992px) and (pointer: fine), (min-width: 992px) and (pointer: none), (min-width: 1200px) {
    .header .desktop-nav .booking-mega-panel {
        width: min(920px, calc(100vw - 32px));
    }
    .header .desktop-nav .booking-catalog--desktop {
        display: grid;
        grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
        gap: 12px;
        align-items: start;
        direction: rtl;
    }
    .header .desktop-nav .booking-catalog-specialties {
        display: block;
        max-height: min(60vh, 410px);
        overflow-y: auto;
        padding-inline-end: 8px;
        border-inline-end: 1px solid #e9ebee;
    }
    .booking-catalog--desktop .booking-catalog-specialty {
        min-height: 38px;
        border-radius: 6px;
        padding: 7px 8px;
    }
    .header .desktop-nav .booking-catalog-cities {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 4px;
        max-height: min(54vh, 356px);
        overflow-y: auto;
        align-items: start;
    }
    .header .desktop-nav .booking-catalog-results a {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 6px;
        padding: 7px 8px;
        min-height: 40px;
        border-radius: 6px;
        font-size: 12px;
        font-weight: 400;
        color: #263447;
        text-shadow: none;
    }
    .header .desktop-nav .booking-catalog-results a:hover,
    .header .desktop-nav .booking-catalog-results .booking-catalog-all {
        color: var(--primary-color, #2477d3);
        background: #eef5ff;
    }
    .header .desktop-nav .booking-catalog-all { margin-bottom: 6px; justify-content: flex-start; }
    .header .desktop-nav .booking-catalog-all i { margin-inline-start: auto; }
}
@media (max-width: 991.98px), (max-width: 1199.98px) and (pointer: coarse) {
    .mobile-menu-panel .mobile-menu-links .booking-catalog-specialties,
    .mobile-menu-panel .mobile-menu-links .booking-catalog-cities {
        display: block;
        max-height: 264px;
        overflow-y: auto;
        padding: 0;
        margin: 0;
    }
    .mobile-menu-panel .booking-catalog-specialty,
    .mobile-menu-panel .mobile-menu-links .mobile-specialty-accordion .booking-catalog-cities > li > a {
        min-height: 44px;
        height: 44px;
        padding: 4px 8px !important;
        border-bottom: 1px solid #e9ebee !important;
        font-size: 12px;
        line-height: 1.4;
    }
    .mobile-menu-panel .mobile-menu-links .mobile-specialty-accordion .booking-catalog-cities > li > a,
    .mobile-menu-panel .mobile-menu-links .mobile-specialty-accordion .booking-catalog-all {
        display: flex;
        align-items: center;
        justify-content: space-between !important;
        gap: 6px;
        box-sizing: border-box;
    }
    .mobile-menu-panel .booking-catalog-results {
        margin-top: 6px;
        border: 1px solid #e1e9f4;
        border-radius: 6px;
        padding: 4px;
        background: #fff;
    }
    .mobile-menu-panel .mobile-menu-links .mobile-specialty-accordion .booking-catalog-all {
        color: var(--primary-color, #2477d3);
        background: #eef5ff;
        border-radius: 4px;
        padding: 8px !important;
    }
    .booking-catalog-specialty i, .booking-catalog-results i { flex: 0 0 auto; font-size: 10px; }
}
