/* ── 隐藏 Google 翻译原生工具栏 ── */
.goog-te-banner-frame { display: none !important; }
.goog-logo-link       { display: none !important; }
.goog-te-gadget       { font-size: 0 !important; color: transparent !important; }

/* ── 隐藏 hover / click 弹窗 ── */
.goog-tooltip,
.goog-tooltip-simple,
.goog-te-balloon-frame,
.goog-te-balloon,
#goog-gt-tt,
#goog-gt-tt * {
    display:    none !important;
    visibility: hidden !important;
    opacity:    0 !important;
}

/* ── 清除翻译文本高亮 ── */
font[class*="VIpgJd"] {
    background-color: transparent !important;
    border:  none !important;
    box-shadow: none !important;
}

.goog-text-highlight {
    pointer-events: none !important;
}

/* ── 修复翻译后 body 被顶下去 ── */
body {
    top:      0 !important;
    position: static !important;
}

/* ── 自定义语言下拉组件 ── */
.translate-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    transition: border-color .2s, box-shadow .2s;
    min-width: 160px;
    user-select: none;
}

.translate-dropdown-btn:hover {
    border-color: #b0b0b0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* ── 国旗 ── */
.translate-dropdown-btn .flag,
.translate-dropdown-item .flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 18px;
    flex-shrink: 0;
}

.translate-dropdown-btn .flag .flag-img,
.translate-dropdown-item .flag .flag-img {
    width: 24px;
    height: 18px;
    border-radius: 3px;
    object-fit: cover;
    display: block;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.06);
}

.translate-dropdown-btn .label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.translate-dropdown-btn .arrow {
    font-size: 10px;
    color: #999;
}

/* ── 下拉列表 ── */
.translate-dropdown-list {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    min-width: 240px;
    z-index: 10000;
    display: none;
    overflow: hidden;
}

.translate-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background .15s;
    font-size: 14px;
    color: #333;
}

.translate-dropdown-item:hover {
    background: #f5f5f5;
}

.translate-dropdown-item .label {
    flex: 1;
}

/* ── 翻译质量标签 ── */
.translate-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    flex-shrink: 0;
}

.translate-badge-db {
    background: #e8f5e9;
    color: #2e7d32;
}

.translate-badge-mt {
    background: #fff3e0;
    color: #e65100;
}

/* ── 搜索框 ── */
.translate-search {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 14px;
    border: none;
    border-bottom: 1px solid #e0e0e0;
    outline: none;
    font-size: 14px;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 1;
}

.translate-search:focus {
    border-bottom-color: #0070f3;
}

/* ── 下拉列表区块标题（最近使用）── */
.translate-dropdown-header {
    padding: 6px 14px 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #999;
    background: #fafafa;
}

/* ── 下拉列表分隔线 ── */
.translate-dropdown-divider {
    height: 1px;
    background: #e0e0e0;
    margin: 0;
}

/* ── 最近使用语言项 ── */
.translate-recent-item .label::before {
    content: '★ ';
    color: #f5a623;
}

/* ── 键盘导航高亮项 ── */
.translate-dropdown-item.active {
    background: #e3f2fd;
    outline: 2px solid #0070f3;
    outline-offset: -2px;
}

/* ── 翻译加载指示器 ── */
.translate-loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(2px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    gap: 16px;
}

.translate-loader-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e0e0e0;
    border-top-color: #0070f3;
    border-radius: 50%;
    animation: translate-spin 0.8s linear infinite;
}

@keyframes translate-spin {
    to { transform: rotate(360deg); }
}

.translate-loader-text {
    font-size: 15px;
    color: #333;
    font-weight: 500;
}

/* ── 错误提示 toast ── */
.translate-error-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #d32f2f;
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 99999;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    animation: translate-toast-in 0.3s ease;
}

@keyframes translate-toast-in {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── 移动端适配 ── */
@media (max-width: 768px) {
    .translate-dropdown-list {
        right: 0;
        left: auto;
        min-width: 200px;
    }
    .translate-dropdown-btn {
        min-width: 120px;
        padding: 6px 10px;
    }
    .translate-dropdown-btn .label {
        font-size: 13px;
    }
    .translate-loader-spinner {
        width: 40px;
        height: 40px;
    }
    .translate-error-toast {
        bottom: 16px;
        left: 16px;
        right: 16px;
        transform: none;
        text-align: center;
    }
}

/* ── 暗黑模式支持 ── */
@media (prefers-color-scheme: dark) {
    .translate-dropdown-btn {
        background: #2a2a2a;
        border-color: #444;
        color: #eee;
        box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    }

    .translate-dropdown-btn:hover {
        border-color: #666;
        box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    }

    .translate-dropdown-btn .label {
        color: #eee;
    }

    .translate-dropdown-list {
        background: #2a2a2a;
        border-color: #444;
        box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    }

    .translate-dropdown-item {
        color: #ddd;
    }

    .translate-dropdown-item:hover {
        background: #383838;
    }

    .translate-dropdown-item.active {
        background: #1a3a5c;
        outline-color: #0070f3;
    }

    .translate-dropdown-header {
        color: #888;
        background: #232323;
    }

    .translate-dropdown-divider {
        background: #444;
    }

    .translate-search {
        background: #2a2a2a;
        color: #eee;
        border-bottom-color: #444;
    }

    .translate-search::placeholder {
        color: #888;
    }

    .translate-loader-overlay {
        background: rgba(20, 20, 20, 0.8);
    }

    .translate-loader-text {
        color: #eee;
    }

    .translate-loader-spinner {
        border-color: #444;
        border-top-color: #0070f3;
    }
}

/* ── RTL 语言适配（阿拉伯语、希伯来语、波斯语等）── */
[dir="rtl"] body { text-align: right; }

/* Bootstrap 间距反转 */
[dir="rtl"] .me-1 { margin-right: 0 !important; margin-left: 0.25rem !important; }
[dir="rtl"] .me-2 { margin-right: 0 !important; margin-left: 0.5rem !important; }
[dir="rtl"] .me-3 { margin-right: 0 !important; margin-left: 1rem !important; }
[dir="rtl"] .me-4 { margin-right: 0 !important; margin-left: 1.5rem !important; }
[dir="rtl"] .ms-1 { margin-left: 0 !important; margin-right: 0.25rem !important; }
[dir="rtl"] .ms-2 { margin-left: 0 !important; margin-right: 0.5rem !important; }
[dir="rtl"] .ms-3 { margin-left: 0 !important; margin-right: 1rem !important; }
[dir="rtl"] .ms-4 { margin-left: 0 !important; margin-right: 1.5rem !important; }
[dir="rtl"] .ps-3 { padding-left: 0 !important; padding-right: 1rem !important; }
[dir="rtl"] .ps-4 { padding-left: 0 !important; padding-right: 1.5rem !important; }
[dir="rtl"] .ps-lg-5 { padding-left: 0 !important; padding-right: 3rem !important; }
[dir="rtl"] .pe-2 { padding-right: 0 !important; padding-left: 0.5rem !important; }
[dir="rtl"] .pe-3 { padding-right: 0 !important; padding-left: 1rem !important; }

/* 文本对齐反转 */
[dir="rtl"] .text-start { text-align: right !important; }
[dir="rtl"] .text-end { text-align: left !important; }
[dir="rtl"] .text-left { text-align: right !important; }
[dir="rtl"] .text-right { text-align: left !important; }

/* Flex 方向反转 */
[dir="rtl"] .flex-row { flex-direction: row-reverse !important; }
[dir="rtl"] .d-flex.flex-row { flex-direction: row-reverse !important; }

/* 浮动反转 */
[dir="rtl"] .float-start { float: right !important; }
[dir="rtl"] .float-end { float: left !important; }

/* 下拉菜单对齐 */
[dir="rtl"] .dropdown-menu-end { left: 0 !important; right: auto !important; }
[dir="rtl"] .dropdown-menu-start { right: 0 !important; left: auto !important; }

/* 导航栏反转 */
[dir="rtl"] .navbar-nav { flex-direction: row-reverse; }
[dir="rtl"] .me-auto { margin-right: 0 !important; margin-left: auto !important; }
[dir="rtl"] .ms-auto { margin-left: 0 !important; margin-right: auto !important; }

/* 面包屑分隔符反转 */
[dir="rtl"] .breadcrumb-item + .breadcrumb-item::before {
    content: "\\" !important;
    padding-left: 0.5rem;
    padding-right: 0;
}

/* 输入组反转 */
[dir="rtl"] .input-group > :not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; }
[dir="rtl"] .input-group > :first-child { border-top-right-radius: 0.375rem; border-bottom-right-radius: 0.375rem; }

/* 方向性图标镜像翻转 */
[dir="rtl"] .fa-arrow-right,
[dir="rtl"] .bi-arrow-right,
[dir="rtl"] .fa-chevron-right,
[dir="rtl"] .bi-chevron-right,
[dir="rtl"] .fa-angle-right,
[dir="rtl"] .fa-caret-right {
    transform: scaleX(-1);
}
[dir="rtl"] .fa-arrow-left,
[dir="rtl"] .bi-arrow-left,
[dir="rtl"] .fa-chevron-left,
[dir="rtl"] .bi-chevron-left {
    transform: scaleX(-1);
}

/* 产品详情页 RTL */
[dir="rtl"] .product-gallery { direction: rtl; }
[dir="rtl"] .product-slider,
[dir="rtl"] .product-thumb { direction: rtl; }

/* 按钮组 RTL */
[dir="rtl"] .btn-group { flex-direction: row-reverse; }

/* 卡片 RTL */
[dir="rtl"] .card-header .float-end { float: left !important; }

/* 表格 RTL */
[dir="rtl"] table { text-align: right; }
[dir="rtl"] th { text-align: right; }

/* 翻译下拉框 RTL */
[dir="rtl"] .translate-dropdown { left: 0; right: auto; }
