.post-lang-box {
    background: #f8f9fa;
    border: 1px solid #e5e7eb;
    border-radius: 0;
    padding: 5px 20px;
    margin: 5px 0 10px 0;
    text-align: center !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.3s ease-in-out;
    /* Do not clear floating header/theme elements: on some RTL Elementor pages
       clear:both creates a large empty gap above the switcher. */
    clear: none !important;
    box-sizing: border-box;
}

.nanews-lang-switcher-pending {
    display: none !important;
}

.post-lang-box:hover {
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.08);
}

/* WordPress/Elementor Hebrew global CSS often forces every <p> to RTL/right.
   Override it here so the language control remains centered and predictable. */
.post-lang-box .lang-links {
    font-family: "Open Sans", "Helvetica Neue", Arial, sans-serif;
    font-size: 18px;
    color: #000;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1.6;
    white-space: normal;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35em;
    text-align: center !important;
    direction: ltr !important;
    unicode-bidi: isolate !important;
}

.nanews-lang-prefix {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 0.35em;
    direction: ltr !important;
    unicode-bidi: isolate !important;
}

.nanews-lang-prefix-text {
    unicode-bidi: isolate !important;
}

.nanews-lang-list {
    display: inline-block;
    direction: ltr !important;
    unicode-bidi: isolate !important;
    white-space: nowrap;
}

.nanews-lang-globe {
    display: inline-block;
    direction: ltr !important;
    unicode-bidi: isolate !important;
}

.post-lang-box .lang-links a {
    color: #1e73be;
    text-decoration: none;
    border-bottom: 1px dotted transparent;
    transition: color 0.2s ease, border-color 0.2s ease;
    margin: 0 2px;
    direction: ltr !important;
    unicode-bidi: isolate !important;
}

.post-lang-box .lang-links a:hover {
    color: #0056b3;
    border-color: #1e73be;
}

/* When the front page has no visible title, JS mounts the top switcher before
   the page/main wrapper. Keep it tight to the header instead of inheriting an
   Elementor top spacer/margin from the page content. */
.nanews-lang-switcher-front-top {
    margin-top: 0 !important;
    margin-bottom: 10px !important;
}

@media (max-width: 768px) {
    .post-lang-box {
        font-size: 14px;
        padding: 14px;
        margin-top: 25px;
    }

    .post-lang-box .lang-links {
        line-height: 1.5;
    }

    /* On mobile the article sentence stays on the first line and the language
       abbreviations always start on a new line. */
    .post-lang-box[data-nanews-context="post"] .lang-links {
        flex-direction: column;
        gap: 4px;
    }

    .post-lang-box[data-nanews-context="post"] .nanews-lang-prefix,
    .post-lang-box[data-nanews-context="post"] .nanews-lang-list {
        width: 100%;
        text-align: center !important;
    }

    .nanews-lang-switcher-front-top {
        margin-top: 0 !important;
    }
}
