/**
 * 杨杋翻译 - CSS样式文件
 * 支持页头和悬浮按钮两种显示模式
 */

/* ==========================================================================
   基础样式
   ========================================================================== */

.yfgt-lang-switcher {
    position: relative;
    display: inline-block;
    font-family: inherit;
    line-height: 1.4;
}

.yfgt-lang-switcher * {
    box-sizing: border-box;
}

/* ==========================================================================
   页头显示样式
   ========================================================================== */

/* 修复页头布局问题 - 确保元素水平排列 */
.header-right.header-col-end {
    display: flex !important;
    align-items: center;
    gap: 10px;
}

/* 基础语言切换器样式 */
.yfgt-lang-switcher {
    display: inline-block;
    vertical-align: middle;
}

/* ==========================================================================
   下拉菜单样式
   ========================================================================== */

.yfgt-dropdown {
    position: relative;
    display: inline-block;
}

.yfgt-dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-height: 36px;
    vertical-align: middle;
    box-sizing: border-box;
}

.yfgt-dropdown-trigger:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.yfgt-dropdown-trigger:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
}

.yfgt-dropdown.active .yfgt-dropdown-trigger {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.yfgt-flag {
    font-size: 16px;
    line-height: 1;
}

.yfgt-text {
    font-size: 14px;
    font-weight: 400;
}

.yfgt-arrow {
    width: 12px;
    height: 12px;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.yfgt-arrow.rotated {
    transform: rotate(180deg);
}

.yfgt-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    min-width: 160px;
    background: #ffffff;
    border: 1px solid #e1e5e9;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    display: none;
    margin-top: 4px;
}

.yfgt-dropdown.active .yfgt-dropdown-menu {
    display: block;
}

.yfgt-lang-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    color: #333333;
    text-decoration: none;
    font-size: 14px;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #f5f5f5;
}

.yfgt-lang-option.active {
    background-color: #e3f2fd;
    color: #1976d2;
    font-weight: 500;
}

.yfgt-code {
    display: inline-block;
    min-width: 24px;
    font-size: 11px;
    font-weight: 600;
    color: #666666;
    text-align: center;
    background: #f5f5f5;
    border-radius: 3px;
    padding: 2px 4px;
    line-height: 1;
}

.yfgt-lang-option:hover .yfgt-code {
    background: #e0e0e0;
}

.yfgt-lang-option.active .yfgt-code {
    background: #1976d2;
    color: #ffffff;
}

.yfgt-lang-option:last-child {
    border-bottom: none;
}

.yfgt-lang-option:hover {
    background-color: #f8f9fa;
    color: #333333;
    text-decoration: none;
}

.yfgt-lang-option:focus {
    outline: none;
    background-color: #e9ecef;
}

/* ==========================================================================
   文本切换器样式
   ========================================================================== */

.yfgt-text-switcher {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.yfgt-lang-link {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 14px;
    font-weight: 400;
    padding: 4px 8px;
    border-radius: 3px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.yfgt-lang-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
    text-decoration: none;
}

.yfgt-lang-link.active {
    color: #ffffff;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.15);
}

/* ==========================================================================
   标志切换器样式
   ========================================================================== */

.yfgt-flags-switcher {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.yfgt-flag-link {
    display: inline-block;
    font-size: 18px;
    padding: 4px;
    border-radius: 3px;
    text-decoration: none;
    transition: all 0.2s ease;
    opacity: 0.7;
}

.yfgt-flag-link:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
    text-decoration: none;
}

.yfgt-flag-link.active {
    opacity: 1;
    background: rgba(255, 255, 255, 0.15);
}

/* ==========================================================================
   内联切换器样式
   ========================================================================== */

.yfgt-inline-switcher {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    font-size: 14px;
}

.yfgt-inline-switcher .yfgt-lang-link {
    padding: 2px 4px;
}

/* ==========================================================================
   页头专用样式
   ========================================================================== */

.header-lang-switcher {
    margin-left: 16px;
}

.header-lang-switcher .yfgt-dropdown-trigger {
    padding: 6px 10px;
    min-height: 32px;
    font-size: 13px;
    border-color: rgba(255, 255, 255, 0.15);
}

.header-lang-switcher .yfgt-text {
    font-size: 13px;
}

.header-lang-switcher .yfgt-dropdown-menu {
    min-width: 140px;
    right: 0;
    left: auto;
}

/* ==========================================================================
   加载状态
   ========================================================================== */

.yfgt-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.yfgt-spinner {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: yfgt-spin 1s linear infinite;
}

@keyframes yfgt-spin {
    0% { transform: translateY(-50%) rotate(0deg); }
    100% { transform: translateY(-50%) rotate(360deg); }
}

/* ==========================================================================
   响应式设计
   ========================================================================== */

@media (max-width: 768px) {
    .yfgt-dropdown-trigger {
        padding: 6px 10px;
        font-size: 13px;
        min-height: 32px;
    }
    
    .yfgt-text {
        font-size: 13px;
    }
    
    .yfgt-dropdown-menu {
        min-width: 120px;
    }
    
    .yfgt-lang-option {
        padding: 8px 10px;
        font-size: 13px;
    }
    
    .header-lang-switcher {
        margin-left: 8px;
    }
    
    .yfgt-text-switcher {
        gap: 8px;
    }
    
    .yfgt-lang-link {
        font-size: 13px;
        padding: 3px 6px;
    }
}

@media (max-width: 480px) {
    .yfgt-dropdown-trigger .yfgt-text {
        display: none;
    }
    
    .yfgt-dropdown-trigger {
        min-width: 40px;
        justify-content: center;
    }
    
    .yfgt-text-switcher {
        gap: 4px;
    }
    
    .yfgt-lang-link {
        padding: 2px 4px;
        font-size: 12px;
    }
    
    .yfgt-flags-switcher {
        gap: 4px;
    }
    
    .yfgt-flag-link {
        font-size: 16px;
        padding: 2px;
    }
}

/* ==========================================================================
   深色主题支持
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .yfgt-dropdown-menu {
        background: #2d3748;
        border-color: #4a5568;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }
    
    .yfgt-lang-option {
        color: #e2e8f0;
        border-bottom-color: #4a5568;
    }
    
    .yfgt-lang-option:hover {
        background-color: #4a5568;
        color: #ffffff;
    }
    
    .yfgt-lang-option:focus {
        background-color: #718096;
    }
}

/* ==========================================================================
   与页头样式集成
   ========================================================================== */

/* 确保在页头中正确显示 */
#page-header .yfgt-lang-switcher,
.page-header .yfgt-lang-switcher {
    z-index: 9999;
    position: relative;
}

/* 确保下拉菜单在页头子菜单之上 */
#page-header .yfgt-dropdown-menu,
.page-header .yfgt-dropdown-menu {
    z-index: 10000;
}

/* 与现有页头样式兼容 */
.page-header .yfgt-dropdown-trigger {
    border-color: rgba(255, 255, 255, 0.2);
    color: inherit;
}

.page-header .yfgt-dropdown-trigger:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ==========================================================================
   无障碍支持
   ========================================================================== */

.yfgt-dropdown-trigger:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

.yfgt-lang-option:focus-visible {
    outline: 2px solid #007acc;
    outline-offset: -2px;
}

.yfgt-lang-link:focus-visible,
.yfgt-flag-link:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .yfgt-dropdown-trigger {
        border-width: 2px;
        border-color: #ffffff;
    }
    
    .yfgt-dropdown-menu {
        border-width: 2px;
        border-color: #000000;
    }
    
    .yfgt-lang-option {
        border-bottom-width: 2px;
        border-bottom-color: #cccccc;
    }
}

/* 动画减弱支持 */
@media (prefers-reduced-motion: reduce) {
    .yfgt-dropdown-trigger,
    .yfgt-lang-option,
    .yfgt-lang-link,
    .yfgt-flag-link,
    .yfgt-arrow {
        transition: none;
    }
    
    .yfgt-spinner {
        animation: none;
    }
}

/* ==========================================================================
   悬浮按钮样式
   ========================================================================== */

.yfgt-floating-switcher {
    position: fixed;
    bottom: 80px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.yfgt-floating-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 50px;
    height: 50px;
    background: #ffffff;
    border: 2px solid #e1e5e9;
    border-radius: 25px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 12px;
    font-weight: 600;
    color: #333333;
}

.yfgt-floating-trigger:hover {
    background: #f8f9fa;
    border-color: #007acc;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

.yfgt-floating-current {
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
}

.yfgt-floating-arrow {
    width: 8px;
    height: 8px;
    transition: transform 0.2s ease;
    fill: #666666;
}

.yfgt-floating-switcher.active .yfgt-floating-arrow {
    transform: rotate(180deg);
}

.yfgt-floating-menu {
    position: absolute;
    bottom: 60px;
    right: 0;
    min-width: 80px;
    background: #ffffff;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    padding: 8px 0;
    display: none;
    animation: yfgt-float-in 0.2s ease-out;
}

@keyframes yfgt-float-in {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.yfgt-floating-switcher.active .yfgt-floating-menu {
    display: block;
}

.yfgt-floating-option {
    display: block;
    padding: 8px 16px;
    color: #333333;
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #f5f5f5;
}

.yfgt-floating-option:last-child {
    border-bottom: none;
}

.yfgt-floating-option:hover {
    background-color: #f8f9fa;
    color: #007acc;
    text-decoration: none;
}

/* 悬浮按钮移动端适配 */
@media (max-width: 768px) {
    .yfgt-floating-switcher {
        bottom: 20px;
        right: 15px;
    }
    
    .yfgt-floating-trigger {
        width: 45px;
        height: 45px;
        border-radius: 22.5px;
    }
    
    .yfgt-floating-current {
        font-size: 10px;
    }
    
    .yfgt-floating-arrow {
        width: 7px;
        height: 7px;
    }
    
    .yfgt-floating-menu {
        bottom: 55px;
        min-width: 70px;
    }
    
    .yfgt-floating-option {
        padding: 6px 12px;
        font-size: 11px;
    }
}

/* 页头样式修正 - 使用mingmo主题兼容的样式 */
.header-lang-switcher .yfgt-dropdown-trigger {
    background: transparent !important;
    border: none !important;
    color: #000000 !important;
    font-family: "Open Sans", sans-serif !important;
    font-size: 14px !important;
    font-weight: 400 !important;
    padding: 6px 10px !important;
    transition: none !important;
    cursor: pointer !important;
    outline: none !important;
    box-shadow: none !important;
}

.header-lang-switcher .yfgt-dropdown-trigger:hover,
.header-lang-switcher .yfgt-dropdown-trigger:focus,
.header-lang-switcher .yfgt-dropdown-trigger:active {
    background: transparent !important;
    color: #000000 !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
}

.header-lang-switcher .yfgt-text {
    color: #000000 !important;
    font-family: "Open Sans", sans-serif !important;
    font-size: 14px !important;
    font-weight: 400 !important;
}

.header-lang-switcher .yfgt-arrow {
    fill: #000000 !important;
}

.header-lang-switcher .yfgt-dropdown-menu {
    background: #ffffff !important;
    border: 1px solid #e1e5e9 !important;
    border-radius: 6px !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15) !important;
    z-index: 10002 !important;
}

.header-lang-switcher .yfgt-lang-option {
    color: #000000 !important;
    font-family: "Open Sans", sans-serif !important;
    font-size: 14px !important;
    font-weight: 400 !important;
}

.header-lang-switcher .yfgt-lang-option:hover {
    background-color: #f8f9fa !important;
    color: #000000 !important;
}

/* 防止重复显示语言切换器 */
.yfgt-lang-switcher + .yfgt-lang-switcher {
    display: none !important;
}

/* ==========================================================================
   防止翻译样式 - 确保语言切换器不被Google Translate翻译
   ========================================================================== */

/* 为notranslate类添加额外的保护 */
.notranslate {
    -webkit-transform: none !important;
    -moz-transform: none !important;
    -ms-transform: none !important;
    -o-transform: none !important;
    transform: none !important;
}

/* 确保语言切换器相关元素不被翻译 */
.yfgt-lang-switcher.notranslate,
.yfgt-dropdown.notranslate,
.yfgt-dropdown-trigger.notranslate,
.yfgt-dropdown-menu.notranslate,
.yfgt-lang-option.notranslate,
.yfgt-text.notranslate,
.yfgt-code.notranslate {
    /* 重要：告诉Google Translate不要翻译这些元素 */
    translate: no !important;
    /* Webkit浏览器支持 */
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

/* Google Translate的font标签覆盖保护 */
.yfgt-lang-switcher font,
.yfgt-dropdown font,
.yfgt-dropdown-trigger font,
.yfgt-dropdown-menu font,
.yfgt-lang-option font {
    font-family: inherit !important;
    color: inherit !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    box-shadow: none !important;
    text-decoration: inherit !important;
    font-size: inherit !important;
    font-weight: inherit !important;
}