/* 页面基础样式重置 */
    html, body {
        margin: 0;
        padding: 0;
        height: 100%;
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        min-height: 100vh;
    }

    /* 主容器 */
    .chat-container {
        display: flex;
        flex-direction: column;
        height: calc(100vh - 40px);
        max-height: 860px;
        width: 100%;
        max-width: 700px;
        margin: 20px auto;
        background: rgba(26, 26, 46, 0.95);
        border-radius: 20px;
        border: 1px solid rgba(59, 130, 246, 0.2);
        box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
        overflow: hidden;
        backdrop-filter: blur(10px);
        position: relative;
    }

    /* 头部 */
    .chat-header-bar {
        background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
        padding: 20px 25px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex-shrink: 0;
    }

    .ai-header-info {
        display: flex;
        align-items: center;
        gap: 15px;
    }

    .ai-header-avatar {
        width: 45px;
        height: 45px;
        border-radius: 50%;
        border: 2px solid rgba(255, 255, 255, 0.3);
    }

    .ai-header-info h3 {
        color: #fff;
        font-size: 18px;
        margin: 0 0 5px 0;
    }

    .ai-status-badge {
        background: rgba(16, 185, 129, 1);
        color: #fff;
        padding: 3px 10px;
        border-radius: 12px;
        font-size: 12px;
        font-weight: 500;
    }

    /* 消息区域 */
    .ai-chat-messages {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        padding: 25px;
        background: #0a0a0a;
    }

    .ai-chat-messages::-webkit-scrollbar {
        width: 8px;
    }

    .ai-chat-messages::-webkit-scrollbar-track {
        background: rgba(26, 26, 46, 0.3);
    }

    .ai-chat-messages::-webkit-scrollbar-thumb {
        background: rgba(59, 130, 246, 0.3);
        border-radius: 4px;
    }

    .ai-chat-messages::-webkit-scrollbar-thumb:hover {
        background: rgba(59, 130, 246, 0.5);
    }

    /* 消息样式 */
    .ai-message {
        display: flex;
        gap: 12px;
        margin-bottom: 24px;
        align-items: flex-start;
    }

    .ai-assistant-message {
        flex-direction: row;
    }

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

    .ai-message-avatar-small {
        width: 38px;
        height: 38px;
        border-radius: 50%;
        flex-shrink: 0;
        object-fit: cover;
    }

    .ai-message-bubble {
        max-width: 75%;
        min-width: 0;
        padding: 14px 18px;
        border-radius: 18px;
        line-height: 1.6;
        font-size: 15px;
        position: relative;
        color: #e5e5e5;
        overflow-wrap: break-word;
        word-break: break-word;
    }

    .ai-assistant-message .ai-message-bubble {
        background: rgba(26, 26, 46, 0.95);
        border: 1px solid rgba(59, 130, 246, 0.2);
        border-bottom-left-radius: 6px;
    }

    .ai-user-message .ai-message-bubble {
        background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
        color: white;
        border-bottom-right-radius: 6px;
    }

    .ai-message-bubble p {
        margin: 0 0 10px;
    }

    .ai-message-bubble p:last-child {
        margin: 0;
    }

    .ai-feature-tags {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin: 12px 0;
    }

    .ai-feature-tag {
        padding: 6px 14px;
        background: rgba(59, 130, 246, 0.2);
        color: #60a5fa;
        border-radius: 20px;
        font-size: 13px;
        font-weight: 500;
        border: 1px solid rgba(59, 130, 246, 0.3);
    }

    .ai-user-message .ai-feature-tag {
        background: rgba(255, 255, 255, 0.2);
        color: rgba(255, 255, 255, 0.95);
        border-color: rgba(255, 255, 255, 0.3);
    }

    /* Markdown 样式 */
    .ai-message-bubble h1,
    .ai-message-bubble h2,
    .ai-message-bubble h3 {
        margin: 14px 0 10px;
        font-weight: 600;
        line-height: 1.4;
    }

    .ai-message-bubble h1 { font-size: 1.5em; color: #fff; }
    .ai-message-bubble h2 { font-size: 1.3em; color: #fff; }
    .ai-message-bubble h3 { font-size: 1.1em; color: #e5e5e5; }

    .ai-message-bubble table {
        width: 100%;
        max-width: 100%;
        table-layout: fixed;
        border-collapse: collapse;
        margin: 14px 0;
        font-size: 13px;
        background: rgba(26, 26, 46, 0.8);
        border-radius: 10px;
        border: 1px solid rgba(59, 130, 246, 0.2);
    }

    .ai-message-bubble table th,
    .ai-message-bubble table td {
        border-bottom: 1px solid rgba(59, 130, 246, 0.2);
        padding: 8px 12px;
        text-align: left;
        color: #e5e5e5;
        word-break: break-word;
        overflow-wrap: break-word;
    }

    .ai-message-bubble table th {
        background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
        font-weight: 600;
        color: #fff;
    }

    .ai-message-bubble table tr:last-child td {
        border-bottom: none;
    }

    .ai-message-bubble table tr:hover td {
        background: rgba(59, 130, 246, 0.1);
    }

    .ai-message-bubble code {
        background: rgba(59, 130, 246, 0.2);
        padding: 3px 8px;
        border-radius: 6px;
        font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
        font-size: 0.85em;
        color: #60a5fa;
    }

    .ai-user-message code {
        background: rgba(255, 255, 255, 0.2);
        color: rgba(255, 255, 255, 0.95);
    }

    .ai-message-bubble pre {
        background: #1a1a2e;
        padding: 14px;
        border-radius: 10px;
        overflow-x: auto;
        margin: 12px 0;
        border: 1px solid rgba(59, 130, 246, 0.2);
    }

    .ai-message-bubble pre code {
        background: none;
        padding: 0;
        color: #e5e7eb;
        font-size: 0.9em;
    }

    .ai-message-bubble blockquote {
        border-left: 4px solid #3b82f6;
        padding-left: 14px;
        margin: 12px 0;
        color: #a0aec0;
        font-style: italic;
    }

    .ai-message-bubble hr {
        border: none;
        border-top: 1px solid rgba(59, 130, 246, 0.2);
        margin: 16px 0;
    }

    .ai-message-bubble strong {
        font-weight: 600;
        color: #fff;
    }
    
    /* 控制图片大小，特别是微信二维码 */
    .ai-message-bubble img {
        max-width: 50%;
        max-height: 50%;
        width: auto;
        height: auto;
    }

    /* 加载动画 */
    .typing-indicator {
        display: inline-flex;
        gap: 5px;
        padding: 8px 0;
    }

    .typing-indicator span {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: #3b82f6;
        animation: bounce 1.4s ease-in-out infinite both;
    }

    .typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
    .typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

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

    /* 输入区域 */
    .ai-chat-input-area {
        padding: 20px 25px;
        background: #1a1a2e;
        border-top: 1px solid rgba(59, 130, 246, 0.2);
        flex-shrink: 0;
    }

    .ai-chat-input-wrapper {
        display: flex;
        gap: 10px;
        background: #0a0a0a;
        border-radius: 25px;
        padding: 8px 8px 8px 20px;
        border: 1px solid rgba(59, 130, 246, 0.3);
        transition: border-color 0.3s;
    }

    .ai-chat-input-wrapper:focus-within {
        border-color: #3b82f6;
    }

    .ai-chat-input-wrapper textarea {
        flex: 1;
        border: none;
        background: transparent;
        color: #fff;
        font-size: 15px;
        resize: none;
        outline: none;
        padding: 8px 0;
        line-height: 1.5;
    }

    .ai-chat-input-wrapper textarea::placeholder {
        color: #6b7280;
    }

    .ai-send-button {
        width: 45px;
        height: 45px;
        background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
        border: none;
        border-radius: 50%;
        color: #fff;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.3s;
        flex-shrink: 0;
    }

    .ai-send-button:hover {
        background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
        transform: scale(1.05);
    }

    .ai-send-button i {
        font-size: 18px;
    }

    .ai-input-hint-text {
        text-align: center;
        font-size: 12px;
        color: #6b7280;
        margin-top: 10px;
    }

    /* 响应式设计 */
    @media (max-width: 768px) {
        /* 重置html和body，确保移动端全屏 */
        html, body {
            min-height: 100vh;
            min-height: 100dvh;
            height: 100%;
            height: 100dvh;
            overflow: hidden;
            position: relative;
        }

        /* 隐藏base.html的header和footer */
        .header,
        .search-bar,
        footer {
            display: none !important;
        }

        .chat-container {
            border-radius: 0;
            max-width: 100%;
            width: 100%;
            height: 100%;
            height: 100dvh;
            margin: 0;
            padding-top: 0;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            display: flex;
            flex-direction: column;
        }

        .chat-header-bar {
            padding: 12px 16px;
            flex-shrink: 0;
        }

        .ai-header-info h3 {
            font-size: 16px;
        }

        .ai-header-avatar {
            width: 40px;
            height: 40px;
        }

        /* 消息区域可滚动，输入框固定在底部 */
        .ai-chat-messages {
            flex: 1;
            min-height: 0;
            height: auto;
            padding: 16px;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
            overscroll-behavior: contain;
        }

        .ai-message-bubble {
            max-width: 88%;
            font-size: 14px;
            padding: 12px 16px;
        }

        .ai-message-avatar-small {
            width: 32px;
            height: 32px;
        }

        .ai-message {
            margin-bottom: 16px;
        }

        /* 输入区域固定在底部 */
        .ai-chat-input-area {
            padding: 12px 16px;
            padding-bottom: max(12px, env(safe-area-inset-bottom));
            flex-shrink: 0;
            background: #1a1a2e;
            position: sticky;
            bottom: 0;
        }

        .ai-chat-input-wrapper {
            padding: 6px 6px 6px 16px;
        }

        .ai-chat-input-wrapper textarea {
            font-size: 16px;
        }

        .ai-send-button {
            width: 40px;
            height: 40px;
        }

        .ai-input-hint-text {
            display: none;
        }
    }