/* 聊天页面样式 */
:root {
    --primary-color: #157540;
    --primary-color-light: #e7f2ec;
    --primary-color-dark: #0e5730;
    --secondary-color: #f0f7f3;
    --text-color: #333;
    --text-light: #666;
    --text-lighter: #999;
    --border-color: #e0e0e0;
    --border-radius: 8px;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

/* 聊天容器 */
.chat-container {
    display: flex;
    max-width: 1200px;
    width: 1200px;
    margin: 30px auto;
    height: calc(100vh - 200px);
    min-height: 600px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    background-color: #fff;
}

/* 聊天侧边栏 */
.chat-sidebar {
    width: 280px;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    background-color: #f9f9f9;
}

.chat-sidebar .chat-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--primary-color);
    color: #fff;
}

.chat-sidebar .chat-header h2 {
    margin: 0;
    font-size: 18px;
}

/* 聊天类型选择器 */
.chat-type-selector {
    display: flex;
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
}

.chat-type-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
    border: none;
    background-color: transparent;
    color: var(--text-light);
    cursor: pointer;
    border-radius: var(--border-radius);
    transition: var(--transition);
    min-width: 120px; /* 确保按钮宽度一致 */
}

.chat-type-btn i {
    font-size: 20px;
    margin-bottom: 5px;
}

.chat-type-btn.active {
    background-color: var(--primary-color-light);
    color: var(--primary-color);
}

/* 聊天历史 */
.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    scroll-behavior: smooth; /* 添加平滑滚动效果 */
}

.chat-history h3 {
    margin: 0 0 15px;
    font-size: 16px;
    color: var(--text-color);
}

.chat-history-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.chat-history-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: var(--border-radius);
    margin-bottom: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.chat-history-item:hover {
    background-color: #f0f0f0;
}

.chat-history-item.active {
    background-color: var(--primary-color-light);
}

.chat-history-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    flex-shrink: 0;
}

.chat-history-avatar i {
    font-size: 20px;
}

.chat-history-info {
    flex: 1;
    min-width: 0;
}

.chat-history-name {
    font-weight: 500;
    margin-bottom: 3px;
    color: var(--text-color);
}

.chat-history-preview {
    font-size: 13px;
    color: var(--text-lighter);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-history-time {
    font-size: 12px;
    color: var(--text-lighter);
    margin-left: 10px;
}

/* 聊天主区域 */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #fff;
}

.chat-main .chat-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header-info {
    display: flex;
    align-items: center;
}

.chat-header-info h3 {
    margin: 0;
    font-size: 18px;
    color: var(--text-color);
}

.chat-status {
    margin-left: 10px;
    font-size: 13px;
    padding: 3px 8px;
    border-radius: 10px;
    background-color: #eee;
    color: var(--text-light);
}

.chat-status.online {
    background-color: #e7f7e7;
    color: #2e7d32;
}

.chat-status.offline {
    background-color: #f7e7e7;
    color: #c62828;
}

.chat-header-actions {
    display: flex;
}

.chat-action-btn {
    border: none;
    background-color: transparent;
    color: var(--text-lighter);
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: var(--transition);
}

.chat-action-btn:hover {
    background-color: #f0f0f0;
    color: var(--text-color);
}

/* 聊天消息区域 */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: #f9f9f9;
    scroll-behavior: smooth; /* 添加平滑滚动效果 */
}

.chat-day-divider {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.chat-day-divider span {
    background-color: #f0f0f0;
    padding: 5px 15px;
    border-radius: 15px;
    font-size: 12px;
    color: var(--text-lighter);
    position: relative;
    z-index: 1;
}

.chat-day-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background-color: var(--border-color);
    z-index: 0;
}

/* 聊天消息过渡动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message {
    display: flex;
    margin-bottom: 20px;
    animation: fadeIn 0.3s ease-out forwards;
}

.chat-message.user {
    flex-direction: row-reverse;
}

.chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 10px;
    flex-shrink: 0;
}

.chat-message.user .chat-avatar {
    background-color: #4a6fa5;
}

.chat-content {
    max-width: 90%;
}

.chat-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    background-color: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    position: relative;
    word-break: break-word;
}

.chat-message.service .chat-bubble {
    border-top-left-radius: 4px;
    background-color: #fff;
}

.chat-message.user .chat-bubble {
    border-top-right-radius: 4px;
    background-color: var(--primary-color);
    color: #fff;
}

.chat-time {
    font-size: 12px;
    color: var(--text-lighter);
    margin-top: 5px;
    text-align: right;
}

.chat-message.user .chat-time {
    text-align: left;
}

/* 文件附件样式 */
.file-attachment {
    display: flex;
    align-items: center;
    padding: 10px;
    background-color: #f9f9f9;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-bottom: 8px;
}

.file-attachment:last-child {
    margin-bottom: 0;
}

.file-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background-color: #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    color: #5c6ac4;
}

.file-icon i {
    font-size: 24px;
}

/* 图片附件样式 */
.image-attachment {
    display: block;
    padding: 0;
    overflow: hidden;
    background-color: transparent;
    border: none;
}

.image-attachment img.chat-image {
    width: 100%;
    max-height: 200px;
    object-fit: contain;
    border-radius: 8px;
    margin-bottom: 5px;
}

.image-attachment .file-info {
    padding: 5px;
    background-color: rgba(0, 0, 0, 0.03);
    border-radius: 0 0 8px 8px;
}

/* 图片加载指示器 */
.image-loading {
    height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #f5f5f5;
    border-radius: 8px;
    margin-bottom: 5px;
}

.image-loading i {
    font-size: 24px;
    color: var(--primary-color);
    margin-bottom: 8px;
    animation: spin 1.5s linear infinite;
}

.image-loading span {
    font-size: 14px;
    color: var(--text-light);
}

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

.image-attachment-placeholder {
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f0f0f0;
}

.image-attachment-placeholder::after {
    content: '图片加载中...';
    color: var(--text-lighter);
    font-size: 12px;
}

.file-info {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-weight: 500;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    font-size: 12px;
    color: var(--text-lighter);
}

.file-action {
    margin-left: 10px;
}

.file-download-btn {
    border: none;
    background-color: transparent;
    color: var(--primary-color);
    cursor: pointer;
    padding: 5px;
    font-size: 18px;
    border-radius: 50%;
    transition: var(--transition);
}

.file-download-btn:hover {
    background-color: var(--primary-color-light);
}

/* 聊天输入区域 */
.chat-input-container {
    padding: 15px;
    border-top: 1px solid var(--border-color);
    background-color: #fff;
}

.chat-toolbar {
    display: flex;
    margin-bottom: 10px;
}

.toolbar-btn {
    border: none;
    background-color: transparent;
    color: var(--text-lighter);
    font-size: 18px;
    cursor: pointer;
    margin-right: 5px;
    border-radius: 50%;
    transition: var(--transition);
    position: relative;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toolbar-btn:hover {
    background-color: #f0f0f0;
    color: var(--text-color);
}

.file-upload input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.chat-input-wrapper {
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.chat-input {
    flex: 1;
    padding: 12px 15px;
    border: none;
    resize: none;
    height: 60px;
    font-family: inherit;
    font-size: 14px;
    outline: none;
}

.chat-send-wrapper {
    display: flex;
    align-items: flex-end;
}

.chat-send-btn {
    border: none;
    background-color: var(--primary-color);
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    padding: 12px 20px;
    height: 100%;
    transition: var(--transition);
}

.chat-send-btn:hover {
    background-color: var(--primary-color-dark);
}

/* 聊天模式切换 */
.chat-mode-switch {
    display: flex;
    margin-top: 15px;
    justify-content: center;
}

.mode-switch-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 15px;
    border: 1px solid var(--border-color);
    background-color: #fff;
    color: var(--text-light);
    cursor: pointer;
    transition: var(--transition);
    margin: 0 5px;
    border-radius: 20px;
    min-width: 110px; /* 确保按钮宽度一致 */
}

.mode-switch-btn i {
    margin-right: 5px;
}

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

/* 等待交互效果 */
.typing-indicator {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-radius: 18px;
    background-color: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    position: relative;
    max-width: 100px;
}

.typing-indicator span {
    height: 8px;
    width: 8px;
    margin: 0 2px;
    background-color: var(--primary-color);
    display: block;
    border-radius: 50%;
    opacity: 0.4;
    animation: typing 1s infinite;
}

.typing-indicator span:nth-child(1) {
    animation-delay: 0s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0% {
        transform: translateY(0px);
        opacity: 0.4;
    }
    50% {
        transform: translateY(-5px);
        opacity: 0.8;
    }
    100% {
        transform: translateY(0px);
        opacity: 0.4;
    }
}

/* 文件预览容器 */
.file-preview-container {
    border-top: 1px solid var(--border-color);
    padding: 15px;
    background-color: #f9f9f9;
    display: none;
}

.file-preview-container.active {
    display: block;
}

.file-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.file-preview-header h4 {
    margin: 0;
    font-size: 14px;
    color: var(--text-color);
}

.clear-files-btn {
    border: none;
    background-color: transparent;
    color: var(--text-light);
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
}

.clear-files-btn i {
    margin-right: 3px;
}

.file-preview-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.file-preview-item {
    width: 100px;
    background-color: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 10px;
    position: relative;
}

.file-preview-icon {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 5px;
}

.file-preview-icon i {
    font-size: 36px;
    color: #5c6ac4;
}

/* 图片预览样式 */
.file-preview-image {
    height: 60px;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.file-preview-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.file-preview-name {
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

.file-preview-size {
    font-size: 11px;
    color: var(--text-lighter);
    text-align: center;
}

.file-preview-remove {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: #f44336;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    border: none;
}

/* 产品表格样式 */
.product-table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    background: #fff;
    border-radius: 5px;
    overflow: hidden;
    box-shadow: 0 1px 5px rgba(0,0,0,0.05);
    font-size: 13px;
}

.product-table thead th {
    background-color: #f5f5f5;
    color: #333;
    font-weight: 600;
    text-align: left;
    padding: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.product-table tbody tr {
    border-bottom: 1px solid #f0f0f0;
    animation: fadeIn 0.5s forwards;
}

.product-table tbody tr:last-child {
    border-bottom: none;
}

.product-table tbody tr:hover {
    background-color: #f9f9f9;
}

.product-table td {
    padding: 10px;
    vertical-align: middle;
}

.product-id {
    font-family: monospace;
    color: #555;
    font-weight: 500;
}

.stock-status {
    font-weight: 600;
}

.in-stock {
    color: #2e7d32;
}

.low-stock {
    color: #ff9800;
}

.out-of-stock {
    color: #e53935;
}

.warehouse-action {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.warehouse-name {
    font-size: 12px;
    color: #555;
    margin-bottom: 3px;
}

.warehouse-select {
    width: 100%;
    padding: 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
    font-size: 12px;
    margin-bottom: 3px;
}

.action-buttons {
    display: flex;
    gap: 5px;
}

.btn {
    padding: 6px 10px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-primary {
    background-color: #00823C;
    color: white;
}

.btn-primary:hover {
    background-color: #006e32;
    box-shadow: 0 2px 5px rgba(0, 130, 60, 0.3);
}

.btn-secondary {
    background-color: #f0f0f0;
    color: #333;
}

.btn-secondary:hover {
    background-color: #e0e0e0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

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

/* 聊天气泡中的产品表格适配 */
.chat-bubble .product-table {
    margin: 10px -10px;
    width: calc(100% + 20px);
}

/* 移动设备适配 */
@media (max-width: 768px) {
    .product-table th,
    .product-table td {
        padding: 8px 5px;
        font-size: 11px;
    }
    
    .btn {
        padding: 5px 8px;
        font-size: 11px;
    }
    
    .product-table th:nth-child(3),
    .product-table td:nth-child(3) {
        display: none; /* 在小屏幕上隐藏规格列 */
    }
}

/* 响应式设计 */
@media (max-width: 992px) {
    .chat-container {
        flex-direction: column;
        height: auto;
        margin: 15px;
    }
    
    .chat-sidebar {
        width: 100%;
        height: auto;
        max-height: 300px;
    }
    
    .chat-main {
        height: calc(100vh - 400px);
    }
    
    .chat-content {
        max-width: 85%;
    }
}

@media (max-width: 576px) {
    .chat-content {
        max-width: 90%;
    }
    
    .chat-mode-switch {
        flex-direction: column;
        gap: 10px;
    }
    
    .mode-switch-btn {
        width: 100%;
        justify-content: center;
    }
} 

/* 添加以下报价表格样式 */
.quote-table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.5s ease-in-out;
}

.quote-table thead th {
    background-color: #0b5394;
    color: white;
    font-weight: 600;
    text-align: center;
    padding: 12px 8px;
}

.quote-table tbody tr {
    border-bottom: 1px solid #e0e0e0;
    animation: tableRowIn 0.3s ease-in-out forwards;
    opacity: 1;
}

.quote-row {
    /* 确保行内容可见 */
    visibility: visible !important;
    opacity: 1 !important;
}

.quote-table tbody tr:nth-child(even) {
    background-color: #f5f8ff;
}

.quote-table tbody tr:hover {
    background-color: #e8f0fe;
}

.quote-table td {
    padding: 10px 8px;
    text-align: center;
    vertical-align: middle;
}

.quote-table .product-price {
    font-weight: bold;
    color: #e63946;
    font-size: 1.05em;
}

.quote-table .product-id {
    font-family: monospace;
    font-weight: 500;
}

.quote-table .action-buttons {
    display: flex;
    gap: 5px;
    justify-content: center;
}

.quote-table .quote-note {
    font-size: 0.9em;
    color: #555;
    text-align: left;
    padding: 15px;
    background-color: #f5f8ff;
    border-top: 1px solid #e0e0e0;
    line-height: 1.6;
}

.quote-table .quote-note br {
    margin-bottom: 5px;
}

/* 会员价格标记样式 */
.member-tag {
    display: inline-block;
    margin: 0 3px;
    padding: 2px 6px;
    border-radius: 3px;
    background-color: #f0f0f0;
    font-weight: 500;
}

@keyframes tableRowIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 响应式样式 */
@media (max-width: 768px) {
    .quote-table {
        font-size: 0.9em;
    }
    
    .quote-table th, 
    .quote-table td {
        padding: 8px 4px;
    }
    
    .quote-table .quote-note {
        font-size: 0.8em;
    }
} 