/* ===================================================
   区域设置Locale工具 - 样式文件
   =================================================== */

/* ---------- 整体布局 ---------- */
.locale-container {
    width: 100%;
    box-sizing: border-box;
}

/* ---------- 搜索栏 ---------- */
.locale-search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.locale-search-input {
    flex: 1;
    min-width: 220px;
    padding: 10px 16px;
    border: 1.5px solid #dde3ec;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
    background: #fff;
    color: #333;
}

.locale-search-input:focus {
    border-color: #4f8ef7;
    box-shadow: 0 0 0 3px rgba(79, 142, 247, 0.12);
}

.locale-filter-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.locale-filter-btn {
    padding: 8px 16px;
    border: 1.5px solid #dde3ec;
    border-radius: 20px;
    background: #f7f9fb;
    color: #555;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s, transform 0.15s;
    white-space: nowrap;
}

.locale-filter-btn:hover {
    background: #e8f0fe;
    border-color: #4f8ef7;
    color: #4f8ef7;
    transform: scale(1.02);
}

.locale-filter-btn.active {
    background: #4f8ef7;
    border-color: #4f8ef7;
    color: #fff;
}

.filter-count {
    display: inline-block;
    margin-left: 3px;
    font-size: 11px;
    opacity: 0.75;
    font-weight: 400;
}

/* ---------- 统计栏 ---------- */
.locale-stats {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 14px;
    font-size: 13px;
    color: #888;
    flex-wrap: wrap;
}

.locale-stats-count {
    font-weight: 600;
    color: #4f8ef7;
}

/* ---------- 表格 ---------- */
.locale-table-wrap {
    width: 100%;
    overflow-x: auto;
    border-radius: 10px;
    box-shadow: 0 1px 8px rgba(0,0,0,0.07);
    margin-bottom: 20px;
}

.locale-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    background: #fff;
}

.locale-table thead tr {
    background: linear-gradient(90deg, #4f8ef7, #6fa8ff);
    color: #fff;
}

.locale-table thead th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: 0.3px;
}

.locale-table tbody tr {
    border-bottom: 1px solid #f0f3f8;
    transition: background 0.15s;
    cursor: pointer;
}

.locale-table tbody tr:nth-child(even) {
    background: #fafcff;
}

.locale-table tbody tr:hover {
    background: #f0f6ff;
}

.locale-table tbody tr:hover td:first-child {
    box-shadow: inset 3px 0 0 #4f8ef7;
}

.locale-table tbody tr.selected {
    background: #e8f3ff;
}

.locale-table tbody tr.selected td:first-child {
    box-shadow: inset 3px 0 0 #2265d8;
}

.locale-table tbody tr.keyboard-focus {
    outline: 2px solid #4f8ef7;
    outline-offset: -2px;
}

.locale-table tbody td {
    padding: 11px 16px;
    vertical-align: middle;
    transition: box-shadow 0.15s;
}

.locale-table tbody tr.hidden-row {
    display: none;
}

/* ---------- Locale代码标签 ---------- */
.locale-code-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 6px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    font-weight: 600;
    background: #eef3ff;
    color: #3a6fd8;
    border: 1px solid #c5d8ff;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.locale-code-badge:hover {
    background: #dce9ff;
    border-color: #4f8ef7;
    box-shadow: 0 1px 4px rgba(79, 142, 247, 0.15);
}

.locale-code-badge.copied {
    background: #e8f5e9;
    border-color: #4caf50;
    color: #2e7d32;
}

.locale-lang-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

/* 语言色系 */
.lang-en { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }
.lang-zh { background: #fff3e0; color: #e65100; border: 1px solid #ffcc80; }
.lang-fr { background: #fce4ec; color: #c62828; border: 1px solid #f48fb1; }
.lang-de { background: #e3f2fd; color: #1565c0; border: 1px solid #90caf9; }
.lang-ja { background: #f3e5f5; color: #6a1b9a; border: 1px solid #ce93d8; }
.lang-ko { background: #e0f7fa; color: #006064; border: 1px solid #80deea; }
.lang-ar { background: #fff8e1; color: #f57f17; border: 1px solid #ffe082; }
.lang-es { background: #fdf3e7; color: #bf360c; border: 1px solid #ffab91; }
.lang-pt { background: #e8f5e9; color: #1b5e20; border: 1px solid #a5d6a7; }
.lang-ru { background: #e8eaf6; color: #283593; border: 1px solid #9fa8da; }
.lang-it { background: #fce4ec; color: #ad1457; border: 1px solid #f48fb1; }
.lang-nl { background: #fffde7; color: #f57f17; border: 1px solid #fff176; }
.lang-el { background: #e3f2fd; color: #0d47a1; border: 1px solid #90caf9; }
.lang-tr { background: #fce4ec; color: #880e4f; border: 1px solid #f48fb1; }
.lang-pl { background: #e8eaf6; color: #4527a0; border: 1px solid #9fa8da; }
.lang-th { background: #f3e5f5; color: #4a148c; border: 1px solid #ce93d8; }
.lang-id { background: #e0f2f1; color: #004d40; border: 1px solid #80cbc4; }
.lang-ms { background: #e8f5e9; color: #33691e; border: 1px solid #aed581; }
.lang-vi { background: #ffebee; color: #b71c1c; border: 1px solid #ef9a9a; }
.lang-tl { background: #e3f2fd; color: #1a237e; border: 1px solid #90caf9; }
.lang-default { background: #f5f5f5; color: #555; border: 1px solid #e0e0e0; }

/* ---------- 复制按钮 ---------- */
.copy-btn {
    padding: 5px 12px;
    border: 1.5px solid #4f8ef7;
    border-radius: 6px;
    background: #fff;
    color: #4f8ef7;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s, transform 0.15s;
    white-space: nowrap;
}

.copy-btn:hover {
    background: #4f8ef7;
    color: #fff;
    transform: scale(1.02);
}

.copy-btn.copied {
    background: #4caf50;
    border-color: #4caf50;
    color: #fff;
}

/* ---------- 格式化预览面板 ---------- */
.locale-preview-panel {
    border: 1.5px solid #c5d8ff;
    border-left: 3px solid #4f8ef7;
    border-radius: 10px;
    padding: 20px 24px;
    background: linear-gradient(135deg, #f8faff 0%, #eef5ff 100%);
    margin-bottom: 20px;
    box-shadow: 0 2px 14px rgba(79, 142, 247, 0.08);
    display: none;
}

@keyframes locale-panel-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.locale-preview-panel.visible {
    display: block;
    animation: locale-panel-in 0.28s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.locale-preview-title {
    font-size: 15px;
    font-weight: 700;
    color: #333;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.locale-preview-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.locale-preview-item {
    background: #fff;
    border: 1px solid #e8edf5;
    border-radius: 8px;
    padding: 12px 14px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.locale-preview-item:hover {
    background: #f0f6ff;
    border-color: #b3d0ff;
    transform: scale(1.02);
}

.locale-preview-item.just-copied {
    border-color: #4caf50;
    background: #f1fff4;
}

.locale-preview-item::after {
    content: '点击复制';
    position: absolute;
    top: 5px;
    right: 8px;
    font-size: 10px;
    color: #bbb;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

.locale-preview-item:hover::after {
    opacity: 1;
}

.locale-preview-item-label {
    font-size: 11px;
    color: #999;
    letter-spacing: 0.3px;
    margin-bottom: 4px;
    font-weight: 500;
}

.locale-preview-item-value {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    font-family: 'Consolas', 'Monaco', monospace;
}

/* ---------- AI推荐区 ---------- */
.ai-section {
    border: 1.5px solid #e3d5f8;
    border-left: 3px solid #9c6fe0;
    border-radius: 10px;
    padding: 20px 24px;
    background: linear-gradient(135deg, #fafbff 0%, #f7f2ff 100%);
    margin-top: 20px;
    box-shadow: 0 2px 12px rgba(156, 111, 224, 0.07);
}

.ai-section-title {
    font-size: 15px;
    font-weight: 700;
    color: #333;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-input-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.ai-prompt-input {
    flex: 1;
    min-width: 220px;
    padding: 10px 14px;
    border: 1.5px solid #dde3ec;
    border-radius: 8px;
    font-size: 14px;
    resize: vertical;
    min-height: 60px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
    background: #fff;
}

.ai-prompt-input:focus {
    border-color: #4f8ef7;
    box-shadow: 0 0 0 3px rgba(79, 142, 247, 0.12);
}

.ai-recommend-btn {
    padding: 10px 22px;
    background: linear-gradient(135deg, #4f8ef7, #6fa8ff);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s, transform 0.15s;
    white-space: nowrap;
}

.ai-recommend-btn:hover {
    background: linear-gradient(135deg, #3a7de5, #5a9aff);
    transform: scale(1.02);
}

.ai-recommend-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.ai-result-area {
    margin-top: 16px;
    display: none;
}

@keyframes ai-result-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.ai-result-area.visible {
    display: block;
    animation: ai-result-in 0.3s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.ai-result-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: #fff;
    border: 1px solid #e8edf5;
    border-radius: 8px;
    transition: background 0.15s;
}

.ai-result-item:hover {
    background: #f0f6ff;
}

.ai-result-code {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    font-weight: 700;
    color: #3a6fd8;
    min-width: 70px;
}

.ai-result-name {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    min-width: 100px;
}

.ai-result-reason {
    flex: 1;
    font-size: 12px;
    color: #777;
}

.ai-result-copy-btn {
    padding: 4px 10px;
    border: 1.5px solid #4f8ef7;
    border-radius: 6px;
    background: #fff;
    color: #4f8ef7;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s, transform 0.15s;
    white-space: nowrap;
}

.ai-result-copy-btn:hover {
    background: #4f8ef7;
    color: #fff;
    transform: scale(1.02);
}

.ai-summary-box {
    margin-top: 10px;
    padding: 10px 14px;
    background: #eef3ff;
    border-radius: 8px;
    font-size: 13px;
    color: #3a6fd8;
    border-left: 3px solid #4f8ef7;
}

/* ---------- 空状态 ---------- */
.locale-empty-state {
    text-align: center;
    padding: 40px 0;
    color: #aaa;
    font-size: 14px;
    display: none;
}

.locale-empty-state.visible {
    display: block;
}

/* ---------- 加载动画 ---------- */
.ai-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px;
    color: #888;
    font-size: 13px;
}

.ai-loading-dots {
    display: flex;
    gap: 4px;
}

.ai-loading-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #4f8ef7;
    animation: dot-bounce 1.4s infinite ease-in-out;
}

.ai-loading-dot:nth-child(2) { animation-delay: 0.2s; }
.ai-loading-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes dot-bounce {
    0%, 80%, 100% { transform: scale(0.7); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* ---------- 搜索框清空按钮 ---------- */
.locale-search-wrap {
    flex: 1;
    min-width: 220px;
    position: relative;
    display: flex;
    align-items: center;
}

.locale-search-wrap .locale-search-input {
    width: 100%;
    padding-right: 34px;
    min-width: unset;
    flex: unset;
}

.search-clear-btn {
    position: absolute;
    right: 8px;
    border: none;
    background: none;
    color: #ccc;
    cursor: pointer;
    font-size: 16px;
    padding: 2px;
    line-height: 1;
    transition: color 0.2s, transform 0.15s;
    display: none;
}

.search-clear-btn.visible {
    display: block;
}

.search-clear-btn:hover {
    color: #f44336;
    transform: scale(1.02);
}

/* ---------- 统计栏扩展 ---------- */
.locale-hint {
    color: #aaa;
    font-size: 12px;
    margin-left: auto;
}

.batch-copy-btn {
    padding: 3px 12px;
    border: 1.5px solid #4f8ef7;
    border-radius: 16px;
    background: #eef3ff;
    color: #4f8ef7;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s, transform 0.15s;
    white-space: nowrap;
}

.batch-copy-btn:hover {
    background: #4f8ef7;
    color: #fff;
    transform: scale(1.02);
}

.batch-copy-btn.copied {
    background: #4caf50;
    border-color: #4caf50;
    color: #fff;
}

/* ---------- 表头排序 ---------- */
.locale-table thead th.sortable {
    cursor: pointer;
    user-select: none;
}

.locale-table thead th.sortable:hover {
    background: rgba(255,255,255,0.18);
}

.sort-icon {
    margin-left: 4px;
    font-size: 11px;
    opacity: 0.8;
}

/* ---------- 预览面板扩展 ---------- */
.preview-code-label {
    font-family: 'Consolas', 'Monaco', monospace;
    color: #4f8ef7;
    font-size: 15px;
}

.preview-name-label {
    font-size: 13px;
    color: #888;
    margin-left: 2px;
}

.preview-close-btn {
    margin-left: auto;
    padding: 3px 10px;
    border: 1px solid #dde3ec;
    border-radius: 6px;
    background: #fff;
    color: #999;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s, transform 0.15s;
}

.preview-close-btn:hover {
    border-color: #f44336;
    color: #f44336;
    transform: scale(1.02);
}

.preview-copy-code-btn {
    padding: 3px 10px;
    border: 1.5px solid #4f8ef7;
    border-radius: 6px;
    background: #fff;
    color: #4f8ef7;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s, transform 0.15s;
    white-space: nowrap;
}

.preview-copy-code-btn:hover {
    background: #4f8ef7;
    color: #fff;
    transform: scale(1.02);
}

.preview-copy-code-btn.copied {
    background: #4caf50;
    border-color: #4caf50;
    color: #fff;
}

/* ---------- 空状态图标 ---------- */
.empty-state-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

/* ---------- AI区描述文字 ---------- */
.ai-section-desc {
    font-size: 13px;
    color: #888;
    margin-bottom: 10px;
}

/* ---------- AI空结果 ---------- */
.ai-no-result {
    color: #aaa;
    font-size: 13px;
    padding: 10px;
    text-align: center;
}

/* ---------- 搜索关键词高亮 ---------- */
.kw-highlight {
    background: #fff3cd;
    color: #856404;
    border-radius: 2px;
    padding: 0 1px;
}

/* cursor:pointer 已在 tbody tr 基础规则设置，locale-code-badge 定义已合并到代码标签区 */

/* ---------- Toast（CSS类化） ---------- */
#localeToastContainer {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
    pointer-events: none;
}

.locale-toast {
    padding: 10px 16px;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 300px;
    pointer-events: all;
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.locale-toast.toast-enter {
    opacity: 1;
    transform: translateX(0);
}

.locale-toast.toast-leave {
    opacity: 0;
    transform: translateX(40px);
}

.locale-toast-success { background: #4caf50; }
.locale-toast-warning { background: #ff9800; }
.locale-toast-error   { background: #f44336; }

/* ---------- fallback复制临时区域 ---------- */
.locale-tmp-copy {
    position: fixed;
    top: -9999px;
    left: -9999px;
    opacity: 0;
    pointer-events: none;
}

/* ---------- 紧凑化 ---------- */
.locale-search-bar     { margin-bottom: 8px; }
.locale-stats          { margin-bottom: 8px; gap: 10px; }
.locale-preview-panel  { padding: 12px 16px; margin-bottom: 12px; }
.locale-preview-title  { margin-bottom: 8px; }
.locale-preview-grid   { gap: 8px; }
.locale-preview-item   { padding: 8px 12px; }
.ai-section            { padding: 14px 18px; margin-top: 12px; }
.ai-section-title      { margin-bottom: 6px; }
.locale-table tbody td { padding: 8px 12px; }
.locale-table thead th { padding: 9px 12px; }
.locale-table-wrap     { margin-bottom: 12px; }

/* ---------- 响应式 ---------- */
@media (max-width: 1024px) {
    .locale-preview-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .locale-search-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .locale-search-input {
        width: 100%;
    }

    .locale-table thead th:nth-child(4),
    .locale-table tbody td:nth-child(4) {
        display: none;
    }

    .locale-preview-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .locale-filter-group {
        width: 100%;
    }

    .locale-filter-btn {
        flex: 1;
        text-align: center;
    }

    .locale-table thead th:nth-child(3),
    .locale-table tbody td:nth-child(3) {
        display: none;
    }

    .locale-preview-grid {
        grid-template-columns: 1fr;
    }

    .ai-input-row {
        flex-direction: column;
    }

    .ai-recommend-btn {
        width: 100%;
    }
}
