/**
 * 百翻货 - 前端样式
 */

/* 货币切换器通用样式 */
.bfh-currency-switcher {
    display: inline-block;
    position: relative;
}

.bfh-currency-switcher select {
    padding: 8px 30px 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    font-size: 14px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.bfh-currency-switcher select:hover {
    border-color: #999;
}

.bfh-currency-switcher select:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 1px #007cba;
}

/* 页头位置 */
.bfh-position-header {
    position: fixed;
    top: 10px;
    right: 20px;
    z-index: 9999;
}

/* 页脚位置 */
.bfh-position-footer {
    position: fixed;
    bottom: 10px;
    right: 20px;
    z-index: 9999;
}

/* 按钮样式 */
.bfh-style-buttons,
.bfh-widget-style-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.bfh-currency-btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.bfh-currency-btn:hover {
    background: #f5f5f5;
    border-color: #999;
}

.bfh-currency-btn.active {
    background: #007cba;
    color: #fff;
    border-color: #007cba;
}

/* 下拉样式 */
.bfh-style-dropdown,
.bfh-widget-style-dropdown {
    width: 100%;
}

.bfh-style-dropdown select,
.bfh-widget-style-dropdown select {
    width: 100%;
}

/* 小工具样式 */
.widget .bfh-currency-switcher {
    display: block;
}

.widget .bfh-widget-style-buttons {
    justify-content: center;
}

/* 响应式 */
@media screen and (max-width: 768px) {
    .bfh-position-header,
    .bfh-position-footer {
        position: static;
        display: block;
        text-align: center;
        padding: 10px;
    }
    
    .bfh-currency-switcher select {
        width: 100%;
        max-width: 200px;
    }
}

/* WooCommerce 价格显示 */
.woocommerce .bfh-converted-price {
    display: inline-block;
}

.woocommerce .bfh-original-price {
    text-decoration: line-through;
    color: #999;
    font-size: 0.85em;
    margin-left: 5px;
}

/* 导航菜单货币项 */
.bfh-currency-menu a,
.menu-item a[href^="#bfh-currency-"] {
    cursor: pointer;
}

.bfh-currency-menu.current-currency > a,
.bfh-current-currency-menu > a {
    font-weight: bold;
}

/* 加载状态 */
body.bfh-loading {
    cursor: wait;
}

body.bfh-loading * {
    pointer-events: none;
}

body.bfh-loading::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.7);
    z-index: 99999;
}

body.bfh-loading::before {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007cba;
    border-radius: 50%;
    animation: bfh-spin 1s linear infinite;
    z-index: 100000;
}

@keyframes bfh-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== 语言切换器 ===== */
.bfh-language-switcher select {
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #ccc;
    background: #fff;
    cursor: pointer;
}
.bfh-language-switcher.bfh-lang-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.bfh-language-switcher.bfh-lang-list li a {
    text-decoration: none;
}
.bfh-language-switcher.bfh-lang-list li.active a {
    font-weight: 700;
}
.bfh-language-switcher-floating {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 9999;
    background: #fff;
    padding: 6px 8px;
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}
