/* 闲云 AI 对话 - 自定义样式 */

/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

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

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #c4b5fd;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a78bfa;
}

/* 暗黑模式滚动条 */
.dark ::-webkit-scrollbar-thumb {
    background: #4c1d95;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: #5b21b6;
}

/* Markdown 样式 */
.markdown-content {
    line-height: 1.7;
    word-break: break-word;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
    line-height: 1.3;
}

.markdown-content h1:first-child,
.markdown-content h2:first-child,
.markdown-content h3:first-child {
    margin-top: 0;
}

.markdown-content h1 {
    font-size: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.dark .markdown-content h1 {
    border-bottom-color: #374151;
}

.markdown-content h2 {
    font-size: 1.25rem;
}

.markdown-content h3 {
    font-size: 1.125rem;
}

.markdown-content p {
    margin-bottom: 0.75rem;
}

.markdown-content p:last-child {
    margin-bottom: 0;
}

.markdown-content ul,
.markdown-content ol {
    margin: 0.75rem 0;
    padding-left: 1.5rem;
}

.markdown-content li {
    margin: 0.25rem 0;
}

.markdown-content ul {
    list-style-type: disc;
}

.markdown-content ol {
    list-style-type: decimal;
}

.markdown-content code {
    background: #f3f4f6;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
    font-size: 0.875em;
    color: #7c3aed;
}

.dark .markdown-content code {
    background: #374151;
    color: #a78bfa;
}

.markdown-content pre {
    background: #1f2937;
    color: #e5e7eb;
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin: 0.75rem 0;
}

.markdown-content pre code {
    background: none;
    padding: 0;
    color: inherit;
    font-size: 0.875rem;
}

/* 代码块包装器 */
.code-block {
    position: relative;
    margin: 0.75rem 0;
    border-radius: 0.5rem;
    overflow: hidden;
}

.code-block .code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background: #374151;
    border-bottom: 1px solid #4b5563;
}

.code-block .code-lang {
    font-size: 0.75rem;
    color: #9ca3af;
    font-weight: 500;
    text-transform: uppercase;
}

.code-block .copy-btn {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    color: #9ca3af;
    background: #4b5563;
    border: none;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: all 0.2s;
}

.code-block .copy-btn:hover {
    background: #6b7280;
    color: #fff;
}

.code-block pre {
    margin: 0;
    border-radius: 0;
}

.markdown-content blockquote {
    border-left: 4px solid #8b5cf6;
    padding-left: 1rem;
    margin: 0.75rem 0;
    color: #6b7280;
    font-style: italic;
}

.dark .markdown-content blockquote {
    color: #9ca3af;
}

.markdown-content a {
    color: #8b5cf6;
    text-decoration: none;
    transition: color 0.2s;
}

.markdown-content a:hover {
    color: #7c3aed;
    text-decoration: underline;
}

.markdown-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.75rem 0;
}

.markdown-content th,
.markdown-content td {
    border: 1px solid #e5e7eb;
    padding: 0.5rem 0.75rem;
    text-align: left;
}

.dark .markdown-content th,
.dark .markdown-content td {
    border-color: #374151;
}

.markdown-content th {
    background: #f9fafb;
    font-weight: 600;
}

.dark .markdown-content th {
    background: #1f2937;
}

.markdown-content img {
    max-width: 100%;
    border-radius: 0.5rem;
    margin: 0.5rem 0;
}

.markdown-content hr {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 1.5rem 0;
}

.dark .markdown-content hr {
    border-top-color: #374151;
}

/* 打字机光标动画 */
.typing-cursor::after {
    content: '|';
    animation: blink 1s infinite;
    margin-left: 2px;
    color: #8b5cf6;
}

@keyframes blink {
    0%, 50% {
        opacity: 1;
    }
    51%, 100% {
        opacity: 0;
    }
}

/* 加载动画 */
.loading-dots {
    display: inline-flex;
    gap: 4px;
}

.loading-dots span {
    width: 6px;
    height: 6px;
    background: #8b5cf6;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* 旋转加载动画 */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e5e7eb;
    border-top-color: #8b5cf6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 会话项样式 */
.session-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    gap: 0.75rem;
}

.session-item:hover {
    background: #f3f4f6;
}

.dark .session-item:hover {
    background: #374151;
}

.session-item.active {
    background: #ede9fe;
}

.dark .session-item.active {
    background: #4c1d95;
}

.session-item .session-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.875rem;
    color: #374151;
}

.dark .session-item .session-title {
    color: #e5e7eb;
}

.session-item .session-time {
    font-size: 0.75rem;
    color: #9ca3af;
}

.session-item .session-actions {
    display: none;
    gap: 0.25rem;
}

.session-item:hover .session-actions {
    display: flex;
}

/* 消息样式 */
.message {
    display: flex;
    gap: 1rem;
    padding: 1rem 0;
}

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

.message-avatar {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.message.user .message-avatar {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: white;
}

.message.assistant .message-avatar {
    background: #f3f4f6;
    color: #8b5cf6;
}

.dark .message.assistant .message-avatar {
    background: #374151;
}

.message-content {
    max-width: 80%;
    padding: 0.875rem 1.125rem;
    border-radius: 1rem;
    line-height: 1.6;
}

.message.user .message-content {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: white;
    border-bottom-right-radius: 0.25rem;
}

.message.assistant .message-content {
    background: #f3f4f6;
    color: #1f2937;
    border-bottom-left-radius: 0.25rem;
}

.dark .message.assistant .message-content {
    background: #374151;
    color: #f3f4f6;
}

/* 思考过程折叠 */
.thinking-block {
    margin-bottom: 0.75rem;
}

.thinking-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: #f9fafb;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: #6b7280;
    transition: background 0.2s;
}

.dark .thinking-toggle {
    background: #1f2937;
    color: #9ca3af;
}

.thinking-toggle:hover {
    background: #f3f4f6;
}

.dark .thinking-toggle:hover {
    background: #374151;
}

.thinking-toggle svg {
    transition: transform 0.2s;
}

.thinking-toggle.expanded svg {
    transform: rotate(90deg);
}

.thinking-content {
    display: none;
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: #f9fafb;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: #6b7280;
    border-left: 3px solid #8b5cf6;
}

.dark .thinking-content {
    background: #1f2937;
    color: #9ca3af;
}

.thinking-content.show {
    display: block;
}

/* 图片消息 */
.message-images {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.message-images img {
    max-width: 200px;
    max-height: 200px;
    object-fit: cover;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: transform 0.2s;
}

.message-images img:hover {
    transform: scale(1.02);
}

/* 图片预览 */
.image-preview-item {
    position: relative;
    display: inline-block;
}

.image-preview-item img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 0.5rem;
    border: 2px solid #e5e7eb;
}

.dark .image-preview-item img {
    border-color: #374151;
}

.image-preview-item .remove-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
}

/* 复制按钮 */
.copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.375rem 0.625rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 0.375rem;
    color: #9ca3af;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* 代码块相对定位 */
.markdown-content pre {
    position: relative;
}

/* 弹窗动画 */
.modal-enter {
    opacity: 0;
}

.modal-enter .modal-content {
    transform: scale(0.95);
}

.modal-active {
    opacity: 1;
    visibility: visible;
}

.modal-active .modal-content {
    transform: scale(1);
}

/* 响应式调整 */
@media (max-width: 640px) {
    .message-content {
        max-width: 90%;
    }

    .message-images img {
        max-width: 150px;
        max-height: 150px;
    }
}

/* 渐变文字 */
.gradient-text {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 渐变背景 */
.gradient-bg {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* 淡入动画 */
.fade-in {
    animation: fadeIn 0.3s ease-out;
}

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

/* 滑入动画 */
.slide-in-left {
    animation: slideInLeft 0.3s ease-out;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 失败消息样式 */
.message.failed .message-content {
    border: 2px solid #fca5a5;
    background: #fef2f2 !important;
}

.dark .message.failed .message-content {
    border-color: #7f1d1d;
    background: #450a0a !important;
}

.message-error-actions {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px dashed #e5e7eb;
}

.dark .message-error-actions {
    border-top-color: #374151;
}

.message-error-actions .error-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.message-error-actions .action-buttons {
    display: flex;
    gap: 0.5rem;
}

.message-error-actions .retry-btn,
.message-error-actions .edit-btn {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s;
}

.message-error-actions .retry-btn {
    background: #8b5cf6;
    color: white;
    border: none;
}

.message-error-actions .retry-btn:hover {
    background: #7c3aed;
}

.message-error-actions .edit-btn {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #e5e7eb;
}

.dark .message-error-actions .edit-btn {
    background: #374151;
    color: #e5e7eb;
    border-color: #4b5563;
}

.message-error-actions .edit-btn:hover {
    background: #e5e7eb;
}

.dark .message-error-actions .edit-btn:hover {
    background: #4b5563;
}

/* 编辑框样式 */
.edit-container {
    margin-top: 0.5rem;
}

.edit-textarea {
    width: 100%;
    min-height: 80px;
    max-height: 200px;
    padding: 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    line-height: 1.5;
    resize: vertical;
    outline: none;
}

.dark .edit-textarea {
    background: #1f2937;
    border-color: #374151;
    color: #f3f4f6;
}

.edit-textarea:focus {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.edit-actions .cancel-btn,
.edit-actions .confirm-btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s;
}

.edit-actions .cancel-btn {
    background: #f3f4f6;
    color: #6b7280;
    border: 1px solid #e5e7eb;
}

.dark .edit-actions .cancel-btn {
    background: #374151;
    color: #9ca3af;
    border-color: #4b5563;
}

.edit-actions .cancel-btn:hover {
    background: #e5e7eb;
}

.dark .edit-actions .cancel-btn:hover {
    background: #4b5563;
}

.edit-actions .confirm-btn {
    background: #8b5cf6;
    color: white;
    border: none;
}

.edit-actions .confirm-btn:hover {
    background: #7c3aed;
}

/* ==================== 移动端适配 ==================== */

/* 可选标签样式 */
.option-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.375rem 0.875rem;
    font-size: 0.75rem;
    border-radius: 9999px;
    border: 1px solid #d1d5db;
    color: #4b5563;
    background: transparent;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
}

.dark .option-tag {
    border-color: #4b5563;
    color: #9ca3af;
}

.option-tag:hover {
    border-color: #8b5cf6;
    color: #7c3aed;
}

.dark .option-tag:hover {
    border-color: #a78bfa;
    color: #a78bfa;
}

.option-tag[data-active="true"] {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    border-color: transparent;
    color: white;
}

.option-tag.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* 平板设备 (768px - 1024px) */
@media (max-width: 1024px) {
    /* 侧边栏宽度调整 */
    .sidebar {
        width: 280px;
    }
}

/* 移动端 (< 768px) */
@media (max-width: 768px) {
    /* 顶部导航栏 */
    header {
        padding: 0.75rem 1rem;
    }

    header h1 {
        font-size: 1.125rem;
    }

    /* 模型选择框 */
    #modelSelect {
        max-width: 150px;
        font-size: 0.75rem;
        padding: 0.5rem 0.75rem;
    }

    /* 用户区域 */
    #userArea .hidden.sm\:inline {
        display: none !important;
    }

    /* 消息区域 */
    .message {
        gap: 0.75rem;
        padding: 0.75rem 0;
    }

    .message-avatar {
        width: 32px;
        height: 32px;
        font-size: 0.875rem;
    }

    .message-content {
        max-width: 85%;
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }

    .message.user .message-content {
        border-bottom-right-radius: 0.125rem;
    }

    .message.assistant .message-content {
        border-bottom-left-radius: 0.125rem;
    }

    /* 思考过程 */
    .thinking-toggle {
        padding: 0.375rem 0.5rem;
        font-size: 0.75rem;
    }

    .thinking-content {
        padding: 0.5rem;
        font-size: 0.75rem;
    }

    /* 输入区域 */
    .input-area {
        padding: 0.75rem;
    }

    #messageInput {
        padding: 0.75rem 1rem;
        font-size: 1rem; /* 防止iOS缩放 */
    }

    /* 功能选项 */
    .mt-3.flex.items-center.gap-4 {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .mt-3.flex.items-center.gap-4 label {
        font-size: 0.75rem;
    }

    /* 按钮大小调整 */
    #imageUploadBtn,
    #sendBtn,
    #stopBtn {
        padding: 0.625rem;
    }

    #imageUploadBtn svg,
    #sendBtn svg,
    #stopBtn svg {
        width: 1.25rem;
        height: 1.25rem;
    }

    /* 图片预览 */
    .image-preview-item img {
        width: 60px;
        height: 60px;
    }

    /* 消息中的图片 */
    .message-images img {
        max-width: 150px;
        max-height: 150px;
    }

    /* 欢迎页面 */
    #welcomeScreen {
        padding: 1.5rem;
    }

    #welcomeScreen h2 {
        font-size: 1.5rem;
    }

    #welcomeScreen p {
        font-size: 0.875rem;
    }

    /* 快捷提示按钮 */
    .quick-prompt {
        padding: 0.75rem;
    }

    .quick-prompt .font-medium {
        font-size: 0.875rem;
    }

    .quick-prompt .text-sm {
        font-size: 0.75rem;
    }

    /* 弹窗 */
    #loginModal > div,
    #settingsModal > div {
        margin: 1rem;
        max-height: calc(100vh - 2rem);
    }

    /* 代码块 */
    .code-block .code-header {
        padding: 0.375rem 0.75rem;
    }

    .code-block pre {
        padding: 0.75rem;
        font-size: 0.75rem;
    }

    /* 状态栏 */
    #statusBar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    /* 模型信息栏 */
    #modelInfoBar {
        font-size: 0.625rem;
    }

    /* 消息错误操作按钮 */
    .message-error-actions .action-buttons {
        flex-direction: column;
    }

    .message-error-actions .retry-btn,
    .message-error-actions .edit-btn {
        width: 100%;
        justify-content: center;
    }

    /* 编辑框 */
    .edit-textarea {
        min-height: 60px;
        font-size: 0.875rem;
    }
}

/* 小屏手机 (< 480px) */
@media (max-width: 480px) {
    /* 顶部导航 */
    header {
        padding: 0.5rem 0.75rem;
    }

    header h1 {
        font-size: 1rem;
    }

    #modelSelect {
        max-width: 120px;
    }

    /* 设置按钮隐藏 */
    #settingsBtn {
        display: none;
    }

    /* 消息内容 */
    .message-content {
        max-width: 90%;
        font-size: 0.8125rem;
        line-height: 1.5;
        padding: 0.625rem 0.875rem;
    }

    /* 欢迎页面 */
    #welcomeScreen {
        padding: 1rem;
    }

    #welcomeScreen .w-20.h-20 {
        width: 4rem;
        height: 4rem;
    }

    #welcomeScreen .w-10.h-10 {
        width: 2rem;
        height: 2rem;
    }

    #welcomeScreen h2 {
        font-size: 1.25rem;
    }

    /* 快捷提示按钮改为单列 */
    .grid-cols-1.sm\:grid-cols-2 {
        grid-template-columns: 1fr;
    }

    /* 输入框 */
    #messageInput {
        padding: 0.625rem 0.875rem;
    }

    /* 功能选项隐藏提示文字 */
    .mt-3.flex.items-center.gap-4 label span:not(.text-xs) {
        font-size: 0.6875rem;
    }

    /* 代码块头部按钮 */
    .code-block .copy-btn {
        padding: 0.125rem 0.5rem;
        font-size: 0.625rem;
    }

    /* Markdown 内容 */
    .markdown-content h1 {
        font-size: 1.25rem;
    }

    .markdown-content h2 {
        font-size: 1.125rem;
    }

    .markdown-content h3 {
        font-size: 1rem;
    }

    .markdown-content pre {
        padding: 0.625rem;
        font-size: 0.6875rem;
    }

    .markdown-content table {
        font-size: 0.75rem;
    }

    .markdown-content th,
    .markdown-content td {
        padding: 0.375rem 0.5rem;
    }
}

/* 超小屏 (< 360px) */
@media (max-width: 360px) {
    /* 顶部导航进一步简化 */
    #modelSelect {
        max-width: 100px;
        font-size: 0.625rem;
        padding: 0.375rem 0.5rem;
    }

    /* 功能选项完全隐藏 */
    .mt-3.flex.items-center.gap-4 {
        display: none;
    }

    /* 消息头像更小 */
    .message-avatar {
        width: 28px;
        height: 28px;
    }
}

/* 横屏模式优化 */
@media (max-width: 768px) and (orientation: landscape) {
    /* 欢迎页面减少垂直间距 */
    #welcomeScreen {
        padding: 1rem;
    }

    #welcomeScreen .mb-6 {
        margin-bottom: 1rem;
    }

    #welcomeScreen .mb-8 {
        margin-bottom: 1rem;
    }

    /* 输入区域减少间距 */
    .bg-white.dark\:bg-gray-800.border-t {
        padding: 0.5rem;
    }

    /* 弹窗高度限制 */
    #loginModal > div,
    #settingsModal > div {
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    /* 增大触摸目标 */
    button,
    select,
    input[type="checkbox"] {
        min-height: 44px;
        min-width: 44px;
    }

    /* 输入框增大 */
    #messageInput {
        min-height: 44px;
    }

    /* 会话项增大触摸区域 */
    .session-item {
        min-height: 48px;
    }

    /* 移除 hover 效果，改为 active */
    .session-item:hover {
        background: transparent;
    }

    .session-item:active {
        background: #f3f4f6;
    }

    .dark .session-item:active {
        background: #374151;
    }

    /* 按钮按下效果 */
    button:active {
        transform: scale(0.97);
    }

    /* 快捷提示按钮 */
    .quick-prompt:active {
        transform: scale(0.98);
        border-color: #8b5cf6;
    }
}

/* iOS 特定优化 */
@supports (-webkit-touch-callout: none) {
    /* 安全区域适配 */
    body {
        padding-bottom: env(safe-area-inset-bottom);
    }

    /* 输入区域底部安全距离 */
    .bg-white.dark\:bg-gray-800.border-t {
        padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    }

    /* 防止iOS橡皮筋效果影响固定元素 */
    .fixed {
        position: -webkit-sticky;
    }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
    .message.user .message-content {
        border: 2px solid white;
    }

    .message.assistant .message-content {
        border: 2px solid currentColor;
    }

    .session-item.active {
        border: 2px solid #8b5cf6;
    }
}

/* 减少动画（用户偏好） */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==================== 移动端用户区域优化 ==================== */
@media (max-width: 640px) {
    /* 用户头像和名称 */
    #userArea .w-8.h-8 {
        width: 1.75rem;
        height: 1.75rem;
    }

    #userArea .text-sm {
        font-size: 0.75rem;
    }

    /* 退出按钮在移动端更紧凑 */
    #logoutBtn {
        font-size: 0.625rem;
        padding: 0.125rem 0.375rem;
    }
}

/* ==================== 移动端消息列表优化 ==================== */
@media (max-width: 640px) {
    /* 消息列表容器 */
    #messageList {
        padding: 0.75rem;
    }

    /* 消息间距 */
    #messageList.space-y-4 > :not([hidden]) ~ :not([hidden]) {
        margin-top: 0.75rem;
    }
}

/* ==================== 移动端会话列表优化 ==================== */
@media (max-width: 768px) {
    /* 侧边栏宽度 */
    #sidebar {
        width: 260px;
    }

    /* 会话项 */
    .session-item {
        padding: 0.625rem 0.75rem;
    }

    .session-item .session-title {
        font-size: 0.8125rem;
    }

    .session-item .session-time {
        font-size: 0.6875rem;
    }
}

/* ==================== 移动端输入提示优化 ==================== */
@media (max-width: 480px) {
    /* placeholder 文字缩短 */
    #messageInput::placeholder {
        font-size: 0.8125rem;
    }
}

/* ==================== 打印样式 ==================== */
@media print {
    /* 隐藏侧边栏 */
    #sidebar,
    #menuBtn,
    #overlay {
        display: none !important;
    }

    /* 隐藏输入区域 */
    .bg-white.dark\:bg-gray-800.border-t {
        display: none !important;
    }

    /* 消息内容正常显示 */
    .message-content {
        max-width: 100% !important;
        border-radius: 0 !important;
        background: white !important;
        color: black !important;
        box-shadow: none !important;
    }

    /* 显示消息头像 */
    .message-avatar {
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }
}