/**
 * 组件样式
 * 仅保留必要的自定义样式和特殊组件
 */

/* 模态框组件 - 保留特殊动画和backdrop效果 */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease-out;
}

.modal.hidden {
    display: none !important;
    animation: none;
}

.modal.fade-out {
    animation: fadeOut 0.2s ease-out forwards;
}

/* 加载模态框 - 保留特殊spinner动画 */
.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid #e5e7eb;
    border-top-color: #2563EB;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* 确认模态框图标 - 保留特殊样式 */
.confirm-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.5rem;
}

.confirm-icon.warning {
    background: #FEF3C7;
    color: #F59E0B;
}

.confirm-icon.error {
    background: #FEE2E2;
    color: #EF4444;
}

.confirm-icon.success {
    background: #D1FAE5;
    color: #10B981;
}

.confirm-icon.info {
    background: #DBEAFE;
    color: #3B82F6;
}

/* 聊天组件 - 微信风格特殊样式 */
.chat-history-wechat {
    background: #f5f5f5;
    min-height: calc(100vh - 200px);
    padding: 1rem;
    border-radius: 0;
    overflow-y: auto;
}

.chat-message {
    display: flex;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-avatar-wechat {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.chat-avatar-wechat img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.message-bubble-wechat {
    max-width: 70%;
    position: relative;
    word-wrap: break-word;
    word-break: break-all;
    margin-left: 0.75rem;
}

.ai-message {
    background: white;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.ai-message::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 12px;
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-right: 6px solid white;
}

.ai-message-wechat {
    background: white;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.ai-message-wechat::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 12px;
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-right: 6px solid white;
}

.user-message {
    background: #95ec69;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.user-message::before {
    content: '';
    position: absolute;
    right: -6px;
    top: 12px;
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-left: 6px solid #95ec69;
}

.user-message-wechat {
    background: #95ec69;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.user-message-wechat::before {
    content: '';
    position: absolute;
    right: -6px;
    top: 12px;
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-left: 6px solid #95ec69;
}

.message-time {
    font-size: 12px;
    color: #999;
    margin-top: 0.5rem;
}

.message-time-wechat {
    font-size: 12px;
    color: #999;
    margin-top: 0.5rem;
}

/* 用户消息容器 - 右对齐 */
.chat-message.user-message {
    flex-direction: row-reverse;
}

.chat-message.user-message .chat-avatar {
    margin-left: 0.75rem;
}

.chat-message.user-message .message-bubble-wechat {
    margin-left: 0;
    margin-right: 0.75rem;
}

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

/* 输入框组件 - 微信风格特殊样式 */
.input-wrapper-wechat {
    display: flex;
    gap: 0.5rem;
    background: white;
    border-radius: 6px;
    padding: 0.5rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
    border: 1px solid #e0e0e0;
}

.input-wrapper-wechat:focus-within {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-color: #95ec69;
}

.input-wrapper-wechat input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: none;
    font-size: 14px;
    outline: none;
    background: transparent;
    color: #333;
}

.input-wrapper-wechat input::placeholder {
    color: #999;
}

.input-wrapper-wechat button {
    background: #95ec69;
    color: #333;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.input-wrapper-wechat button:hover {
    background: #7ed957;
    transform: scale(1.05);
}

.input-wrapper-wechat button:active {
    transform: scale(0.95);
}

.input-wrapper-wechat button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    background: #e0e0e0;
}

/* 消息提示 - 保留特殊动画 */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast-container.hidden {
    display: none !important;
}

.toast {
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    animation: slideIn 0.3s ease-out;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 280px;
}

.toast.hidden {
    display: none !important;
    animation: none;
}

.toast.success {
    background: #D1FAE5;
    border: 1px solid #10B981;
    color: #10B981;
}

.toast.error {
    background: #FEE2E2;
    border: 1px solid #EF4444;
    color: #EF4444;
}

.toast.warning {
    background: #FEF3C7;
    border: 1px solid #F59E0B;
    color: #F59E0B;
}

.toast.info {
    background: #DBEAFE;
    border: 1px solid #3B82F6;
    color: #3B82F6;
}

.toast-close {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 0.25rem;
    font-size: 1.125rem;
    line-height: 1;
    opacity: 0.6;
    transition: opacity 0.15s;
}

.toast-close:hover {
    opacity: 1;
}

/* 自定义滚动条样式 */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 9999px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #9CA3AF;
    border-radius: 9999px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #2563EB;
}

/* 动画关键帧 */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

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

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

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 响应式 */
@media (max-width: 767px) {
    .toast {
        min-width: auto;
        max-width: calc(100vw - 2rem);
    }
}
