/* ===== 输入区域样式 ===== */
.input-area {
    background: white;
    grid-area: input;
}

.input-inner {
    width: 100%;
    max-width: none;
    margin: 0;
}

/* 输入框容器 */
.input-container {
    position: relative;
    display: flex;
    align-items: flex-start;
    width: 95%;
    margin: 0 auto 0.5rem auto; /* 上下外边距保持不变，左右自动居中 */
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    background-color: white;
    transition: all 0.2s ease;
    overflow: hidden;
}

.input-container:focus-within {
    border-color: #3b82f6;
    background-color: white;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* 消息输入框 */
.message-input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 0.75rem 1rem 3rem 1rem; /* 调整底部padding为菜单栏留出空间 */
    font-size: 0.875rem;
    color: #374151;
    resize: none;
    line-height: 1.5;
    min-height: 100px;
    max-height: 700px;
    overflow-y: auto;
    transition: all 0.2s ease;
    font-family: 'Noto Sans SC', sans-serif;
    outline: none;
}

.message-input::placeholder {
    color: #9ca3af;
}

/* 底部菜单栏 - 改为纯白色并添加分割线 */
.input-menu {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between; /* 左右分布 */
    padding: 0.5rem 1rem;
    background-color: white;
    /*border-top: 1px solid #f0f0f0; *//* 添加轻微分割线 */
}

/* 左侧菜单项组 */
.menu-left {
    display: flex;
    align-items: center;
}

/* 右侧菜单项组 */
.menu-right {
    display: flex;
    align-items: center;
}

.menu-item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: none;
    background: transparent;
    border-radius: 0.375rem;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.2s ease;
    margin-right: 0.5rem;
    position: relative;
}

.menu-item:hover {
    background-color: #e5e7eb;
    color: #374151;
}

.menu-item.active {
    background-color: #3b82f6;
    color: white;
}

/* 发送按钮样式 - 整合到菜单栏中 */
.send-btn.menu-item {
    background-color: #3b82f6;
    color: white;
    margin-right: 0;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.send-btn.menu-item:hover:not(:disabled) {
    background-color: #2563eb;
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.4);
}

.send-btn.menu-item:active:not(:disabled) {
    transform: scale(0.95);
}

.send-btn.menu-item:disabled {
    background-color: #9ca3af;
    cursor: not-allowed;
    transform: scale(0.95);
    box-shadow: 0 1px 2px rgba(156, 163, 175, 0.3);
}

.menu-icon {
    width: 1.125rem;
    height: 1.125rem;
}

/* 输入框底部信息 */
.input-footer {
    font-size: 0.75rem;
    color: #6b7280;
    text-align: center;
    margin-top: 0.5rem;
}

/* ===== 输入框滚动条样式 ===== */
.message-input::-webkit-scrollbar {
    width: 6px;
}

.message-input::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 3px;
}

.message-input::-webkit-scrollbar-thumb {
    background-color: rgba(156, 163, 175, 0.5);
    border-radius: 3px;
}

.message-input::-webkit-scrollbar-thumb:hover {
    background-color: rgba(156, 163, 175, 0.8);
}

/* ===== 响应式调整 ===== */
@media (max-width: 767px) {

    .message-input {
        padding-right: 1rem;
        padding-bottom: 2.5rem; /* 移动端调整底部padding */
        font-size: 1rem;
    }

    .input-menu {
        padding: 0.375rem 0.75rem;
    }

    .menu-item {
        width: 1.75rem;
        height: 1.75rem;
        margin-right: 0.375rem;
    }

    .menu-icon {
        width: 1rem;
        height: 1rem;
    }

    .input-footer{
        display: none;
    }
}

/* ===== 加载动画 ===== */
.loader {
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    width: 1.125rem;
    height: 1.125rem;
    animation: spin 1s linear infinite;
}

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

/* ===== 功能开关样式 ===== */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 2.5rem;
    height: 1.25rem;
    margin-right: 0.5rem;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 1.25rem;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 0.875rem;
    width: 0.875rem;
    left: 0.1875rem;
    bottom: 0.1875rem;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: #3b82f6;
}

input:checked + .toggle-slider:before {
    transform: translateX(1.25rem);
}

.toggle-label {
    font-size: 0.75rem;
    color: #6b7280;
    white-space: nowrap;
}

/* ===== 菜单项工具提示 ===== */
.menu-item .tooltip {
    visibility: hidden;
    width: max-content;
    background-color: #374151;
    color: white;
    text-align: center;
    border-radius: 0.375rem;
    padding: 0.25rem 0.5rem;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.75rem;
    white-space: nowrap;
}

.menu-item:hover .tooltip {
    visibility: visible;
    opacity: 1;
}

/* 在现有样式基础上添加取消按钮的特殊样式 */
.send-btn.cancelling {
    background-color: #ef4444 !important;
}

/* 粘贴图片预览样式 - 移到输入框外侧顶部 */
.pasted-images-preview {
    width: 95%;
    padding: 0.5rem 2.5% 0.5rem 2.5%; /* 与输入框相同的水平边距 */
    background-color: #ffffff;
    border-radius: 0.75rem 0.75rem 0 0; /* 顶部圆角 */
    max-height: 120px;
    overflow-x: auto;
    overflow-y: hidden;
    margin: 0 auto 0 auto;
    box-sizing: border-box;
    white-space: nowrap; /* 防止子元素换行 */
    display: flex;
    align-items: center;
}

.pasted-image-item {
    display: flex;
    align-items: center;
    margin-bottom: 0;
    background-color: #ffffff;
    border: 1px solid #374151;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
    color: #e5e7eb;
    min-width: 120px; /* 最小宽度以确保可读性 */
    width: auto; /* 让元素根据内容自适应宽度 */
    flex: 0 0 auto; /* 不伸缩，根据内容自适应 */
    box-sizing: border-box;
    justify-content: space-between; /* Distribute space between content and button */
}

.pasted-image-item:last-child {
    margin-right: 0;
}

.pasted-image-preview-container {
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    min-width: 0; /* Allow shrinking below content size */
}

.pasted-image-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

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

.pasted-image-name {
    font-size: 0.875rem;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
    max-width: 70px; /* 限制最大宽度以实现最多显示约10个字符 */
    display: inline-block;
}

.pasted-image-size {
    font-size: 0.75rem;
    color: #1f2937;
    display: block;
    font-weight: 400;
}

.pasted-image-error {
    font-size: 0.75rem;
    color: #f87171;
    margin-top: 0.25rem;
    display: block;
}

/* 上传状态样式 - 仅文字提示 */
.pasted-image-item.uploading-state {
    border-color: #9ca3af; /* 中性灰色边框 */
    background-color: #ffffff;
}

.pasted-image-item.success-state {
    border-color: #9ca3af; /* 中性灰色边框 */
    background-color: #ffffff;
}

.pasted-image-item.error-state {
    border-color: #9ca3af; /* 中性灰色边框 */
    background-color: #ffffff;
}

.upload-status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.25rem;
}

.uploading .upload-status-indicator {
    background-color: #9ca3af; /* 灰色表示上传中 */
}

.success .upload-status-indicator {
    background-color: #9ca3af; /* 灰色表示成功 */
}

.error .upload-status-indicator {
    background-color: #9ca3af; /* 灰色表示失败 */
}

.upload-status-text {
    font-size: 0.75rem;
    color: #6b7280;
    display: block;
    font-weight: 400;
}

.uploading .upload-status-text {
    color: #4b5563; /* 灰色文字表示上传中 */
}

.success .upload-status-text {
    display: none; /* 上传成功后隐藏状态文字 */
}

.error .upload-status-text {
    color: #b91c1c; /* 红色文字表示失败 */
}

.pasted-image-remove-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border: none;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
    margin-left: 0.5rem;
    flex-shrink: 0; /* Prevent button from shrinking */
}

.pasted-image-remove-btn:hover {
    background-color: #fee2e2;
    color: #ef4444;
}

/* 附件预览样式 - 在用户消息顶部显示 */
.attachments-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.25rem; /* 减小底部边距 */
    padding: 0.25rem 0; /* 减小上下填充 */
}

.attachment-item {
    display: flex;
    align-items: center;
    background-color: rgb(255 255 255);
    border: 1px solid rgb(156 163 175);
    border-radius: 0.375rem;
    transition: all 0.2s ease;
    color: white;
    min-width: 120px;
    width: auto;
    flex: 0 0 auto;
    box-sizing: border-box;
}

.attachment-item:last-child {
    margin-right: 0;
}

.attachment-preview-container {
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    min-width: 0;
    padding: 0.5rem;
}

.attachment-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.5rem;
    flex-shrink: 0;
}

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

.attachment-name {
    font-size: 0.75rem;
    color: #0a0303;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
    max-width: 70px; /* 限制最大宽度以实现最多显示约10个字符 */
    display: inline-block;
}

.attachment-size {
    font-size: 0.65rem;
    color: #0a0303;
    display: block;
    font-weight: 400;
    margin-top: 0.1rem;
}