/**
 * 自定义语言切换器样式
 * Custom Language Switcher Styles for TranslatePress
 */

/* 语言切换器容器 */
.header-language {
    display: inline-flex;
    align-items: center;
    margin-left: 15px;
    flex-shrink: 0; /* 防止被压缩 */
    white-space: nowrap; /* 防止换行 */
}

/* TranslatePress 默认语言切换器样式重置 */
.header-language .trp-language-switcher,
.header-language .trp-ls-shortcode-language {
    margin: 0;
    padding: 0;
}

/* 语言切换器下拉选择框 */
.header-language select.trp-ls-shortcode-current-language {
    background-color: transparent;
    border: 2px solid #e5e5e5;
    border-radius: 25px;
    padding: 8px 30px 8px 12px;
    font-size: 13px;
    font-weight: 500;
    color: #0a0e1a;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%230a0e1a' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    min-width: 100px;
    max-width: 110px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-language select.trp-ls-shortcode-current-language:hover {
    border-color: #ff6b2c;
    background-color: rgba(255, 107, 44, 0.05);
}

.header-language select.trp-ls-shortcode-current-language:focus {
    outline: none;
    border-color: #ff6b2c;
    box-shadow: 0 0 0 3px rgba(255, 107, 44, 0.1);
}

/* 浮动语言切换器样式（如果使用浮动模式） */
.trp-floater {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    z-index: 9999 !important;
}

.trp-floater .trp-ls-shortcode-current-language {
    background-color: #fff;
    border: 2px solid #ff6b2c;
    border-radius: 50px;
    padding: 12px 40px 12px 20px;
    font-size: 14px;
    font-weight: 600;
    color: #0a0e1a;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.trp-floater .trp-ls-shortcode-current-language:hover {
    background-color: #ff6b2c;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 44, 0.3);
}

/* 语言切换器标志图标样式 */
.header-language .trp-flag-image,
.header-language img[src*="flag"] {
    width: 20px;
    height: 15px;
    margin-right: 8px;
    border-radius: 2px;
    object-fit: cover;
}

/* 下拉菜单样式（如果使用下拉菜单模式） */
.trp-ls-shortcode-language {
    position: relative;
}

.trp-ls-shortcode-language .trp-ls-language-name {
    display: inline-flex;
    align-items: center;
    padding: 8px 15px;
    background-color: transparent;
    border: 2px solid #e5e5e5;
    border-radius: 25px;
    color: #0a0e1a;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.trp-ls-shortcode-language .trp-ls-language-name:hover {
    border-color: #ff6b2c;
    background-color: rgba(255, 107, 44, 0.05);
}

/* 下拉选项 */
.trp-ls-shortcode-language ul {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 5px;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 8px 0;
    min-width: 150px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.trp-ls-shortcode-language:hover ul,
.trp-ls-shortcode-language ul:hover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.trp-ls-shortcode-language ul li {
    list-style: none;
    margin: 0;
    padding: 0;
}

.trp-ls-shortcode-language ul li a {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    color: #0a0e1a;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 14px;
}

.trp-ls-shortcode-language ul li a:hover {
    background-color: rgba(255, 107, 44, 0.1);
    color: #ff6b2c;
}

.trp-ls-shortcode-language ul li.current-language a {
    background-color: rgba(255, 107, 44, 0.15);
    color: #ff6b2c;
    font-weight: 600;
}

/* 确保导航栏操作区域不换行 */
.tgmenu__action {
    flex-shrink: 0;
    white-space: nowrap;
    margin-left: auto; /* 推到右侧 */
}

.tgmenu__action ul.list-wrap {
    display: flex;
    align-items: center;
    flex-wrap: nowrap; /* 防止换行 */
    gap: 10px;
    margin: 0;
    padding: 0;
}

.tgmenu__action ul.list-wrap > li {
    flex-shrink: 0; /* 防止被压缩 */
    list-style: none;
}

/* 头部容器宽度优化 - 允许更宽的容器 */
.tg-header__area .container,
.tg-header__area-two .container {
    max-width: 100% !important;
    padding-left: 30px !important;
    padding-right: 30px !important;
}

@media (min-width: 1600px) {
    .tg-header__area .container,
    .tg-header__area-two .container {
        max-width: 1600px !important;
    }
}

@media (max-width: 1500px) {
    .tg-header__area .container,
    .tg-header__area-two .container {
        max-width: 1400px !important;
        padding-left: 25px !important;
        padding-right: 25px !important;
    }
}

@media (max-width: 1350px) {
    .tg-header__area .container,
    .tg-header__area-two .container {
        max-width: 100% !important;
        padding-left: 20px !important;
        padding-right: 20px !important;
    }
}

/* 优化导航栏整体布局 */
.tgmenu__nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap; /* 防止换行 */
    gap: 15px;
}

.tgmenu__navbar-wrap {
    flex-grow: 1;
    flex-shrink: 1; /* 允许菜单收缩 */
    min-width: 0; /* 允许 flex 子元素收缩到比内容更小 */
}

.tgmenu__navbar-wrap > ul {
    flex-wrap: nowrap !important; /* 强制不换行 */
}

/* 在空间不足时优先压缩菜单项间距 */
@media (max-width: 1600px) {
    .tgmenu__navbar-wrap > ul > li {
        margin-right: 25px !important;
    }
}

@media (max-width: 1500px) {
    .tgmenu__navbar-wrap > ul > li {
        margin-right: 20px !important;
    }
    
    .tgmenu__navbar-wrap > ul > li a {
        font-size: 17px !important;
    }
}

@media (max-width: 1350px) {
    .tgmenu__navbar-wrap > ul > li {
        margin-right: 15px !important;
    }
    
    .tgmenu__navbar-wrap > ul > li a {
        font-size: 16px !important;
    }
}

@media (max-width: 1250px) {
    .tgmenu__navbar-wrap > ul > li {
        margin-right: 12px !important;
    }
    
    .tgmenu__navbar-wrap > ul > li a {
        font-size: 15px !important;
    }
}

@media (max-width: 1150px) {
    .tgmenu__navbar-wrap > ul > li {
        margin-right: 10px !important;
    }
    
    .tgmenu__navbar-wrap > ul > li a {
        font-size: 14px !important;
    }
    
    /* 减小右侧操作区域的间距 */
    .tgmenu__action ul.list-wrap {
        gap: 8px !important;
    }
}

@media (max-width: 1050px) {
    .tgmenu__navbar-wrap > ul > li {
        margin-right: 8px !important;
    }
    
    .tgmenu__navbar-wrap > ul > li a {
        font-size: 13px !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    
    .tgmenu__action ul.list-wrap {
        gap: 5px !important;
    }
}

/* 中等屏幕优化 - 减小语言切换器尺寸 */
@media (max-width: 1400px) {
    .header-language select.trp-ls-shortcode-current-language {
        min-width: 90px;
        max-width: 100px;
        font-size: 12px;
        padding: 6px 28px 6px 10px;
    }
    
    .header-language {
        margin-left: 10px;
    }
}

@media (max-width: 1199px) {
    .header-language select.trp-ls-shortcode-current-language {
        min-width: 80px;
        max-width: 90px;
        font-size: 12px;
        padding: 6px 25px 6px 8px;
        background-position: right 8px center;
    }
    
    .header-language {
        margin-left: 8px;
    }
}

/* 移动端适配 */
@media (max-width: 991px) {
    .header-language {
        display: none; /* 在移动端隐藏，可以在移动菜单中单独添加 */
    }
}

/* 移动菜单中的语言切换器 */
.tgmobile__menu .mobile-language-switcher {
    padding: 20px;
    border-top: 1px solid #e5e5e5;
    margin-top: 20px;
}

.tgmobile__menu .mobile-language-switcher select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e5e5e5;
    border-radius: 8px;
    font-size: 14px;
    background-color: #fff;
}

/* 语言切换器动画效果 */
@keyframes languageFadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.header-language {
    animation: languageFadeIn 0.3s ease;
}

/* 主题色适配 */
:root {
    --language-switcher-primary: #ff6b2c;
    --language-switcher-hover: #e55a1f;
    --language-switcher-border: #e5e5e5;
    --language-switcher-text: #0a0e1a;
}

/* 可自定义的颜色变量 */
.header-language select.trp-ls-shortcode-current-language {
    border-color: var(--language-switcher-border);
    color: var(--language-switcher-text);
}

.header-language select.trp-ls-shortcode-current-language:hover {
    border-color: var(--language-switcher-primary);
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .header-language select.trp-ls-shortcode-current-language {
        border-width: 3px;
    }
}

/* 暗色模式支持（可选） */
@media (prefers-color-scheme: dark) {
    .header-language select.trp-ls-shortcode-current-language {
        background-color: #1a1a1a;
        color: #fff;
        border-color: #333;
    }
    
    .header-language select.trp-ls-shortcode-current-language:hover {
        background-color: rgba(255, 107, 44, 0.2);
    }
}
