/**
 * DoctorBookly — language selector & RTL layout helpers (lightweight).
 */

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.dbk-lang {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
}

.dbk-lang__field {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.dbk-lang__icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #10b981;
    font-size: 14px;
    pointer-events: none;
    z-index: 1;
}

.dbk-lang__chevron {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #10b981;
    font-size: 11px;
    font-weight: 700;
    pointer-events: none;
}

.dbk-lang__select {
    appearance: none;
    -webkit-appearance: none;
    min-width: 0;
    width: 100%;
    max-width: 148px;
    padding: 7px 30px 7px 32px;
    border: 2px solid #10b981;
    border-radius: 8px;
    background: #fff;
    color: #1e293b;
    font-family: Poppins, system-ui, sans-serif;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.dbk-lang__select:hover,
.dbk-lang__select:focus {
    border-color: #059669;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.28);
    outline: none;
}

.dbk-lang__select:focus-visible {
    outline: 2px solid #10b981;
    outline-offset: 2px;
}

/* Top bar: compact on phones */
@media (max-width: 480px) {
    .dbk-lang__select {
        max-width: 118px;
        font-size: 12px;
        padding: 6px 26px 6px 28px;
    }
}

/* Mobile menu language row */
.dbk-lang--mobile {
    display: block;
    padding: 0 16px 12px;
}

.dbk-lang--mobile .dbk-lang__select {
    max-width: none;
    width: 100%;
    min-height: 44px;
    font-size: 14px;
}

/* RTL — mirror chrome, keep medical brand colors */
:is(html[dir="rtl"], html.dbk-user-rtl) .dbk-lang__icon {
    left: auto;
    right: 10px;
}

:is(html[dir="rtl"], html.dbk-user-rtl) .dbk-lang__chevron {
    right: auto;
    left: 10px;
}

:is(html[dir="rtl"], html.dbk-user-rtl) .dbk-lang__select {
    padding: 7px 32px 7px 30px;
}

/*
 * RTL chrome: keep top bar + navbar layout LTR so logo / menu never clip off-screen.
 * Text alignment and mobile drawer still respect RTL reading direction.
 */
:is(html[dir="rtl"], html.dbk-user-rtl) .top-bar-content,
:is(html[dir="rtl"], html.dbk-user-rtl) .navbar-content {
    direction: ltr;
}

:is(html[dir="rtl"], html.dbk-user-rtl) .nav-menu {
    direction: rtl;
}

:is(html[dir="rtl"], html.dbk-user-rtl) .mobile-menu-links a {
    flex-direction: row-reverse;
    text-align: right;
}

:is(html[dir="rtl"], html.dbk-user-rtl) .mobile-menu-links a i {
    margin-right: 0;
    margin-left: 12px;
}

:is(html[dir="rtl"], html.dbk-user-rtl) .profile-dropdown a {
    flex-direction: row-reverse;
}

:is(html[dir="rtl"], html.dbk-user-rtl) .profile-dropdown {
    right: auto;
    left: 0;
}

/* Mobile menu slides from the correct edge in RTL */
:is(html[dir="rtl"], html.dbk-user-rtl) .mobile-menu {
    left: auto;
    right: 0;
    transform: translateX(105%);
    box-shadow: -4px 0 24px rgba(15, 23, 42, 0.18);
}

:is(html[dir="rtl"], html.dbk-user-rtl) .mobile-menu.show {
    transform: translateX(0);
}

:is(html[dir="rtl"], html.dbk-user-rtl) .mobile-menu-header {
    direction: rtl;
}

:is(html[dir="rtl"], html.dbk-user-rtl) .dbk-lang--mobile {
    direction: rtl;
}

/* --- Mobile: prevent top bar / navbar cropping (Urdu, Arabic, long labels) --- */
@media (max-width: 768px) {
    .top-bar__login span,
    .top-bar a[onclick*="openLoginModal"] span {
        display: inline !important;
        visibility: visible !important;
        opacity: 1 !important;
        color: #fff !important;
    }

    .top-bar .dbk-lang--topbar .dbk-lang__select {
        min-width: 68px !important;
        max-width: 82px !important;
    }

    :is(html[dir="rtl"], html.dbk-user-rtl) .top-bar,
    .top-bar {
        overflow-x: clip;
    }

    .top-bar-content {
        width: 100%;
        max-width: 100vw;
        box-sizing: border-box;
    }

    .top-bar-content > div:last-child,
    .top-bar__actions {
        margin-left: auto !important;
        margin-inline-start: auto !important;
        margin-inline-end: 0 !important;
        max-width: none !important;
        min-width: 0;
        flex: 0 1 auto;
        justify-content: flex-end !important;
        gap: 8px !important;
    }

    .top-bar .dbk-lang--topbar {
        flex: 0 0 auto !important;
        max-width: none !important;
        min-width: 0;
        z-index: 3;
    }

    .top-bar .dbk-lang--topbar .dbk-lang__select {
        min-width: 78px !important;
        max-width: 108px !important;
        flex: 0 0 auto !important;
    }

    .top-bar .btn-join-us {
        flex: 0 0 auto !important;
        z-index: 1;
    }

    .navbar {
        overflow-x: clip;
    }

    .navbar-content {
        width: 100%;
        max-width: 100vw;
        box-sizing: border-box;
        gap: 8px;
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    .navbar .logo {
        flex: 1 1 auto;
        min-width: 0;
        max-width: calc(100% - 48px);
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .navbar .hamburger-menu,
    .hamburger-menu {
        margin-left: auto !important;
        margin-inline-start: auto !important;
        margin-inline-end: 0 !important;
        flex: 0 0 auto;
    }

    .navbar .profile-dropdown-container.profile-in-navbar {
        flex: 0 0 auto;
        margin-inline-start: 4px;
    }
}

@media (max-width: 420px) {
    .top-bar__actions {
        gap: 6px !important;
    }

    .top-bar__login,
    .top-bar a[onclick*="openLoginModal"],
    .top-bar a[href="#"][onclick*="Login"] {
        padding: 4px 6px !important;
        min-width: 0;
        gap: 4px !important;
        font-size: 10px !important;
    }

    .top-bar__login span,
    .top-bar a[onclick*="openLoginModal"] span,
    .top-bar a[href="#"][onclick*="Login"] span {
        position: static !important;
        width: auto !important;
        height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        clip: auto !important;
        white-space: nowrap !important;
        border: 0 !important;
        font-size: 10px !important;
        max-width: 52px;
        text-overflow: ellipsis;
        display: inline-block;
    }

    .top-bar .dbk-lang--topbar .dbk-lang__select {
        min-width: 64px !important;
        max-width: 78px !important;
        font-size: 10px !important;
        padding: 4px 18px 4px 22px !important;
    }

    .top-bar .btn-join-us {
        padding: 5px 8px !important;
        font-size: 10px !important;
        max-width: none !important;
    }

    .top-bar .btn-join-us .btn-join-us__text {
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 64px;
        display: inline-block;
        vertical-align: middle;
        font-size: 9px !important;
    }
}

@media (max-width: 360px) {
    .top-bar .dbk-lang--topbar .dbk-lang__select {
        min-width: 62px !important;
        max-width: 82px !important;
        font-size: 9px !important;
        padding: 4px 18px 4px 22px !important;
    }

    .top-bar .btn-join-us .btn-join-us__text {
        max-width: 56px;
    }

    :is(html[dir="rtl"], html.dbk-user-rtl) .top-bar .dbk-lang--topbar .dbk-lang__select {
        padding: 4px 20px 4px 18px !important;
    }
}

/* --- Top bar actions: Login | Language | Join Us (no overlap on mobile) --- */
.top-bar__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
    justify-content: flex-end;
    flex: 0 1 auto;
    min-width: 0;
    max-width: none;
    width: auto;
}

.top-bar__login,
.top-bar .btn-join-us {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    text-decoration: none;
    white-space: nowrap;
    color: #fff;
}

.top-bar__login i,
.top-bar a[onclick*="openLoginModal"] i {
    flex: 0 0 auto;
    font-size: 12px;
    opacity: 1;
}

.top-bar .btn-join-us {
    padding: 6px 12px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
    cursor: pointer;
    z-index: 1;
}

.top-bar .dbk-lang--topbar {
    flex: 0 0 auto;
    z-index: 2;
    position: relative;
}

.top-bar-content > div:last-child,
.top-bar__actions {
    max-width: none !important;
}

/* Language selector: top bar (login row) on all screen sizes; drawer copy stays in mobile menu */
.dbk-lang--navbar {
    display: none !important;
}

.top-bar .dbk-lang--topbar {
    display: inline-flex !important;
    flex: 0 1 auto;
    min-width: 0;
}

/* Top bar on green strip — white compact control */
.top-bar .dbk-lang--topbar .dbk-lang__select {
    border-color: rgba(255, 255, 255, 0.55);
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    max-width: 118px;
    color-scheme: light;
}

.top-bar .dbk-lang--topbar .dbk-lang__icon,
.top-bar .dbk-lang--topbar .dbk-lang__chevron {
    color: #fff;
}

/* Open <select> list: dark text on white (never inherit top-bar white text) */
.top-bar .dbk-lang--topbar .dbk-lang__select option,
.top-bar .dbk-lang--topbar .dbk-lang__select optgroup {
    background-color: #ffffff !important;
    color: #0f172a !important;
}

@media (max-width: 1024px) {
    .top-bar .dbk-lang--topbar .dbk-lang__select {
        max-width: 104px;
        font-size: 11px;
        padding: 5px 22px 5px 26px;
    }

    .navbar .hamburger-menu {
        margin-inline-start: auto !important;
        margin-left: auto !important;
    }

    .navbar .logo {
        order: 1 !important;
        flex: 1 1 auto !important;
    }
}

/* Join Us — always show translated label in top bar (not icon-only) */
.top-bar .btn-join-us .btn-join-us__text {
    position: static !important;
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    clip: auto !important;
    white-space: nowrap !important;
    border: 0 !important;
}

@media (max-width: 520px) {
    .top-bar .btn-join-us i.fa-plus-circle {
        display: none;
    }

    .top-bar .btn-join-us {
        padding: 5px 10px !important;
        min-width: 0;
        max-width: none !important;
    }
}

/* Join Us business-type modal — RTL */
:is(html[dir="rtl"], html.dbk-user-rtl) #businessTypeModal .join-us-type-panel {
    direction: rtl;
    text-align: center;
}

:is(html[dir="rtl"], html.dbk-user-rtl) .join-us-modal-topbar {
    justify-content: flex-start !important;
}

:is(html[dir="rtl"], html.dbk-user-rtl) #businessTypeModal .join-us-type-title,
:is(html[dir="rtl"], html.dbk-user-rtl) #businessTypeModal .join-us-type-subtitle {
    direction: rtl;
}

@media (prefers-reduced-motion: reduce) {
    .dbk-lang__select {
        transition: none;
    }
}

/* --- Script-specific typography (Urdu Nastaliq, Arabic, Hindi, Chinese) --- */
html.dbk-lang-ur .notranslate,
html[data-dbk-target-lang="ur"] .notranslate {
    font-family: 'Noto Nastaliq Urdu', 'Noto Sans Arabic', serif;
    line-height: 1.72;
}

html.dbk-lang-ar .notranslate,
html[data-dbk-target-lang="ar"] .notranslate {
    font-family: 'Noto Naskh Arabic', 'Noto Sans Arabic', serif;
    line-height: 1.65;
}

html.dbk-lang-hi .notranslate,
html[data-dbk-target-lang="hi"] .notranslate {
    font-family: 'Noto Sans Devanagari', Poppins, system-ui, sans-serif;
    line-height: 1.55;
}

html.dbk-lang-zh .notranslate,
html[data-dbk-target-lang="zh"] .notranslate {
    font-family: 'Noto Sans SC', Poppins, system-ui, sans-serif;
    line-height: 1.55;
}

/* Nav / drawer labels in RTL scripts */
:is(html.dbk-lang-ur, html[data-dbk-target-lang="ur"]) .nav-menu a,
:is(html.dbk-lang-ur, html[data-dbk-target-lang="ur"]) .mobile-menu-links a {
    font-family: 'Noto Nastaliq Urdu', serif;
    font-size: 0.93em;
    line-height: 1.55;
}

:is(html.dbk-lang-ar, html[data-dbk-target-lang="ar"]) .nav-menu a,
:is(html.dbk-lang-ar, html[data-dbk-target-lang="ar"]) .mobile-menu-links a {
    font-family: 'Noto Naskh Arabic', serif;
}

/* Brand logo and numeric stats stay Latin / tabular */
.logo,
.dbk-latin,
.dbk-mr-world-hero__num,
.dbk-mr-world-stat__val {
    font-family: Poppins, ui-monospace, system-ui, sans-serif !important;
    font-variant-numeric: tabular-nums;
}
