.ai-chat-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.ai-message-wrapper {
    display: flex;
    margin: 12px 0;
    animation: fadeInUp 0.3s ease-out;
}

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

.ai-message-wrapper.user {
    justify-content: flex-end;
}

.ai-message-wrapper.assistant {
    justify-content: flex-start;
}

.ai-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    margin-right: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    user-select: none;
}

.ai-avatar.user-avatar {
    background: linear-gradient(135deg, #1976d2 0%, #00c9a7 100%);
    margin-right: 0;
    margin-left: 10px;
}

.ai-message-content {
    max-width: 85%;
    line-height: 1.6;
}

.ai-user-bubble {
    background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%);
    color: #fff;
    padding: 10px 14px;
    border-radius: 16px 16px 4px 16px;
    font-size: 13px;
    word-break: break-word;
    box-shadow: 0 2px 12px rgba(25, 118, 210, 0.25);
}

.ai-assistant-bubble {
    background: #fff;
    padding: 14px 16px;
    border-radius: 4px 16px 16px 16px;
    font-size: 13px;
    color: #1a1a2e;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.05);
    user-select: text;
}

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

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

.ai-assistant-bubble ul, .ai-assistant-bubble ol {
    margin: 6px 0;
    padding-left: 18px;
}

.ai-assistant-bubble li {
    margin: 3px 0;
}

.ai-assistant-bubble code {
    background: #f5f5f7;
    padding: 2px 5px;
    border-radius: 4px;
    font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
    font-size: 12px;
    color: #e83e8c;
}

.ai-assistant-bubble pre {
    background: #1e1e2e;
    color: #cdd6f4;
    padding: 12px;
    border-radius: 10px;
    overflow-x: auto;
    margin: 10px 0;
    position: relative;
}

.ai-assistant-bubble pre code {
    background: transparent;
    color: inherit;
    padding: 0;
    font-size: 12px;
    line-height: 1.5;
}

.ai-code-copy-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #cdd6f4;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.2s;
}

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

.ai-code-copy-btn.copied {
    background: #10b981;
    color: #fff;
}

.ai-deep-think-block {
    margin-bottom: 10px;
    border-radius: 10px;
    overflow: hidden;
    background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.ai-deep-think-header {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
    background: linear-gradient(90deg, rgba(139, 92, 246, 0.1) 0%, rgba(167, 139, 250, 0.05) 100%);
}

.ai-deep-think-header:hover {
    background: linear-gradient(90deg, rgba(139, 92, 246, 0.15) 0%, rgba(167, 139, 250, 0.1) 100%);
}

.ai-think-icon {
    width: 16px;
    height: 16px;
    margin-right: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-think-icon svg {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.ai-think-title {
    font-size: 12px;
    font-weight: 600;
    color: #7c3aed;
    display: flex;
    align-items: center;
    gap: 4px;
}

.ai-think-arrow {
    margin-left: auto;
    transition: transform 0.3s ease;
    color: #7c3aed;
    font-size: 10px;
}

.ai-think-arrow.expanded {
    transform: rotate(180deg);
}

.ai-deep-think-content {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.5;
    border-top: 1px dashed rgba(139, 92, 246, 0.3);
    background: rgba(255, 255, 255, 0.5);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    user-select: text;
}

.ai-deep-think-content.expanded {
    max-height: 500px;
    padding: 10px 12px;
}

.ai-deep-think-content.collapsed {
    max-height: 0;
    padding: 0 12px;
}

.ai-place-link {
    color: #1976d2;
    text-decoration: none;
    border-bottom: 1px dashed #1976d2;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-place-link:hover {
    color: #1565c0;
    border-bottom-color: #1565c0;
    background: rgba(25, 118, 210, 0.05);
}

.ai-options-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.ai-option-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #6b7280;
    cursor: pointer;
    padding: 3px 8px;
    border-radius: 12px;
    background: #f3f4f6;
    transition: all 0.2s;
    user-select: none;
}

.ai-option-item:hover {
    background: #e5e7eb;
}

.ai-option-item.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.ai-option-item input {
    display: none;
}

.ai-toggle-switch {
    width: 28px;
    height: 16px;
    background: #d1d5db;
    border-radius: 8px;
    position: relative;
    transition: background 0.3s;
}

.ai-option-item.active .ai-toggle-switch {
    background: rgba(255, 255, 255, 0.3);
}

.ai-toggle-switch::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.3s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.ai-option-item.active .ai-toggle-switch::after {
    transform: translateX(12px);
}

.ai-input-area {
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    padding: 10px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.ai-input-area:focus-within {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.ai-input-textarea {
    width: 100%;
    min-height: 48px;
    max-height: 120px;
    border: none;
    outline: none;
    resize: none;
    font-size: 13px;
    line-height: 1.5;
    font-family: inherit;
    background: transparent;
}

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

.ai-input-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid #f3f4f6;
}

.ai-send-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #1976d2 0%, #00c9a7 100%);
    color: #fff;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(25, 118, 210, 0.3);
}

.ai-send-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(25, 118, 210, 0.4);
}

.ai-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ai-send-btn.sending {
    background: #9ca3af;
}

.ai-welcome-message {
    text-align: center;
    padding: 30px 16px;
}

.ai-welcome-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.3);
}

.ai-welcome-title {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 6px;
}

.ai-welcome-desc {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.5;
}

.ai-suggestion-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin-top: 16px;
}

.ai-suggestion-chip {
    padding: 6px 12px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    font-size: 12px;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-suggestion-chip:hover {
    background: #e5e7eb;
    border-color: #d1d5db;
    transform: translateY(-1px);
}

.ai-main-reply {
    font-size: 13px;
    line-height: 1.6;
    color: #1a1a2e;
    user-select: text;
}

.ai-main-reply h1, .ai-main-reply h2, .ai-main-reply h3 {
    margin: 12px 0 6px 0;
    font-weight: 600;
    color: #1a1a2e;
}

.ai-main-reply h1 { font-size: 16px; }
.ai-main-reply h2 { font-size: 14px; }
.ai-main-reply h3 { font-size: 13px; }

.ai-main-reply strong {
    font-weight: 600;
    color: #111827;
}

.ai-main-reply a {
    color: #1976d2;
    text-decoration: none;
}

.ai-main-reply a:hover {
    text-decoration: underline;
}

.ai-main-reply blockquote {
    margin: 10px 0;
    padding: 6px 12px;
    border-left: 3px solid #667eea;
    background: #f9fafb;
    border-radius: 0 6px 6px 0;
    color: #4b5563;
}

.ai-main-reply hr {
    margin: 12px 0;
    border: none;
    border-top: 1px solid #e5e7eb;
}

.ai-main-reply table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    font-size: 12px;
}

.ai-main-reply th, .ai-main-reply td {
    padding: 6px 10px;
    border: 1px solid #e5e7eb;
    text-align: left;
}

.ai-main-reply th {
    background: #f9fafb;
    font-weight: 600;
}

.ai-streaming-cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background: #667eea;
    margin-left: 2px;
    animation: blink 1s infinite;
    vertical-align: text-bottom;
}

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

.ai-chat-window {
    scrollbar-width: thin;
    scrollbar-color: #d1d5db transparent;
}

.ai-chat-window::-webkit-scrollbar {
    width: 5px;
}

.ai-chat-window::-webkit-scrollbar-track {
    background: transparent;
}

.ai-chat-window::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.ai-chat-window::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}
