/* ========== 基础样式 - 全局重置和通用样式 ========== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f0f2f5;
    min-height: 100vh;
    padding: 20px;
}

.container {
    /* max-width: 1200px; */
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

/* ========== 头部样式 ========== */
.header {
    background: linear-gradient(135deg, var(--business-color, #5B7FFF) 0%, var(--business-color-dark, #4A6FE5) 100%);
    color: white;
    padding: 32px;
    text-align: center;
    border-radius: 16px 16px 0 0;
}

.header h1 {
    font-size: 26px;
    margin-bottom: 8px;
    font-weight: 600;
}

.header p {
    opacity: 0.9;
    font-size: 14px;
}

/* ========== 按钮样式 ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    padding: 0 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--business-color, #5B7FFF);
    color: white;
}

.btn-primary:hover {
    background: var(--business-color-dark, #4A6FE5);
    filter: brightness(0.9);
}

.btn-danger {
    background: #ea4335;
    color: white;
}

.btn-danger:hover {
    background: #c5221f;
}

.btn-success {
    background: #34a853;
    color: white;
}

.btn-success:hover {
    background: #2d8e47;
}

.btn-secondary {
    background: #5f6368;
    color: white;
}

.btn-secondary:hover {
    background: #4a4d51;
}

/* 启用按钮 - 使用绿色 */
.btn-enable {
    background: #10B981;
    color: white;
}

.btn-enable:hover {
    background: #059669;
}

/* 禁用按钮 - 使用橙色 */
.btn-disable {
    background: #F59E0B;
    color: white;
}

.btn-disable:hover {
    background: #D97706;
}

/* 信息按钮 - 使用蓝色 */
.btn-info {
    background: #3B82F6;
    color: white;
}

.btn-info:hover {
    background: #2563EB;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-sm {
    height: 30px;
    padding: 0 12px;
    font-size: 13px;
    border-radius: 5px;
}

.btn-copy {
    background: rgba(91, 127, 255, 0.1);
    color: var(--business-color, #5B7FFF);
    border: 1px solid transparent;
}

.btn-copy:hover {
    background: #d2e3fc;
    box-shadow: none;
    transform: none;
}

.btn-delete {
    background: #fce8e6;
    color: #ea4335;
    border: 1px solid transparent;
}

.btn-delete:hover {
    background: #f8d7d4;
    box-shadow: none;
    transform: none;
}

/* ========== 表单元素 ========== */
.checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--business-color, #5B7FFF);
}

/* ========== 工具栏 ========== */
.toolbar {
    padding: 20px;
    background: #fafbfc;
    /* border-bottom: 1px solid #e8eaed; */
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.filter-group label {
    font-size: 13px;
    color: #5f6368;
    font-weight: 500;
    margin-right: 4px;
}

.chip-group {
    display: flex;
    gap: 6px;
}

.chip {
    padding: 8px 16px;
    border: 1px solid #dadce0;
    border-radius: 6px;
    font-size: 13px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    color: #5f6368;
}

.chip:hover {
    background: #f1f3f4;
    border-color: #c4c7c9;
}

.chip.active {
    background: rgba(91, 127, 255, 0.1);
    border-color: var(--business-color, #5B7FFF);
    color: var(--business-color, #5B7FFF);
}

.action-buttons {
    display: flex;
    gap: 10px;
    margin-left: auto;
}

/* ========== 统计栏 ========== */
.stats {
    padding: 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e8eaed;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stats-info {
    font-size: 14px;
    color: #5f6368;
}

.stats-info strong {
    font-size: 16px;
    margin: 0 4px;
    color: var(--business-color, #5B7FFF);
}

/* ========== 表格样式 ========== */
.table-container {
    padding: 24px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: #fafbfc;
    position: sticky;
    top: 0;
    z-index: 10;
}

th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    color: #5f6368;
    border-bottom: 1px solid #e8eaed;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    padding: 14px 16px;
    border-bottom: 1px solid #f1f3f4;
    font-size: 14px;
    color: #3c4043;
}

tbody tr {
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
}

/* 斑马纹：偶数行浅灰底色 */
tbody tr:nth-child(even) {
    background-color: #f9fafb;
}

/* 悬停效果：左边框高亮 + 背景变色 */
tbody tr:hover {
    background: #e8f0fe;
    border-left-color: var(--business-color, #5B7FFF);
}

.keyword-text {
    color: #202124;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.15s ease;
}

.keyword-text:hover {
    color: var(--business-color, #5B7FFF);
}

.actions {
    display: flex;
    gap: 8px;
}

/* ========== 徽章样式 ========== */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.badge-primary {
    background: rgba(91, 127, 255, 0.1);
    color: var(--business-color, #5B7FFF);
}

.badge-success {
    background: #e6f4ea;
    color: #1e8e3e;
}

/* ========== 空状态 ========== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #5f6368;
}

.empty-state svg {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    opacity: 0.4;
}

/* ========== 加载状态 ========== */
.loading {
    text-align: center;
    padding: 40px;
    color: #5f6368;
}

.spinner {
    border: 3px solid #f1f3f4;
    border-top: 3px solid var(--business-color, #5B7FFF);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========== Toast 提示 ========== */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 14px 20px;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.16);
    z-index: 3100;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-success {
    background: #34a853;
}

.toast-error {
    background: #ea4335;
}

.toast-info {
    background: var(--business-color, #5B7FFF);
}

.toast-warning {
    background: #f9ab00;
}

/* ========== 确认对话框 ========== */
.confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.confirm-dialog {
    background: white;
    border-radius: 12px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    animation: scaleIn 0.2s ease;
}

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

.confirm-dialog h3 {
    margin: 0 0 12px 0;
    font-size: 18px;
    color: #202124;
}

.confirm-dialog p {
    margin: 0 0 20px 0;
    font-size: 14px;
    color: #5f6368;
    line-height: 1.5;
}

.confirm-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.confirm-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.confirm-btn-cancel {
    background: #f1f3f4;
    color: #5f6368;
}

.confirm-btn-cancel:hover {
    background: #e8eaed;
}

.confirm-btn-confirm {
    background: var(--business-color, #5B7FFF);
    color: white;
}

.confirm-btn-confirm:hover {
    background: var(--business-color, #5B7FFF);
    filter: brightness(0.9);
}

.confirm-btn-danger {
    background: #ea4335;
    color: white;
}

.confirm-btn-danger:hover {
    background: #c5221f;
}

/* ========== 添加表单 ========== */
.add-form {
    padding: 20px 30px;
    background: #fafbfc;
    border-bottom: 1px solid #e8eaed;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.add-form input,
.add-form textarea {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #dadce0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.add-form textarea {
    min-height: 80px;
    resize: vertical;
    line-height: 1.5;
}

.add-form input:focus,
.add-form textarea:focus {
    outline: none;
    border-color: var(--business-color, #5B7FFF);
    box-shadow: 0 0 0 3px rgba(91, 127, 255, 0.1);
}

/* ========== 导航标签 ========== */
.nav-tabs {
    display: flex;
    /* background: #f8f9fa;
    border-bottom: 1px solid #e8eaed; */
}

.nav-tab {
    padding: 16px 32px;
    border: none;
    background: transparent;
    font-size: 15px;
    font-weight: 500;
    color: #5f6368;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
    text-decoration: none;
}

.nav-tab:hover {
    background: #f1f3f4;
    color: var(--business-color, #5B7FFF);
    text-decoration: none;
}

.nav-tab.active {
    color: var(--business-color, #5B7FFF);
    border-bottom-color: var(--business-color, #5B7FFF);
    background: white;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ========== 通用页面布局 ========== */
.prompt-generator {
    padding: 30px;
}

.prompt-input-section {
    margin-bottom: 24px;
}

.prompt-input-section label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #3c4043;
    margin-bottom: 8px;
}

.prompt-result {
    margin-top: 24px;
}

.prompt-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.prompt-result-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #3c4043;
}

/* ========== 复制按钮 ========== */
.copy-all-btn {
    padding: 8px 16px;
    background: var(--business-color, #5B7FFF);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.copy-all-btn:hover {
    background: var(--business-color, #5B7FFF);
    filter: brightness(0.9);
}

.copy-all-btn:disabled {
    background: #dadce0;
    cursor: not-allowed;
}

/* ========== 开关样式 ========== */
.delete-switch {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.delete-switch input {
    display: none;
}

.switch-slider {
    position: relative;
    width: 40px;
    height: 22px;
    background: #dadce0;
    border-radius: 11px;
    transition: background 0.2s ease;
}

.switch-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.delete-switch input:checked + .switch-slider {
    background: #ea4335;
}

.delete-switch input:checked + .switch-slider::after {
    transform: translateX(18px);
}

.switch-label {
    font-size: 13px;
    color: #5f6368;
}

/* ========== 通用开关样式 ========== */
.switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #dadce0;
    transition: 0.3s;
    border-radius: 20px;
}

.switch .slider::before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.switch input:checked + .slider {
    background-color: #34a853;
}

.switch input:checked + .slider::before {
    transform: translateX(16px);
}

.switch input:disabled + .slider {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========== 浮动导航按钮 ========== */
.float-nav {
    position: fixed;
    right: 24px;
    bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1000;
}

.float-nav-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: var(--business-color, #5B7FFF);
    color: white;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.float-nav-btn:hover {
    background: var(--business-color, #5B7FFF);
    filter: brightness(0.9);
    transform: scale(1.1);
}

.float-nav-btn:active {
    transform: scale(0.95);
}

/* ========== 响应式设计 ========== */
@media (max-width: 768px) {
    .toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }

    .filter-group {
        width: 100%;
        flex-wrap: wrap;
    }

    .action-buttons {
        margin-left: 0;
        flex-wrap: wrap;
    }

    .stats {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .table-container {
        padding: 16px;
    }

    table {
        font-size: 12px;
    }

    th, td {
        padding: 10px;
    }
}

/* ========== 表格框选样式 ========== */
.table-selection-box {
    position: fixed;
    border: 2px dashed var(--business-color, #5B7FFF);
    background: rgba(91, 127, 255, 0.1);
    pointer-events: none;
    z-index: 1000;
}

/* 表格容器禁止选中文字（框选时） */
.keywords-table-container,
.articles-table-container {
    user-select: none;
}

/* 选中行高亮（覆盖斑马纹） */
table tbody tr.selected,
table tbody tr.selected:nth-child(even) {
    background-color: rgba(91, 127, 255, 0.1);
    border-left-color: var(--business-color, #5B7FFF);
}

table tbody tr.selected:hover,
table tbody tr.selected:nth-child(even):hover {
    background-color: rgba(91, 127, 255, 0.18);
    border-left-color: var(--business-color, #5B7FFF);
}
