/**
 * 语言切换器前台多套模版样式
 */

/* 彻底抑制并消除 Google 翻译顶部横条扰动与页面高度下移 */
html, body {
    top: 0px !important;
    position: static !important;
}

.skiptranslate,
iframe.skiptranslate,
.goog-te-banner-frame,
#goog-gt-tt {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    width: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

body > .skiptranslate {
    display: none !important;
}

/* ========================================================
   1. 模版 1: 浮动悬浮球 (Floating Badge)
   ======================================================== */
.wpit-floating-wrapper {
    position: fixed;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    user-select: none;
    line-height: 1.4;
}

.wpit-pos-bottom-right { 
    bottom: var(--wpit-offset-y, 25px); 
    right: var(--wpit-offset-x, 25px); 
}
.wpit-pos-bottom-left { 
    bottom: var(--wpit-offset-y, 25px); 
    left: var(--wpit-offset-x, 25px); 
}
.wpit-pos-top-right { 
    top: var(--wpit-offset-y, 25px); 
    right: var(--wpit-offset-x, 25px); 
}
.wpit-pos-top-left { 
    top: var(--wpit-offset-y, 25px); 
    left: var(--wpit-offset-x, 25px); 
}

/* 悬浮圆形按钮 */
.wpit-floating-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    height: 44px;
    background-color: var(--wpit-bg-color, #ffffff);
    color: var(--wpit-text-color, #1e293b);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: var(--wpit-radius, 22px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
}

.wpit-floating-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
    border-color: var(--wpit-theme-color, #2563eb);
}

.wpit-btn-flag {
    font-size: 20px;
    line-height: 1;
}

.wpit-btn-text {
    letter-spacing: 0.5px;
}

/* 弹出语言列表面板 - 优化宽度至280px，防止文字换行 */
.wpit-floating-panel {
    position: absolute;
    width: 280px;
    max-height: 380px;
    background: var(--wpit-bg-color, #ffffff);
    border-radius: var(--wpit-radius, 12px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.06);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.95);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
}

.wpit-pos-bottom-right .wpit-floating-panel { bottom: 54px; right: 0; transform-origin: bottom right; }
.wpit-pos-bottom-left  .wpit-floating-panel { bottom: 54px; left: 0; transform-origin: bottom left; }
.wpit-pos-top-right    .wpit-floating-panel { top: 54px; right: 0; transform-origin: top right; }
.wpit-pos-top-left     .wpit-floating-panel { top: 54px; left: 0; transform-origin: top left; }

.wpit-floating-panel.active {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

.wpit-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.wpit-panel-title {
    font-size: 13.5px;
    font-weight: 700;
    color: #334155;
}

.wpit-panel-close {
    background: none;
    border: none;
    font-size: 18px;
    line-height: 1;
    color: #94a3b8;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
}
.wpit-panel-close:hover {
    color: #1e293b;
    background: #e2e8f0;
}

.wpit-panel-body {
    overflow-y: auto;
    padding: 6px 0;
}

.wpit-lang-list {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.wpit-lang-list .wpit-lang-item {
    margin: 0;
    padding: 0;
}

.wpit-lang-list .wpit-lang-choice {
    display: flex;
    align-items: center;
    padding: 10px 18px;
    text-decoration: none !important;
    color: var(--wpit-text-color, #1e293b) !important;
    font-size: 14px;
    gap: 12px;
    background: transparent;
    transition: background 0.15s ease;
    white-space: nowrap;
}

.wpit-lang-list .wpit-lang-choice:hover {
    background-color: #f1f5f9;
}

/* 仅激活项拥有专属浅蓝背景与高亮色文字 */
.wpit-lang-item.active .wpit-lang-choice {
    background-color: rgba(37, 99, 235, 0.08) !important;
    color: var(--wpit-theme-color, #2563eb) !important;
    font-weight: 600 !important;
}

.wpit-item-flag {
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
}

.wpit-item-native {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    letter-spacing: 0.2px;
}

/* 严格控制对勾显隐：未选语言强制完全隐藏 */
.wpit-item-check {
    display: none !important;
    margin-left: auto;
    color: var(--wpit-theme-color, #2563eb);
    font-weight: bold;
    font-size: 15px;
    line-height: 1;
}

.wpit-lang-item.active .wpit-item-check {
    display: inline-block !important;
}

/* ========================================================
   2. 模版 2: 紧凑下拉菜单 (Dropdown)
   ======================================================== */
.wpit-dropdown-wrapper {
    display: inline-block;
    position: relative;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    vertical-align: middle;
}

.wpit-dropdown {
    position: relative;
}

.wpit-dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    background-color: var(--wpit-bg-color, #ffffff);
    color: var(--wpit-text-color, #1e293b);
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: var(--wpit-radius, 6px);
    font-size: 13.5px;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.wpit-dropdown-toggle:hover {
    border-color: var(--wpit-theme-color, #2563eb);
}

.wpit-drop-flag {
    font-size: 16px;
    line-height: 1;
}

.wpit-drop-label {
    font-weight: 500;
}

.wpit-drop-arrow {
    font-size: 10px;
    opacity: 0.6;
    margin-left: 2px;
    transition: transform 0.2s ease;
}

.wpit-dropdown.open .wpit-drop-arrow {
    transform: rotate(180deg);
}

.wpit-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 175px;
    background: var(--wpit-bg-color, #ffffff);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: var(--wpit-radius, 8px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: all 0.15s ease-out;
    padding: 4px 0;
    max-height: 280px;
    overflow-y: auto;
}

.wpit-dropdown.open .wpit-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.wpit-dropdown-list {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.wpit-drop-item a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    text-decoration: none !important;
    color: var(--wpit-text-color, #1e293b) !important;
    font-size: 13px;
    background: transparent;
    white-space: nowrap;
}

.wpit-drop-item a:hover {
    background: #f1f5f9;
}

/* 仅激活项拥有专属浅蓝背景与高亮色文字 */
.wpit-drop-item.active a {
    color: var(--wpit-theme-color, #2563eb) !important;
    font-weight: 600 !important;
    background-color: rgba(37, 99, 235, 0.06) !important;
}

.wpit-drop-item-flag {
    font-size: 16px;
    line-height: 1;
}

/* 下拉菜单对勾严格控制 */
.wpit-drop-item-check {
    display: none !important;
    margin-left: auto;
    color: var(--wpit-theme-color, #2563eb);
    font-weight: bold;
    font-size: 13px;
    line-height: 1;
}

.wpit-drop-item.active .wpit-drop-item-check {
    display: inline-block !important;
}

/* ========================================================
   3. 模版 3: 底部/顶部悬浮横条 (Bar)
   ======================================================== */
.wpit-bar-wrapper {
    position: fixed;
    z-index: 999998;
    background: var(--wpit-bg-color, #ffffff);
    color: var(--wpit-text-color, #1e293b);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    padding: 8px 16px;
    width: 100%;
    left: 0;
    right: 0;
}

.wpit-bar-wrapper.wpit-pos-bottom-right,
.wpit-bar-wrapper.wpit-pos-bottom-left {
    bottom: 0;
    top: auto;
}

.wpit-bar-wrapper.wpit-pos-top-right,
.wpit-bar-wrapper.wpit-pos-top-left {
    top: 0;
    bottom: auto;
    border-top: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.wpit-bar-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.wpit-bar-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    color: #64748b;
}

.wpit-bar-scroll {
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
}
.wpit-bar-scroll::-webkit-scrollbar {
    display: none;
}

.wpit-bar-items {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.wpit-bar-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: var(--wpit-radius, 16px);
    text-decoration: none !important;
    color: var(--wpit-text-color, #1e293b) !important;
    font-size: 12.5px;
    background: #f1f5f9;
    transition: all 0.2s ease;
}

.wpit-bar-item:hover {
    background: #e2e8f0;
}

.wpit-bar-item.active {
    background: var(--wpit-theme-color, #2563eb) !important;
    color: #ffffff !important;
    font-weight: 600;
}

/* 移动端小屏响应式适配 */
@media (max-width: 768px) {
    .wpit-pos-bottom-right,
    .wpit-pos-bottom-left {
        bottom: max(var(--wpit-offset-y, 25px), 16px);
    }
    .wpit-floating-panel {
        max-width: 88vw;
    }
}
