/* ========== 分类管理样式 ========== */

/* 容器 */
.categories-container {
    padding: 24px;
}

/* 工具栏 */
.categories-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 16px 20px;
    background: #f8f9fa;
    border-radius: 12px;
    gap: 16px;
}

.categories-toolbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.categories-toolbar h3 {
    font-size: 16px;
    color: #202124;
    margin: 0;
}

.categories-count {
    background: rgba(91, 127, 255, 0.1);
    color: var(--business-color, #5B7FFF);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
}

.categories-toolbar-right {
    display: flex;
    gap: 8px;
}

/* 表格容器 */
.categories-table-container {
    border: 1px solid #e8eaed;
    border-radius: 12px;
    overflow: hidden;
    user-select: none;  /* 防止框选时选中文字 */
}

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

.categories-table thead {
    background: #f8f9fa;
}

.categories-table th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    color: #5f6368;
    border-bottom: 1px solid #e8eaed;
    font-size: 13px;
}

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

/* 表格列宽 */
.categories-table .col-id {
    width: 120px;
}

.categories-table .col-name {
    width: 140px;
}

.categories-table .col-media-id {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.categories-table .col-folder-id {
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.categories-table .col-count {
    width: 70px;
    text-align: center;
}

.categories-table .col-enabled {
    width: 70px;
    text-align: center;
}

.categories-table .col-actions {
    width: 140px;
}

/* 复选框列 */
.categories-table .col-checkbox {
    width: 40px;
    text-align: center;
}

.categories-table .checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--business-color, #5B7FFF);
}

/* 斑马条纹 */
.categories-table tbody tr:nth-child(odd) {
    background: #fafbfc;
}

.categories-table tbody tr:nth-child(even) {
    background: #ffffff;
}

.categories-table tbody tr:hover {
    background: #f0f4f8;
}

/* 选中行高亮 */
.categories-table tbody tr.selected {
    background: rgba(91, 127, 255, 0.08) !important;
}

.categories-table tbody tr.selected:hover {
    background: rgba(91, 127, 255, 0.12) !important;
}

/* 有数据的单元格高亮 */
.cell-has-data {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 500;
}

/* 媒体类型标签 */
.media-type-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.media-type-badge.media {
    background: #e3f2fd;
    color: #1565c0;
}

.media-type-badge.self-media {
    background: #fff3e0;
    color: #e65100;
}

/* 开关样式 */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

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

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

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

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--business-color, #5B7FFF);
}

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

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

/* 使用状态标签 */
.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

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

.status-badge.unused {
    background: #fce8e6;
    color: #d93025;
}

/* 空状态 */
.categories-empty {
    text-align: center;
    padding: 60px 20px;
    color: #9aa0a6;
    font-size: 14px;
}

/* ========== 新增/编辑分类弹窗 ========== */
.category-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 3000;
    justify-content: center;
    align-items: center;
}

.category-modal.active {
    display: flex;
}

.category-modal-content {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.2);
}

.category-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e8eaed;
}

.category-modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #202124;
}

.category-modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: #f1f3f4;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    color: #5f6368;
}

.category-modal-close:hover {
    background: #e8eaed;
}

.category-modal-body {
    padding: 24px;
}

.category-form-group {
    margin-bottom: 16px;
}

.category-form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #202124;
    margin-bottom: 8px;
}

.category-form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #dadce0;
    border-radius: 8px;
    font-size: 14px;
    box-sizing: border-box;
}

.category-form-input:focus {
    outline: none;
    border-color: var(--business-color, #5B7FFF);
}

.category-form-input:disabled {
    background: #f8f9fa;
    color: #5f6368;
}

.category-form-hint {
    font-size: 12px;
    color: #9aa0a6;
    margin-top: 4px;
}

/* 媒体类型点选按钮 */
.media-type-buttons {
    display: flex;
    gap: 12px;
}

.media-type-btn {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid #dadce0;
    border-radius: 8px;
    background: #fff;
    font-size: 14px;
    color: #5f6368;
    cursor: pointer;
    transition: all 0.2s;
}

.media-type-btn:hover {
    border-color: var(--business-color, #5B7FFF);
    color: var(--business-color, #5B7FFF);
}

.media-type-btn.active {
    background: rgba(91, 127, 255, 0.1);
    border-color: var(--business-color, #5B7FFF);
    color: var(--business-color, #5B7FFF);
    font-weight: 500;
}

.category-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e8eaed;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ========== 同步弹窗样式 ========== */
.sync-desc {
    color: #5f6368;
    font-size: 14px;
    margin-bottom: 12px;
}

.sync-warning {
    color: #ea8600;
    font-size: 13px;
    margin-bottom: 16px;
    padding: 10px 12px;
    background: #fef7e0;
    border-radius: 6px;
}

.sync-target-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sync-target-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
}

.sync-target-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.sync-target-name {
    font-size: 14px;
    font-weight: 500;
    color: #202124;
}

.sync-target-desc {
    font-size: 12px;
    color: #5f6368;
    margin-left: auto;
}

/* ========== 文章策略选择按钮 ========== */
.article-style-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.article-style-btn {
    padding: 8px 14px;
    border: 1px solid #dadce0;
    border-radius: 8px;
    background: #fff;
    font-size: 13px;
    color: #5f6368;
    cursor: pointer;
    transition: all 0.2s;
}

.article-style-btn:hover {
    border-color: var(--business-color, #5B7FFF);
    color: var(--business-color, #5B7FFF);
}

.article-style-btn.active {
    background: rgba(91, 127, 255, 0.1);
    border-color: var(--business-color, #5B7FFF);
    color: var(--business-color, #5B7FFF);
    font-weight: 500;
}

/* 文章策略标签 */
.article-style-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.article-style-badge.ranking {
    background: #e8f5e9;
    color: #2e7d32;
}

.article-style-badge.inventory {
    background: #e3f2fd;
    color: #1565c0;
}

.article-style-badge.random {
    background: #fff3e0;
    color: #e65100;
}

.article-style-badge.global {
    background: #f5f5f5;
    color: #9e9e9e;
}

/* 表格文章策略列宽 */
.categories-table .col-article-style {
    width: 120px;
    text-align: center;
}

/* 可点击的文章策略标签 */
.article-style-badge.clickable {
    cursor: pointer;
    transition: all 0.2s;
}

.article-style-badge.clickable:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* 文章策略快捷选择弹出层 */
.article-style-picker {
    position: fixed;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 6px;
    z-index: 3100;
    display: none;
    min-width: 120px;
}

.article-style-picker.active {
    display: block;
}

.picker-option {
    padding: 10px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: #5f6368;
    transition: all 0.15s;
}

.picker-option:hover {
    background: #f5f5f5;
    color: #202124;
}

.picker-option.active {
    background: rgba(91, 127, 255, 0.1);
    color: var(--business-color, #5B7FFF);
    font-weight: 500;
}

/* 价格列 */
.categories-table .col-price {
    width: 90px;
    text-align: center;
}

.price-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    background: #fef3c7;
    color: #b45309;
}
