/**
 * WEA Multi-Currency & Multi-Language Switcher Styles
 * 多语言多货币切换器样式
 */

/* 组合切换器 */
.wea-combined-switcher {
    display: flex;
    align-items: center;
    gap: 0;
}

/* 通用切换器样式 */
.wea-switcher-dropdown {
    position: relative;
    display: inline-block;
}

.wea-switcher-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    cursor: pointer;
    font-size: 14px;
    color: #333 !important;
}

/* 深色背景白色 - 移除了 [class*="dark"] 防止误匹配 */
.whb-color-dark .wea-switcher-btn,
.whb-dark-header .wea-switcher-btn,
header.dark .wea-switcher-btn,
.header-dark .wea-switcher-btn,
.dark-header .wea-switcher-btn,
.wd-header-dark .wea-switcher-btn,
[style*="background-color: #000"] .wea-switcher-btn,
[style*="background-color: black"] .wea-switcher-btn,
[style*="background:#000"] .wea-switcher-btn,
.woodmart-dark .wea-switcher-btn,
.color-scheme-dark .wea-switcher-btn {
    color: #fff !important;
}

.wea-switcher-btn:hover {
    opacity: 0.8;
}

/* ===== 默认（移动端）: 只显示图标，完全隐藏所有文字不占空间 ===== */
.wea-switcher-label,
.wea-switcher-value,
.wea-switcher-arrow {
    display: none !important;
    position: absolute !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    font-size: 0 !important;
    line-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    clip: rect(0,0,0,0) !important;
    white-space: nowrap !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

.wea-switcher-icon {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    align-items: center;
    justify-content: center;
    line-height: 1;
    overflow: visible !important;
}

.wea-switcher-icon svg {
    width: 29px !important;
    height: 29px !important;
    fill: #333 !important; /* 默认颜色，确保图标可见 */
}

/* PNG 图标样式 - 强制可见，防止主题覆盖 */
.wea-switcher-icon .wea-png-icon {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 29px !important;
    height: 29px !important;
    min-width: 29px !important;
    min-height: 29px !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: contain !important;
    font-size: inherit !important;
    overflow: visible !important;
    clip: auto !important;
    clip-path: none !important;
    position: static !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* 深色背景下 SVG 变白 - 注意：移除了 [class*="dark"] 因为太宽泛会误匹配 */
.whb-color-dark > .wea-switcher-icon svg,
.whb-color-dark .wea-combined-switcher .wea-switcher-icon svg,
.whb-dark-header .wea-switcher-icon svg,
header.dark .wea-switcher-icon svg,
.header-dark .wea-switcher-icon svg,
.dark-header .wea-switcher-icon svg,
.wd-header-dark .wea-switcher-icon svg,
.woodmart-dark .wea-switcher-icon svg,
.color-scheme-dark .wea-switcher-icon svg {
    fill: #fff !important;
}

/* 增强 SVG 图标内部路径继承颜色 */
.wea-switcher-icon svg path {
    fill: inherit !important;
}

/* 深色背景下 PNG 图标处理 - 注意：移除了 [class*="dark"] 因为太宽泛会误匹配 */
.whb-color-dark > .wea-switcher-icon .wea-png-icon,
.whb-color-dark .wea-combined-switcher .wea-switcher-icon .wea-png-icon,
.whb-dark-header .wea-switcher-icon .wea-png-icon,
header.dark .wea-switcher-icon .wea-png-icon,
.header-dark .wea-switcher-icon .wea-png-icon,
.dark-header .wea-switcher-icon .wea-png-icon,
.wd-header-dark .wea-switcher-icon .wea-png-icon,
.woodmart-dark .wea-switcher-icon .wea-png-icon,
.color-scheme-dark .wea-switcher-icon .wea-png-icon {
    filter: brightness(0) invert(1) !important;
}

/* 移动端：强制重置 filter，防止白色背景上图标变白不可见 */
@media (max-width: 1024px) {
    .wea-switcher-icon .wea-png-icon {
        filter: none !important;
    }
    .wea-switcher-icon svg {
        fill: #333 !important;
    }
}

/* Emoji 图标样式 - 默认显示 */
.wea-switcher-icon .wea-emoji-icon {
    display: inline-block !important;
    font-size: 24px !important;
    line-height: 1 !important;
}

@media (max-width: 1024px) {
    .wea-switcher-icon .wea-emoji-icon {
        font-size: 22px !important;
    }
}

/* 桌面端：隐藏图标，显示文字 */
@media (min-width: 1025px) {
    .wea-combined-switcher {
        gap: 16px;
    }

    .wea-switcher-btn {
        padding: 8px 12px;
        font-size: 14px !important;
        line-height: normal !important;
    }

    .wea-switcher-icon {
        display: none !important;
    }

    .wea-switcher-label,
    .wea-switcher-label.wea-desktop-only {
        display: inline !important;
        visibility: visible !important;
        opacity: 0.7;
        font-size: 13px;
        position: static !important;
        width: auto !important;
        height: auto !important;
        overflow: visible !important;
        clip: auto !important;
        white-space: normal !important;
    }

    .wea-switcher-value,
    .wea-switcher-value.wea-desktop-only {
        display: inline !important;
        visibility: visible !important;
        opacity: 1;
        font-weight: 500;
        position: static !important;
        width: auto !important;
        height: auto !important;
        overflow: visible !important;
        clip: auto !important;
        white-space: normal !important;
    }

    .wea-switcher-arrow,
    .wea-switcher-arrow.wea-desktop-only {
        display: inline !important;
        visibility: visible !important;
        opacity: 0.6;
        font-size: 10px;
        position: static !important;
        width: auto !important;
        height: auto !important;
        overflow: visible !important;
        clip: auto !important;
        white-space: normal !important;
    }
}

/* ===== 下拉菜单 - 无动画 ===== */
.wea-switcher-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 180px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: none;
    z-index: 9999;
    overflow: hidden;
}

.wea-switcher-dropdown.open .wea-switcher-menu {
    display: block;
}

/* 菜单项 */
.wea-switcher-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
}

.wea-switcher-item:hover {
    background: #f5f5f5;
}

.wea-switcher-item.active {
    background: #f0f0f0;
    font-weight: 500;
}

.wea-check {
    color: #4CAF50;
    font-weight: bold;
}

.wea-lang-switcher .wea-switcher-menu {
    min-width: 160px;
}

.wea-currency-switcher .wea-switcher-menu {
    min-width: 180px;
}

.wea-switcher-item .wea-item-flag {
    margin-right: 6px;
}

/* 价格显示样式 */
.wea-price-converted {
    font-weight: inherit;
}

/* 加载状态 */
.wea-loading {
    opacity: 0.5;
    pointer-events: none;
}

.wea-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #ddd;
    border-top-color: #333;
    border-radius: 50%;
    animation: wea-spin 0.8s linear infinite;
}

@keyframes wea-spin {
    to {
        transform: rotate(360deg);
    }
}

/* 翻译占位符样式 */
[data-wea-t] {
    transition: opacity 0.2s;
}

[data-wea-t].wea-translating {
    opacity: 0.5;
}