/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background-color: #f5f5f5;
    color: #333;
}

/* 导航栏 */
.main-nav {
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-title {
    font-size: 20px;
    color: #1890ff;
}

.nav-links {
    display: flex;
    gap: 10px;
}

.nav-btn {
    padding: 8px 16px;
    border: 1px solid #d9d9d9;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
}

.nav-btn:hover {
    border-color: #1890ff;
    color: #1890ff;
}

.nav-btn.active {
    background: #1890ff;
    color: #fff;
    border-color: #1890ff;
}

/* 页面容器 */
.page {
    display: none;
    max-width: 1400px;
    margin: 20px auto;
    padding: 0 20px;
}

.page.active {
    display: block;
}

/* ========== 页面一：前台对话窗口 ========== */
.chat-container {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    max-width: 800px;
    margin: 0 auto;
    height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
}

.chat-header {
    padding: 15px 20px;
    border-bottom: 1px solid #e8e8e8;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h2 {
    font-size: 18px;
    font-weight: 500;
}

.transfer-btn {
    color: #ff4d4f;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 5px 10px;
}

.transfer-btn:hover {
    text-decoration: underline;
}

.transfer-banner {
    background: #fff7e6;
    border-left: 4px solid #faad14;
    padding: 12px 20px;
    color: #ad6800;
    font-size: 14px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #fafafa;
}

.message {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
}

.message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 12px;
    word-wrap: break-word;
    position: relative;
}

.bot-message .message-content {
    background: #1890ff;
    color: #fff;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.user-message .message-content {
    background: #e6f7ff;
    color: #333;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.message-feedback {
    display: flex;
    gap: 10px;
    margin-top: 8px;
    align-self: flex-start;
}

.feedback-btn {
    background: none;
    border: 1px solid #d9d9d9;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
}

.feedback-btn:hover {
    border-color: #1890ff;
    color: #1890ff;
}

.feedback-btn.active {
    background: #ff4d4f;
    border-color: #ff4d4f;
    color: #fff;
}

.quick-questions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

.quick-btn {
    padding: 8px 16px;
    background: #fff;
    border: 1px solid #d9d9d9;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.quick-btn:hover {
    border-color: #1890ff;
    color: #1890ff;
}

.chat-input-area {
    padding: 15px 20px;
    border-top: 1px solid #e8e8e8;
    display: flex;
    gap: 10px;
    background: #fff;
}

.chat-input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 14px;
}

.chat-input:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
}

.send-btn {
    padding: 10px 24px;
    background: #1890ff;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.send-btn:hover {
    background: #40a9ff;
}

.send-btn:disabled {
    background: #d9d9d9;
    cursor: not-allowed;
}

/* 订单卡片样式 */
.order-card {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    padding: 15px;
    margin-top: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    max-width: 100%;
}

.order-card-header {
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.order-number {
    font-size: 14px;
    font-weight: 500;
    color: #1890ff;
}

.order-card-body {
    display: flex;
    align-items: center;
    gap: 12px;
}

.order-product-image {
    width: 60px;
    height: 60px;
    background: #f5f5f5;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    flex-shrink: 0;
}

.order-product-info {
    flex: 1;
}

.order-product-name {
    font-size: 14px;
    color: #333;
    margin-bottom: 6px;
}

.order-product-price {
    font-size: 16px;
    font-weight: 600;
    color: #ff4d4f;
}

/* 确认按钮样式 */
.confirm-buttons {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    align-self: flex-start;
}

.confirm-btn {
    padding: 8px 20px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    background: #fff;
}

.confirm-btn.yes-btn {
    background: #1890ff;
    color: #fff;
    border-color: #1890ff;
}

.confirm-btn.yes-btn:hover {
    background: #40a9ff;
    border-color: #40a9ff;
}

.confirm-btn.no-btn:hover {
    border-color: #1890ff;
    color: #1890ff;
}

/* 物流卡片样式 */
.logistics-card {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    padding: 15px;
    margin-top: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    max-width: 100%;
}

.logistics-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.logistics-status-badge {
    display: inline-block;
    padding: 4px 12px;
    background: #f6ffed;
    color: #52c41a;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
}

.logistics-order-no {
    font-size: 13px;
    color: #666;
}

.logistics-detail {
    font-size: 14px;
    color: #333;
    line-height: 1.6;
}

/* ========== 页面二：管理后台 ========== */
.admin-container {
    display: flex;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    min-height: calc(100vh - 120px);
}

.admin-sidebar {
    width: 240px;
    background: #001529;
    color: #fff;
    padding: 20px 0;
}

.sidebar-menu {
    padding: 0 10px;
}

.menu-item {
    padding: 12px 15px;
    cursor: pointer;
    border-radius: 4px;
    margin-bottom: 5px;
    transition: background 0.3s;
}

.menu-item:hover {
    background: rgba(255,255,255,0.1);
}

.menu-item.active {
    background: #1890ff;
}

.submenu {
    margin-top: 10px;
    margin-left: 20px;
}

.submenu-item {
    padding: 8px 15px;
    font-size: 14px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s;
}

.submenu-item:hover {
    background: rgba(255,255,255,0.1);
}

.submenu-item.active {
    background: rgba(255,255,255,0.2);
    color: #1890ff;
}

.admin-main {
    flex: 1;
    padding: 20px;
    background: #f0f2f5;
}

.admin-toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.toolbar-btn {
    padding: 8px 16px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    background: #fff;
    transition: all 0.3s;
}

.toolbar-btn.primary {
    background: #1890ff;
    color: #fff;
    border-color: #1890ff;
}

.toolbar-btn.primary:hover {
    background: #40a9ff;
}

.toolbar-btn:hover {
    border-color: #1890ff;
    color: #1890ff;
}

.search-input {
    flex: 1;
    padding: 8px 15px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 14px;
}

.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.dashboard-card {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.card-label {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
}

.card-value {
    font-size: 32px;
    font-weight: bold;
    color: #1890ff;
}

.knowledge-table-container {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 20px;
}

.knowledge-table {
    width: 100%;
    border-collapse: collapse;
}

.knowledge-table th {
    background: #fafafa;
    padding: 12px;
    text-align: left;
    font-weight: 500;
    border-bottom: 1px solid #e8e8e8;
    font-size: 14px;
}

.knowledge-table td {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}

.knowledge-table tbody tr:hover {
    background: #f5f5f5;
}

.knowledge-title {
    color: #1890ff;
    cursor: pointer;
}

.knowledge-title:hover {
    text-decoration: underline;
}

.type-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.type-tag.document {
    background: #e6f7ff;
    color: #1890ff;
}

.type-tag.qa {
    background: #f6ffed;
    color: #52c41a;
}

.status-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.status-tag.indexed {
    background: #f6ffed;
    color: #52c41a;
}

.status-tag.indexing {
    background: #fff7e6;
    color: #faad14;
}

.action-btns {
    display: flex;
    gap: 10px;
}

.action-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 5px;
}

.action-btn:hover {
    opacity: 0.7;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
}

.page-btn {
    padding: 6px 12px;
    border: 1px solid #d9d9d9;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
}

.page-btn:hover {
    border-color: #1890ff;
    color: #1890ff;
}

.page-info {
    font-size: 14px;
    color: #666;
}

/* ========== 页面三：客服工作台 ========== */
.service-container {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    min-height: calc(100vh - 120px);
}

.service-alert {
    background: #fff1f0;
    border-left: 4px solid #ff4d4f;
    padding: 12px 20px;
    color: #a8071a;
    font-size: 14px;
}

.service-layout {
    display: flex;
    height: calc(100vh - 200px);
}

.service-left {
    width: 60%;
    border-right: 1px solid #e8e8e8;
    display: flex;
    flex-direction: column;
}

.service-chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #fafafa;
}

.service-message {
    margin-bottom: 20px;
}

.service-message-content {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 12px;
    word-wrap: break-word;
}

.service-message.bot .service-message-content {
    background: #1890ff;
    color: #fff;
    border-bottom-left-radius: 4px;
}

/* 客服工作台中的订单卡片样式调整 */
.service-message.bot .service-message-content .order-card {
    background: #fff;
    color: #333;
    margin-top: 8px;
}

.service-message.bot .service-message-content .order-card .order-number {
    color: #1890ff;
}

.service-message.bot .service-message-content .logistics-info {
    color: #333;
}

.service-message.user .service-message-content {
    background: #e6f7ff;
    color: #333;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.message-meta {
    font-size: 12px;
    color: #999;
    margin-top: 5px;
    padding-left: 5px;
}

.service-input-area {
    padding: 15px 20px;
    border-top: 1px solid #e8e8e8;
    display: flex;
    gap: 10px;
    background: #fff;
}

.service-input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 14px;
}

.service-send-btn {
    padding: 10px 24px;
    background: #1890ff;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.service-send-btn:hover {
    background: #40a9ff;
}

.service-middle {
    width: 25%;
    padding: 20px;
    border-right: 1px solid #e8e8e8;
    overflow-y: auto;
    background: #fafafa;
}

.customer-card {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.customer-avatar {
    font-size: 48px;
    margin-bottom: 10px;
}

.customer-name {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 10px;
}

.customer-info {
    font-size: 14px;
    color: #666;
    line-height: 1.8;
}

.recent-order {
    background: #fff;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.recent-order h3 {
    font-size: 16px;
    margin-bottom: 10px;
    color: #333;
}

.order-item {
    font-size: 14px;
    line-height: 1.8;
    color: #666;
}

.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.status-badge.shipped {
    background: #f6ffed;
    color: #52c41a;
}

.session-tags {
    background: #fff;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.session-tags h3 {
    font-size: 16px;
    margin-bottom: 10px;
    color: #333;
}

.tags-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    display: inline-block;
    padding: 4px 12px;
    background: #e6f7ff;
    color: #1890ff;
    border-radius: 12px;
    font-size: 12px;
}

.service-right {
    width: 15%;
    padding: 20px;
    overflow-y: auto;
    background: #fafafa;
}

.quick-actions,
.internal-tools,
.session-actions {
    margin-bottom: 20px;
}

.quick-actions h3,
.internal-tools h3 {
    font-size: 14px;
    margin-bottom: 10px;
    color: #333;
}

.preset-btn,
.tool-btn {
    width: 100%;
    padding: 10px;
    margin-bottom: 8px;
    background: #fff;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    text-align: left;
    transition: all 0.3s;
}

.preset-btn:hover,
.tool-btn:hover {
    border-color: #1890ff;
    color: #1890ff;
}

.resolve-btn {
    width: 100%;
    padding: 12px;
    background: #52c41a;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

.resolve-btn:hover {
    background: #73d13d;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .service-layout {
        flex-direction: column;
    }
    
    .service-left,
    .service-middle,
    .service-right {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e8e8e8;
    }
}

@media (max-width: 768px) {
    .dashboard-cards {
        grid-template-columns: 1fr;
    }
    
    .admin-container {
        flex-direction: column;
    }
    
    .admin-sidebar {
        width: 100%;
    }
}
