/* 知识库管理后台 - 样式 */

:root {
    --primary-color: #409eff;
    --success-color: #67c23a;
    --warning-color: #e6a23c;
    --danger-color: #f56c6c;
    --info-color: #909399;
    --bg-color: #f5f7fa;
    --border-color: #dcdfe6;
    --header-height: 60px;
    --sidebar-width: 200px;
    --sidebar-width-collapsed: 60px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: #333;
    font-size: 14px;
    line-height: 1.6;
}

/* ============ 登录页面 ============ */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.login-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 400px;
    padding: 40px 30px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h2 {
    color: var(--primary-color);
    font-size: 24px;
}

/* ============ 主界面 ============ */
.main-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    background: #fff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    height: var(--header-height);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header h1 {
    font-size: 18px;
    color: #333;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    color: #666;
    font-size: 14px;
}

.content {
    display: flex;
    flex: 1;
    min-height: calc(100vh - var(--header-height));
}

/* ============ 侧边栏 ============ */
.sidebar {
    width: var(--sidebar-width);
    background: #fff;
    border-right: 1px solid var(--border-color);
    padding: 20px 0;
    flex-shrink: 0;
    transition: width 0.3s;
}

.sidebar-collapsed {
    width: var(--sidebar-width-collapsed);
}

.sidebar-collapsed .nav-text {
    display: none;
}

.nav-menu {
    display: flex;
    flex-direction: column;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #606266;
    text-decoration: none;
    transition: all 0.3s;
    cursor: pointer;
}

.nav-item:hover {
    background: #f5f7fa;
    color: var(--primary-color);
}

.nav-item.active {
    background: #ecf5ff;
    color: var(--primary-color);
    border-right: 3px solid var(--primary-color);
}

.nav-icon {
    font-size: 20px;
    margin-right: 10px;
    min-width: 24px;
    text-align: center;
}

.nav-text {
    font-size: 14px;
}

/* ============ 主内容区 ============ */
.main {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.page-header h2 {
    font-size: 20px;
    color: #333;
}

/* ============ Element Plus 组件样式 ============ */
.el-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 15px;
    font-size: 14px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: #fff;
    color: #606266;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
}

.el-button:hover {
    color: var(--primary-color);
    border-color: #c6e2ff;
}

.el-button--primary {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.el-button--primary:hover {
    opacity: 0.9;
}

.el-button--danger {
    background: var(--danger-color);
    color: #fff;
    border-color: var(--danger-color);
}

.el-button--small {
    padding: 5px 10px;
    font-size: 12px;
}

.el-button.is-active,
.el-button--primary.is-active {
    background: #66b1ff;
    border-color: #66b1ff;
}

.el-tag {
    display: inline-block;
    padding: 2px 10px;
    font-size: 12px;
    border-radius: 4px;
    border: 1px solid;
}

.el-tag--small {
    padding: 1px 8px;
    font-size: 12px;
}

.el-tag--success {
    background: #f0f9eb;
    color: #67c23a;
    border-color: #e1f3d8;
}

.el-tag--info {
    background: #f4f4f5;
    color: #909399;
    border-color: #e9e9eb;
}

.el-tag--success.el-tag--small,
.el-tag--info.el-tag--small {
    padding: 0 6px;
}

.el-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.3s;
}

.el-input:focus {
    border-color: var(--primary-color);
    outline: none;
}

.el-textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
}

.el-textarea:focus {
    border-color: var(--primary-color);
    outline: none;
}

/* ============ 表格样式 ============ */
.table-container {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

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

.data-table th,
.data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
}

.data-table th {
    background: #fafafa;
    font-weight: 600;
    color: #606266;
}

.data-table tbody tr:hover {
    background: #f5f7fa;
}

.empty-state {
    text-align: center;
    color: #909399;
    padding: 40px;
}

/* ============ 搜索样式 ============ */
.search-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.search-info {
    margin: 20px 0 15px;
    padding: 10px;
    background: #f5f7fa;
    border-radius: 4px;
    color: #606266;
    font-size: 14px;
}

.search-result {
    background: #fff;
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 8px;
    border: 1px solid #f0f0f0;
}

.search-result h4 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 16px;
    cursor: pointer;
}

.search-result h4:hover {
    text-decoration: underline;
}

.search-highlight {
    color: #606266;
    font-size: 14px;
    margin: 10px 0;
    line-height: 1.6;
    background: #fef9e7;
    padding: 10px;
    border-radius: 4px;
    border-left: 3px solid var(--warning-color);
}

/* ============ 上传样式 ============ */
.upload-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 60px 20px;
    text-align: center;
    color: #909399;
    transition: all 0.3s;
}

.upload-area:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.upload-hint {
    font-size: 12px;
    margin-top: 10px;
    color: #c0c4cc;
}

/* ============ 统计样式 ============ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.stat-card {
    background: #fff;
    border-radius: 8px;
    padding: 30px 20px;
    text-align: center;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.stat-value {
    font-size: 36px;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.stat-label {
    color: #606266;
    font-size: 14px;
}

/* ============ 分页样式 ============ */
.pagination-container {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 5px;
    flex-wrap: wrap;
}

/* ============ 对话框样式 ============ */
.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.dialog {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

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

.dialog-header h3 {
    font-size: 18px;
    color: #333;
}

.dialog-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #909399;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
}

.dialog-close:hover {
    color: #606266;
}

.dialog-body {
    padding: 20px;
}

.dialog-footer {
    padding: 20px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ============ 表单样式 ============ */
.form-item {
    margin-bottom: 15px;
}

.form-item label {
    display: block;
    margin-bottom: 5px;
    color: #606266;
    font-size: 14px;
}

.form-item input[type="text"],
.form-item input[type="password"],
.form-item select {
    width: 100%;
}

.form-item input[type="checkbox"] {
    margin-right: 5px;
}

.login-error {
    color: var(--danger-color);
    font-size: 14px;
    margin-top: 15px;
    text-align: center;
    padding: 10px;
    background: #fef0f0;
    border-radius: 4px;
}

/* ============ 加载状态 ============ */
[v-loading] {
    position: relative;
}

[v-loading]::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
}

[v-loading]::after {
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50"><circle cx="25" cy="25" r="20" fill="none" stroke="%23409eff" stroke-width="4"><animateTransform attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="1s" repeatCount="indefinite"/></circle></svg>') no-repeat center;
}

/* ============ 调试信息 ============ */
.dev-info {
    position: fixed;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 12px;
    font-family: monospace;
    z-index: 9999;
}

/* ============ 响应式设计 ============ */
@media (max-width: 768px) {
    .content {
        flex-direction: column;
    }

    .sidebar {
        width: 100% !important;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 10px 0;
    }

    .nav-item {
        padding: 10px 15px;
    }

    .nav-text {
        display: inline !important;
    }

    .main {
        padding: 15px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-header button {
        width: 100%;
    }

    .data-table {
        font-size: 12px;
    }

    .data-table th,
    .data-table td {
        padding: 8px 10px;
    }

    .dialog {
        max-width: 100%;
        margin: 10px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-value {
        font-size: 28px;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 0 10px;
    }

    .header h1 {
        font-size: 16px;
    }

    .user-info {
        display: none;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .dialog-body {
        padding: 15px;
    }

    .dialog-footer {
        flex-direction: column-reverse;
    }

    .dialog-footer button {
        width: 100%;
    }
}

/* ============ 批量导入样式 ============ */
.upload-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-btn {
    padding: 10px 20px;
    border: 1px solid #dcdfe6;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.tab-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.tab-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

.batch-import-card {
    background: #fff;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.batch-import-card h3 {
    margin: 0 0 10px 0;
    color: #303133;
}

.batch-import-card h4 {
    margin: 20px 0 10px 0;
    color: #606266;
    font-size: 14px;
}

.batch-desc {
    color: #909399;
    margin-bottom: 20px;
}

.template-section {
    background: #f5f7fa;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.template-buttons {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.selected-file {
    color: var(--primary-color);
    margin-top: 10px;
    font-weight: 500;
}

.import-result {
    margin-top: 20px;
    padding: 15px;
    border-radius: 4px;
}

.import-result.success {
    background: #f0f9eb;
    border: 1px solid #e1f3d8;
    color: #67c23a;
}

.import-result.error {
    background: #fef0f0;
    border: 1px solid #fde2e2;
    color: #f56c6c;
}

/* 产品库 */
.form-row {
    display: flex;
    gap: 12px;
}
.form-row .form-item {
    flex: 1;
}
.search-filter-bar {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.product-import-bar {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
    padding: 10px;
    background: #f5f7fa;
    border-radius: 4px;
}

.product-thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #ebeef5;
    cursor: pointer;
}
.product-thumb:hover {
    transform: scale(2);
    transition: transform 0.2s;
    z-index: 10;
    position: relative;
}
.image-uploader {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.image-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border: 1px dashed #dcdfe6;
    border-radius: 4px;
    background: #fafafa;
}
.image-preview-img {
    max-width: 200px;
    max-height: 120px;
    object-fit: contain;
    border-radius: 4px;
}

.product-result {
    background: #fdf6ec;
    border-left: 3px solid #e6a23c;
}
