/*
 Theme Name:   Woodmart Child
 Description:  Woodmart Child Theme
 Author:       XTemos
 Author URI:   http://xtemos.com
 Template:     woodmart
 Version:      1.0.0
 Text Domain:  woodmart
*/

/* ========================================
   GTranslate Float Style Override
   ======================================== */

/* 主容器 - 页眉垂直居中 */
.gt_float_switcher {
    position: relative !important;
    box-shadow: none !important;
    background: transparent !important;
    overflow: visible !important;
    display: inline-flex !important;
    align-items: center !important;
    width: auto !important;
}

/* 外层包装器也需要正确定位 */
#gt_float_wrapper {
    position: relative !important;
    display: inline-flex !important;
    align-items: center !important;
    height: 100% !important;
}

/* 触发按钮 - 当前语言居中 */
.gt_float_switcher .gt-selected {
    text-align: center !important;
}

.gt_float_switcher .gt-selected .gt-current-lang {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    padding: 6px 10px !important;
}

.gt_float_switcher .gt-selected .gt-current-lang img {
    width: 24px !important;
    height: 16px !important;
    margin: 0 !important;
}

.gt_float_switcher .gt-selected .gt-current-lang .gt-lang-code {
    text-transform: uppercase !important;
    font-size: 14px !important;
    font-weight: 500 !important;
}

/* 下拉选项容器 - 两列网格，超出滚动 */
.gt_float_switcher .gt_options {
    position: absolute !important;
    top: 100% !important;
    bottom: auto !important;
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
    max-height: 300px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    background: #fff !important;
    border: 1px solid #eee !important;
    border-radius: 4px !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1) !important;
    padding: 10px !important;
    padding-top: 15px !important;
    width: 200px !important;
    display: none !important;
    z-index: 999999 !important;
}

/* 下拉菜单显示状态 - 只通过JS控制的gt-open类 */
.gt_float_switcher .gt_options.gt-open {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 4px !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateX(-50%) !important;
    transition-delay: 0s !important;
}

/* 悬停显示 - 仅PC端 */
@media (min-width: 1025px) {
    .gt_float_switcher:hover .gt_options,
    .gt_float_switcher .gt_options:hover {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 4px !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: translateX(-50%) !important;
    }
}

/* 语言选项 - 压缩空间 */
.gt_float_switcher .gt_options a {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 6px 12px !important;
    border-radius: 0 !important;
    text-decoration: none !important;
    color: #333 !important;
    font-size: 0 !important;
    white-space: nowrap !important;
    border-bottom: none !important;
}

/* 语言简称 */
.gt_float_switcher .gt_options a::after {
    content: attr(data-gt-lang);
    font-size: 14px !important;
    font-weight: 400 !important;
    text-transform: uppercase !important;
    color: #333 !important;
}

.gt_float_switcher .gt_options a:hover {
    background: transparent !important;
    color: #000 !important;
}

.gt_float_switcher .gt_options a:hover::after {
    color: #000 !important;
}

/* 语言国旗 */
.gt_float_switcher .gt_options a img {
    width: 22px !important;
    height: 15px !important;
    border-radius: 2px !important;
    object-fit: cover !important;
    margin: 0 !important;
}

/* 滚动条样式 */
.gt_float_switcher .gt_options::-webkit-scrollbar {
    width: 4px;
}

.gt_float_switcher .gt_options::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.gt_float_switcher .gt_options::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

/* 箭头默认向下，悬停时向上（修复反向问题） */
.gt_float_switcher .gt-selected .gt-current-lang span.gt_float_switcher-arrow {
    transform: rotate(0deg) !important;
}

.gt_float_switcher:hover .gt-selected .gt-current-lang span.gt_float_switcher-arrow,
.gt_float_switcher .gt-selected .gt-current-lang span.gt_float_switcher-arrow.gt_arrow_rotate {
    transform: rotate(180deg) !important;
}

/* 隐藏 Google Translate 横条 */
.skiptranslate,
#google_translate_element2,
.goog-te-banner-frame {
    display: none !important;
}

body {
    top: 0 !important;
}

/* ========================================
   移动端GTranslate样式
   ======================================== */
@media (max-width: 1024px) {
    /* 强制GTranslate在移动端显示 */
    #gt_float_wrapper,
    .gt_float_switcher,
    .gtranslate_wrapper,
    [class*="gt_container"],
    [class*="gtranslate"] {
        display: inline-flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: relative !important;
    }
    
    /* 移动端下拉菜单 - 与PC端相同：两列布局 */
    .gt_float_switcher .gt_options {
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) !important;
        width: 200px !important;
        max-height: 280px !important;
        overflow-y: auto !important;
        position: absolute !important;
        z-index: 999999 !important;
    }
    
    .gt_float_switcher .gt_options.gt-open {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 4px !important;
        transform: translateX(-50%) !important;
    }
    
    /* 移动端触摸支持 */
    .gt_float_switcher .gt-selected,
    .gt_float_switcher .gt_options a {
        cursor: pointer !important;
        -webkit-tap-highlight-color: rgba(0,0,0,0) !important;
        touch-action: manipulation !important;
        user-select: none !important;
        -webkit-user-select: none !important;
    }
    
    /* 移动端语言选项 - 增大触摸区域 */
    .gt_float_switcher .gt_options a {
        padding: 10px 12px !important;
        min-height: 40px !important;
    }
    
    /* 移动端箭头 - 默认向下，打开时向上 */
    .gt_float_switcher .gt-selected .gt-current-lang span.gt_float_switcher-arrow {
        transform: rotate(0deg) !important;
    }
    
    .gt_float_switcher .gt-selected .gt-current-lang span.gt_float_switcher-arrow.gt_arrow_rotate {
        transform: rotate(180deg) !important;
    }
}
