/* ===================================
   客服聊天组件 - 样式文件
   版本: 1.0.0
   =================================== */

/* 聊天组件样式 - 中性化设计，减少冲突 */
.chat-widget {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff;
    border-radius: 0;
    box-shadow: none;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transition: all 0.3s ease;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.chat-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
    box-sizing: border-box;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    background: #f8f9fa;
    border: none;
    margin: 0;
    box-sizing: border-box;
}

.chat-input {
    padding: 15px;
    display: flex;
    gap: 10px;
    background: #ffffff;
    border-top: 1px solid #e9ecef;
    box-sizing: border-box;
}

.chat-input textarea {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 12px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
    resize: none;
    min-height: 40px;
    max-height: 120px;
    overflow-y: auto;
}

.chat-input textarea:focus {
    border-color: #007bff;
}

.chat-input textarea:disabled {
    background: #f8f9fa;
    cursor: not-allowed;
}

.chat-input button {
    padding: 12px;
    background: #007bff;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    transition: background-color 0.3s ease;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
}

.chat-input button:hover:not(:disabled) {
    background: #0056b3;
    opacity: 0.9;
}

.chat-input button:active:not(:disabled) {
    opacity: 0.8;
}

.chat-input button:disabled {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

.message-time {
    font-size: 10px;
    color: #666;
    margin-top: 1px;
    opacity: 0.9;
    display: block;
}

.message.system .message-time {
    text-align: center;
    margin-bottom: 2px;
    margin-top: 0;
    display: block;
    color: #6c757d;
}

.message.sent .message-time {
    text-align: right;
    color: #ffffff;
    background-color: #007bff;
    padding: 2px 4px;
}

.message.received .message-time {
    text-align: left;
}

.message {
    width: 100%;
    overflow: hidden;
    margin-bottom: 6px;
}

.message div {
    display: inline-block;
    max-width: 75%;
    padding: 6px 12px;
    border-radius: 8px;
    word-wrap: break-word;
    line-height: 1.4;
    font-size: 14px;
    box-sizing: border-box;
}

.message.sent div {
    background: #007bff;
    color: #ffffff;
    float: right;
}

.message.received div {
    background: #f1f3f4;
    color: #202124;
    float: left;
}

.message.system {
    width: auto;
    max-width: 80%;
    margin: 1px auto;
    background: #f8f9fa;
    color: #6c757d;
    border-radius: 4px;
    padding: 2px 8px;
    display: block;
    text-align: center;
}

.message.system div {
    font-size: 10px;
}

.verification-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    box-sizing: border-box;
}

.verification-box {
    background: #ffffff;
    padding: 24px;
    border-radius: 8px;
    text-align: center;
    max-width: 320px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    box-sizing: border-box;
}

.verification-box h4 {
    margin-top: 0;
    color: #202124;
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 12px;
    font-family: inherit;
}

.verification-box p {
    color: #5f6368;
    font-size: 14px;
    margin-bottom: 20px;
    line-height: 1.4;
    font-family: inherit;
}

.verification-box button {
    background: #007bff;
    color: #ffffff;
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    transition: background-color 0.3s ease;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.verification-box button:hover {
    background: #0056b3;
}

.verification-box button.secondary {
    background: #6c757d;
    margin-left: 10px;
}

.verification-box button.secondary:hover {
    background: #545b62;
}

.hidden {
    display: none !important;
}

/* 响应式设计 */
@media (max-width: 600px) {
    .chat-messages {
        padding: 12px;
    }

    .chat-input {
        padding: 12px;
        gap: 8px;
    }

    .chat-input textarea {
        padding: 12px;
        font-size: 16px; /* 防止iOS缩放 */
    }

    .chat-input button {
        padding: 12px;
        font-size: 16px;
        min-width: 48px;
        min-height: 48px;
    }

    .message {
        max-width: 100%;
    }

    .message div {
        max-width: 75%;
    }

    .verification-box {
        margin: 20px;
        max-width: none;
        padding: 20px;
    }

    .verification-box h4 {
        font-size: 16px;
    }

    .verification-box p {
        font-size: 14px;
    }

    .verification-box button {
        padding: 12px 16px;
        font-size: 14px;
        gap: 6px;
    }
}

/* 滚动条样式 - 中性化设计 */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f3f4;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #dadce0;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #bdc1c6;
}

/* 通用重置样式 */
* {
    box-sizing: border-box;
}

/* 确保在iframe中正确显示 */
body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
