/* 在线客服系统样式 */

/* 可点击的联系项 */
.contact-item-clickable {
    cursor: pointer;
    transition: all 0.3s ease;
}

.contact-item-clickable:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.15);
}

.contact-item-clickable .contact-desc {
    color: var(--primary-color) !important;
    font-weight: 500;
}

/* 聊天窗口 */
.cs-chat-window {
    position: fixed;
    bottom: -600px;
    right: 20px;
    width: 400px;
    height: 600px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    transition: bottom 0.3s ease;
    z-index: 10000;
}

.cs-chat-window.open {
    bottom: 20px;
}

/* 聊天头部 */
.cs-chat-header {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 16px 20px;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cs-chat-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.cs-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.cs-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* 聊天主体 */
.cs-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f9fafb;
}

.cs-welcome-message {
    text-align: center;
    padding: 20px;
    background: white;
    border-radius: 8px;
    margin-bottom: 20px;
}

.cs-welcome-message p {
    margin: 8px 0;
    color: #64748b;
}

.cs-messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 消息样式 */
.cs-message {
    display: flex;
    flex-direction: column;
    max-width: 80%;
}

.cs-message-user {
    align-self: flex-end;
}

.cs-message-admin {
    align-self: flex-start;
}

.cs-message-system {
    align-self: center;
    max-width: 90%;
}

.cs-message-content {
    padding: 10px 14px;
    border-radius: 12px;
    word-wrap: break-word;
}

.cs-message-user .cs-message-content {
    background: #10b981;
    color: white;
    border-bottom-right-radius: 4px;
}

.cs-message-admin .cs-message-content {
    background: white;
    color: #1e293b;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.cs-message-system .cs-message-content {
    background: #fee2e2;
    color: #dc2626;
    text-align: center;
    font-size: 13px;
}

.cs-message-text {
    line-height: 1.5;
}

.cs-message-files {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cs-message-image {
    max-width: 100%;
    border-radius: 8px;
    cursor: pointer;
}

.cs-message-video {
    max-width: 100%;
    border-radius: 8px;
}

.cs-file-item {
    font-size: 13px;
    opacity: 0.9;
}

.cs-message-time {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 4px;
    padding: 0 4px;
}

.cs-message-user .cs-message-time {
    text-align: right;
}

.cs-message-admin .cs-message-time {
    text-align: left;
}

/* 聊天底部 */
.cs-chat-footer {
    border-top: 1px solid #e2e8f0;
    background: white;
    border-radius: 0 0 12px 12px;
}

.cs-upload-preview {
    padding: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 150px;
    overflow-y: auto;
}

.cs-preview-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    background: #f1f5f9;
}

.cs-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cs-video-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 12px;
    padding: 8px;
    text-align: center;
}

.cs-preview-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cs-input-area {
    padding: 12px;
}

#cs-message-input {
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    margin-bottom: 8px;
}

#cs-message-input:focus {
    outline: none;
    border-color: #10b981;
}

.cs-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.cs-upload-btn {
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s;
    display: inline-block;
}

.cs-upload-btn:hover {
    background: #f1f5f9;
}

.cs-send-btn {
    background: #10b981;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
    margin-left: auto;
}

.cs-send-btn:hover {
    background: #059669;
}

/* 新消息动画 */
@keyframes slideInMessage {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cs-message {
    animation: slideInMessage 0.3s ease;
}

/* 管理员消息样式 */
.cs-message-admin .cs-message-content {
    background: white;
    border: 1px solid #e5e7eb;
}

.cs-message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.cs-message-sender {
    font-weight: 600;
    color: #10b981;
    font-size: 13px;
}

.cs-message-time {
    font-size: 11px;
    color: #9ca3af;
}

.cs-message-text {
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.5;
}

.cs-message-files {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cs-message-image {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s;
}

.cs-message-image:hover {
    transform: scale(1.02);
}

.cs-message-video {
    max-width: 100%;
    border-radius: 8px;
}

/* 新消息高亮效果 */
.cs-message-new .cs-message-content {
    animation: newMessageHighlight 1s ease;
}

@keyframes newMessageHighlight {
    0% {
        background-color: #d1fae5;
        transform: scale(1.02);
    }
    100% {
        background-color: white;
        transform: scale(1);
    }
}

/* 聊天窗口内通知 */
.cs-chat-body {
    position: relative;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translate(-50%, -20px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

@keyframes slideOutUp {
    from {
        opacity: 1;
        transform: translate(-50%, 0);
    }
    to {
        opacity: 0;
        transform: translate(-50%, -20px);
    }
}

.cs-in-chat-notification {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(16, 185, 129, 0.95);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* 响应式 */
@media (max-width: 480px) {
    .cs-chat-window {
        width: calc(100% - 40px);
        right: 20px;
        left: 20px;
    }
}
