/* Z-Blog多语言插件 · 前台语言切换 */
.zbml-lang-switch,
.zbml-lang-float {
    --zbml-switch-bg: #ffffff;
    --zbml-switch-bg-soft: #f8fafc;
    --zbml-switch-line: rgba(15, 23, 42, 0.1);
    --zbml-switch-text: #0f172a;
    --zbml-switch-muted: #64748b;
    --zbml-switch-accent: #2563eb;
    --zbml-switch-accent-soft: #eff6ff;
    --zbml-switch-shadow: 0 18px 40px rgba(15, 23, 42, 0.14);
    --zbml-switch-radius: 14px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 13px;
    line-height: 1.4;
    color: var(--zbml-switch-text);
    -webkit-font-smoothing: antialiased;
}

.zbml-lang-switch__toggle {
    list-style: none;
    cursor: pointer;
    user-select: none;
    outline: none;
}

.zbml-lang-switch__toggle::-webkit-details-marker {
    display: none;
}

.zbml-lang-switch__toggle::marker {
    content: "";
}

.zbml-lang-switch__label {
    color: var(--zbml-switch-muted);
    margin-right: 8px;
    font-size: 12px;
}

/* 主题内联 */
.zbml-lang-switch--inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.zbml-lang-switch__inline {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
}

.zbml-lang-switch__link--inline {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--zbml-switch-line);
    background: var(--zbml-switch-bg);
    color: var(--zbml-switch-text);
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.zbml-lang-switch__link--inline:hover {
    border-color: rgba(37, 99, 235, 0.28);
    color: var(--zbml-switch-accent);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08);
}

.zbml-lang-switch__link--inline.is-current {
    background: var(--zbml-switch-accent-soft);
    border-color: rgba(37, 99, 235, 0.22);
    color: var(--zbml-switch-accent);
    font-weight: 600;
}

/* 主题下拉 / 列表 */
.zbml-lang-switch--dropdown,
.zbml-lang-switch--list {
    display: inline-block;
    position: relative;
}

.zbml-lang-switch--dropdown.select-dropdown {
    position: relative;
    display: inline-block;
}

.zbml-lang-switch--dropdown .dropdown-toggle {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    padding: 0;
    border: 0;
    background: transparent;
    color: #333;
    font-size: 14px;
    font-weight: 400;
    text-decoration: none;
    cursor: pointer;
    box-shadow: none;
    list-style: none;
    user-select: none;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.zbml-lang-switch--dropdown .dropdown-toggle::after {
    display: inline-block;
    margin-left: 2px;
    vertical-align: middle;
    content: "";
    border-top: 0.35em solid #999;
    border-right: 0.35em solid transparent;
    border-bottom: 0;
    border-left: 0.35em solid transparent;
}

.zbml-lang-switch--dropdown .zbml-lang-switch__current {
    color: #333;
    font-weight: 400;
    font-size: 14px;
    margin-left: 0;
    max-width: none;
}

.zbml-lang-switch--dropdown .zbml-lang-switch__flag-wrap {
    position: relative;
    flex-shrink: 0;
    width: 24px;
    height: 18px;
    border-radius: 3px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}

.zbml-lang-switch--dropdown .zbml-lang-switch__flag-wrap::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0.12) 42%, transparent 100%);
    pointer-events: none;
}

.zbml-lang-switch--dropdown .zbml-lang-switch__flag {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0;
}

.zbml-lang-switch--dropdown .zbml-lang-switch__flag--fallback {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 0;
    background: rgba(148, 163, 184, 0.35);
}

.zbml-lang-switch--dropdown .dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 99998;
    min-width: 168px;
    margin: 8px 0 0;
    padding: 0;
    font-size: 14px;
    color: #333;
    text-align: left;
    list-style: none;
    background-color: #fff;
    border: 1px solid #eee;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition:
        opacity 0.2s ease,
        transform 0.2s ease,
        visibility 0s linear 0.2s;
    display: block;
    pointer-events: none;
    overflow: hidden;
    max-height: 320px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.zbml-lang-switch--dropdown .dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    margin-top: 8px;
    transform: translateY(0);
    pointer-events: auto;
    transition:
        opacity 0.2s ease,
        transform 0.2s ease,
        visibility 0s;
}

.zbml-lang-switch--dropdown .dropdown-menu.show[data-zbml-placement="top"] {
    top: auto;
    bottom: calc(100% + 8px);
    margin-top: 0;
    margin-bottom: 0;
    transform: translateY(0);
}

.zbml-lang-switch--dropdown .dropdown-item {
    display: flex !important;
    align-items: center;
    width: 100%;
    padding: 10px 14px;
    min-height: 44px;
    white-space: nowrap !important;
    clear: both;
    font-weight: 400;
    font-size: 14px;
    color: #333;
    text-align: inherit;
    text-decoration: none;
    background-color: #fff;
    border: 0;
    border-bottom: 1px solid #eee;
    gap: 10px;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.zbml-lang-switch--dropdown .dropdown-item:last-child {
    border-bottom: 0;
}

.zbml-lang-switch--dropdown .dropdown-item .zbml-lang-switch__name {
    flex: 1;
    min-width: 0;
}

.zbml-lang-switch--dropdown .dropdown-item .zbml-lang-switch__meta {
    margin-left: auto;
}

.zbml-lang-switch--dropdown .dropdown-item .zbml-lang-switch__check {
    color: #f39c12;
}

.zbml-lang-switch--dropdown .dropdown-item:hover,
.zbml-lang-switch--dropdown .dropdown-item.is-current {
    background-color: #fff9e1;
    color: #f39c12;
}

.zbml-lang-switch--dropdown .dropdown-item.is-current {
    font-weight: 400;
}

.zbml-lang-switch__flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 20px;
    font-size: 16px;
    line-height: 1;
}

.zbml-lang-switch-item {
    list-style: none;
    display: flex;
    align-items: center;
}

.zbml-lang-switch__icon {
    display: inline-flex;
    flex-shrink: 0;
    color: var(--zbml-switch-accent);
}

.zbml-lang-switch__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    padding: 0 2px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--zbml-switch-text);
    line-height: 1;
}

.zbml-lang-switch__current {
    font-weight: 600;
    white-space: nowrap;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.zbml-lang-switch__chevron {
    display: inline-flex;
    flex-shrink: 0;
    margin-left: 2px;
    color: var(--zbml-switch-muted);
    transition: transform 0.2s ease, color 0.15s ease;
}

details[open] > .zbml-lang-switch__toggle .zbml-lang-switch__chevron {
    transform: rotate(180deg);
    color: var(--zbml-switch-accent);
}

/* 下拉面板 */
.zbml-lang-switch__panel {
    position: absolute;
    z-index: 99998;
    min-width: 240px;
    border-radius: var(--zbml-switch-radius);
    border: 1px solid var(--zbml-switch-line);
    background: var(--zbml-switch-bg);
    box-shadow: var(--zbml-switch-shadow);
    overflow: hidden;
    animation: zbmlLangPanelIn 0.18s ease;
}

@keyframes zbmlLangPanelIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(6px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
}

.zbml-lang-switch--list .zbml-lang-switch__menu {
    min-width: 148px;
    border-radius: var(--zbml-switch-radius);
    border: 1px solid var(--zbml-switch-line);
    background: var(--zbml-switch-bg);
    box-shadow: var(--zbml-switch-shadow);
}

.zbml-lang-switch__item {
    margin: 0;
    padding: 0;
}

.zbml-lang-switch__link {
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.zbml-lang-switch__name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.zbml-lang-switch__meta {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    min-width: 22px;
}

.zbml-lang-switch__code {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--zbml-switch-muted);
    opacity: 0.85;
}

.zbml-lang-switch__check {
    display: block;
    color: var(--zbml-switch-accent);
}

.zbml-lang-switch__link--list {
    display: block;
    padding: 8px 10px;
    border-radius: 10px;
    color: var(--zbml-switch-text);
}

.zbml-lang-switch__link--list:hover {
    background: rgba(37, 99, 235, 0.08);
    color: var(--zbml-switch-accent);
}

.zbml-lang-switch__link--list.is-current {
    background: var(--zbml-switch-accent-soft);
    color: var(--zbml-switch-accent);
    font-weight: 600;
}

/* 贴边浮动语言按钮 —— 完全自包含，避免被主题 button/a/img 等样式污染 */
html body .zbml-lang-float,
html body .zbml-lang-float *,
html body .zbml-lang-float *::before,
html body .zbml-lang-float *::after {
    box-sizing: border-box !important;
    -webkit-font-smoothing: antialiased;
}

html body .zbml-lang-float {
    position: fixed !important;
    z-index: 2147483647 !important;
    right: 0 !important;
    left: auto !important;
    bottom: 200px !important;
    top: auto !important;
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    transform: none !important;
    filter: none !important;
    perspective: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    overflow: visible !important;
    float: none !important;
    clear: none !important;
    display: block !important;
    pointer-events: auto !important;
    isolation: isolate !important;
    contain: none !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif !important;
    font-size: 13px !important;
    font-weight: 400 !important;
    font-style: normal !important;
    line-height: 1.4 !important;
    letter-spacing: normal !important;
    text-align: left !important;
    text-transform: none !important;
    text-decoration: none !important;
    color: #fff !important;
    -webkit-text-size-adjust: 100% !important;
}

html body .zbml-lang-float.zbml-lang-float--left {
    left: 0 !important;
    right: auto !important;
}

html body .zbml-lang-float.zbml-lang-float--right {
    right: 0 !important;
    left: auto !important;
}

html body .zbml-lang-float.zbml-lang-float--top {
    top: 120px !important;
    bottom: auto !important;
}

html body .zbml-lang-float.zbml-lang-float--bottom {
    bottom: 200px !important;
    top: auto !important;
}

html body .zbml-lang-float .zbml-lang-float__btn {
    -webkit-appearance: none !important;
    appearance: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
    width: auto !important;
    height: 45px !important;
    min-width: 45px !important;
    min-height: 45px !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 8px !important;
    border: none !important;
    border-width: 0 !important;
    border-radius: 100px 0 0 100px !important;
    outline: none !important;
    box-shadow: none !important;
    background: rgba(10, 10, 10, 0.4) !important;
    background-image: none !important;
    color: #fff !important;
    cursor: pointer !important;
    line-height: 1 !important;
    font: inherit !important;
    font-size: 13px !important;
    font-weight: 400 !important;
    text-align: center !important;
    text-decoration: none !important;
    text-indent: 0 !important;
    text-shadow: none !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    vertical-align: middle !important;
    float: none !important;
    opacity: 1 !important;
    transform: none !important;
    transition: background 0.15s ease !important;
    -webkit-tap-highlight-color: transparent !important;
    -webkit-user-select: none !important;
    user-select: none !important;
}

html body .zbml-lang-float .zbml-lang-float__btn:hover,
html body .zbml-lang-float .zbml-lang-float__btn:focus,
html body .zbml-lang-float .zbml-lang-float__btn:active,
html body .zbml-lang-float.is-open .zbml-lang-float__btn {
    background: rgba(10, 10, 10, 0.65) !important;
    background-image: none !important;
    color: #fff !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    opacity: 1 !important;
    transform: none !important;
}

html body .zbml-lang-float.zbml-lang-float--left .zbml-lang-float__btn {
    border-radius: 0 100px 100px 0 !important;
}

html body .zbml-lang-float .zbml-lang-float__flag {
    display: block !important;
    width: 22px !important;
    height: 16px !important;
    max-width: 22px !important;
    max-height: 16px !important;
    min-width: 22px !important;
    min-height: 16px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 2px !important;
    object-fit: cover !important;
    object-position: center !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25) !important;
    background: transparent !important;
    vertical-align: middle !important;
    float: none !important;
    position: static !important;
}

html body .zbml-lang-float .zbml-lang-float__flag--fallback {
    display: block !important;
    width: 22px !important;
    height: 16px !important;
    border-radius: 2px !important;
    background: rgba(255, 255, 255, 0.35) !important;
    box-shadow: none !important;
}

html body .zbml-lang-float .zbml-lang-float__panel {
    display: none !important;
    position: absolute !important;
    bottom: 45px !important;
    right: 0 !important;
    left: auto !important;
    top: auto !important;
    z-index: 2147483647 !important;
    width: auto !important;
    min-width: 140px !important;
    max-width: min(80vw, 280px) !important;
    max-height: min(60vh, 420px) !important;
    margin: 0 !important;
    padding: 5px 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    background: rgba(10, 10, 10, 0.6) !important;
    background-image: none !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25) !important;
    color: #fff !important;
    list-style: none !important;
    text-align: left !important;
}

html body .zbml-lang-float.is-open .zbml-lang-float__panel {
    display: block !important;
}

html body .zbml-lang-float.zbml-lang-float--left .zbml-lang-float__panel {
    left: 0 !important;
    right: auto !important;
}

html body .zbml-lang-float.zbml-lang-float--menu-below .zbml-lang-float__panel {
    bottom: auto !important;
    top: 45px !important;
}

html body .zbml-lang-float .zbml-lang-switch__link--float,
html body .zbml-lang-float a.zbml-lang-switch__link--float {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    width: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 8px 12px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
    color: #fff !important;
    text-decoration: none !important;
    text-shadow: none !important;
    text-transform: none !important;
    text-indent: 0 !important;
    white-space: nowrap !important;
    line-height: 1.3 !important;
    font-family: inherit !important;
    font-size: 13px !important;
    font-weight: 400 !important;
    letter-spacing: normal !important;
    opacity: 1 !important;
    transform: none !important;
    float: none !important;
    position: static !important;
    cursor: pointer !important;
    -webkit-tap-highlight-color: transparent !important;
    touch-action: manipulation !important;
}

html body .zbml-lang-float .zbml-lang-switch__link--float:hover,
html body .zbml-lang-float .zbml-lang-switch__link--float:focus,
html body .zbml-lang-float .zbml-lang-switch__link--float:active,
html body .zbml-lang-float a.zbml-lang-switch__link--float:hover,
html body .zbml-lang-float a.zbml-lang-switch__link--float:focus,
html body .zbml-lang-float a.zbml-lang-switch__link--float:active {
    background: #4f4f4f !important;
    background-image: none !important;
    color: #fff !important;
    text-decoration: none !important;
    border: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    opacity: 1 !important;
    transform: none !important;
}

html body .zbml-lang-float .zbml-lang-switch__link--float.is-current,
html body .zbml-lang-float a.zbml-lang-switch__link--float.is-current {
    background: rgba(255, 255, 255, 0.12) !important;
    color: #fff !important;
}

html body .zbml-lang-float .zbml-lang-switch__link--float .zbml-lang-switch__flag {
    display: inline-block !important;
    width: 18px !important;
    height: 14px !important;
    max-width: 18px !important;
    max-height: 14px !important;
    min-width: 18px !important;
    min-height: 14px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 2px !important;
    flex-shrink: 0 !important;
    object-fit: cover !important;
    vertical-align: text-bottom !important;
    float: none !important;
    box-shadow: none !important;
}

html body .zbml-lang-float .zbml-lang-switch__link--float .zbml-lang-switch__flag--fallback {
    display: inline-block !important;
    width: 18px !important;
    height: 14px !important;
    border-radius: 2px !important;
    background: rgba(255, 255, 255, 0.35) !important;
}

html body .zbml-lang-float .zbml-lang-switch__link--float .zbml-lang-switch__name {
    display: inline-block !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    color: #fff !important;
    font-size: 13px !important;
    font-weight: 400 !important;
    line-height: 1.3 !important;
    white-space: nowrap !important;
    text-decoration: none !important;
    text-shadow: none !important;
    float: none !important;
}

/* zbml 为主：共存时隐藏 Jz52 浮动翻译按钮 */
html body .Laoli-translate-button,
html body #translateBtn,
html body #languageList.language-list {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
}

@media (max-width: 1080px) {
    .zbml-lang-switch-item {
        display: block;
        width: 100%;
        line-height: normal;
    }

    .zbml-lang-switch--dropdown.select-dropdown {
        display: block;
        width: 100%;
    }

    .zbml-lang-switch--dropdown .dropdown-toggle {
        width: 100%;
        min-height: 44px;
        padding: 0 18px;
        box-sizing: border-box;
    }

    .zbml-lang-switch--dropdown .dropdown-menu {
        position: static;
        left: auto;
        right: auto;
        float: none;
        width: 100%;
        min-width: 0;
        margin: 0;
        opacity: 1;
        visibility: visible;
        transform: none;
        max-height: 0;
        overflow: hidden;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        pointer-events: none;
        transition: max-height 0.25s ease;
    }

    .zbml-lang-switch--dropdown .dropdown-menu.show {
        max-height: min(70vh, 420px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        pointer-events: auto;
        margin: 0;
        transform: none;
        border-top: 1px solid #eee;
    }

    .zbml-lang-switch--dropdown .dropdown-item {
        padding: 12px 18px;
    }

    .zbml-lang-switch--inline {
        flex-wrap: wrap;
        width: 100%;
    }

    .zbml-lang-switch__inline {
        width: 100%;
    }
}

@media (max-width: 640px) {
    html body .zbml-lang-float.zbml-lang-float--bottom {
        bottom: calc(160px + env(safe-area-inset-bottom, 0px)) !important;
    }

    html body .zbml-lang-float.zbml-lang-float--top {
        top: calc(88px + env(safe-area-inset-top, 0px)) !important;
    }

    html body .zbml-lang-float .zbml-lang-float__btn {
        height: 42px !important;
        min-width: 42px !important;
        min-height: 42px !important;
    }

    html body .zbml-lang-float .zbml-lang-float__flag,
    html body .zbml-lang-float .zbml-lang-float__flag--fallback {
        width: 20px !important;
        height: 15px !important;
        max-width: 20px !important;
        max-height: 15px !important;
        min-width: 20px !important;
        min-height: 15px !important;
    }

    .zbml-lang-switch--dropdown .dropdown-menu.show {
        max-height: min(60vh, 360px);
    }
}

@media (prefers-color-scheme: dark) {
    .zbml-lang-switch,
    .zbml-lang-float {
        --zbml-switch-bg: #1e293b;
        --zbml-switch-bg-soft: #0f172a;
        --zbml-switch-line: rgba(255, 255, 255, 0.1);
        --zbml-switch-text: #f1f5f9;
        --zbml-switch-muted: #94a3b8;
        --zbml-switch-accent: #60a5fa;
        --zbml-switch-accent-soft: rgba(37, 99, 235, 0.18);
        --zbml-switch-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
    }
}
