/* --- 触发按钮样式 (保持在右侧) --- */
.transposh-floating-container {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 9998;
}

.transposh-floating-button {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #333;
    color: white;
    font-size: 24px;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, background-color 0.3s;
    outline: none;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.transposh-floating-button:hover {
    background-color: #0073aa; /* WordPress Blue or custom color */
    transform: translateY(-50%) scale(1.1); /* 保持垂直居中并放大 */
}

/* --- 全屏遮罩层 (Overlay) --- */
.transposh-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6); /* 半透明黑色背景 */
    z-index: 99999; /* 确保在最顶层 */
    display: none; /* JS控制显示 */
    justify-content: center; /* 水平居中 */
    align-items: center; /* 垂直居中 */
    backdrop-filter: blur(2px); /* 背景模糊效果 */
}

/* --- 弹窗主体 (Modal Content) --- */
.transposh-modal-content {
    background-color: #fff;
    width: 90%;
    max-width: 800px; /* 限制最大宽度，形成长方形 */
    max-height: 85vh; /* 防止太高超出屏幕 */
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    position: relative; /* 用于定位关闭按钮 */
    padding: 30px;
    overflow-y: auto; /* 内容过多时显示滚动条 */
    box-sizing: border-box;
    animation: tpFadeIn 0.3s ease-out;
}

@keyframes tpFadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* --- 关闭按钮 (Close Button) --- */
.transposh-modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.transposh-modal-close:hover {
    color: #000;
}

.transposh-modal-title {
    margin-top: 0;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.5rem;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

/* --- 密集排列的按钮网格 (Grid) --- */
.transposh-grid-container {
    display: grid;
    /* 自动填充列，每列最小宽度110px，实现密集排列 */
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); 
    gap: 12px;
}

/* --- 单个语言按钮样式 --- */
.transposh-lang-btn {
    display: flex;
    flex-direction: column; /* 图标在上，文字在下 */
    align-items: center;
    justify-content: center;
    background-color: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 10px 5px;
    text-decoration: none !important;
    color: #444 !important;
    transition: all 0.2s ease;
    cursor: pointer;
}

.transposh-lang-btn:hover {
    background-color: #fff;
    border-color: #0073aa;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

/* 当前激活的语言 */
.transposh-lang-btn.transposh-active-lang {
    background-color: #0073aa;
    color: white !important;
    border-color: #0073aa;
}

.transposh-lang-btn img {
    margin-bottom: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    width: 24px; /* 确保旗帜大小一致 */
    height: auto;
    display: block;
}

.tp-lang-name {
    font-size: 13px;
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

/* 滚动条美化 */
.transposh-modal-content::-webkit-scrollbar {
    width: 8px;
}
.transposh-modal-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}
.transposh-modal-content::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}
.transposh-modal-content::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}