/* ========== AI小助手 组件样式（毛玻璃适配） ========== */

/* 触发按钮样式 */
.ai-trigger-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid #dde4f5;
    background: #ffffff;
    color: #4a6cf7;
    transition: all 0.2s;
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

    .ai-trigger-btn:hover {
        background: #f8faff;
        border-color: #4a6cf7;
    }

/* 对话框 */
.ai-chat-overlay {
    position: fixed;
    right: 24px;
    bottom: 80px;
    width: 380px;
    height: 520px;
    background: #ffffff;
    border: 1px solid #e8ecf2;
    border-radius: 14px;
    display: none;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    z-index: 10001;
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

    .ai-chat-overlay.show {
        display: flex;
        animation: chatSlideIn 0.3s ease;
    }

@keyframes chatSlideIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 头部 */
.ai-chat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid #f0f2f5;
    background: #fafbfc;
}

.ai-chat-avatar svg {
    width: 32px;
    height: 32px;
    display: block;
}

.ai-chat-header-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.ai-chat-name {
    font-size: 14px;
    font-weight: 600;
    color: #1a202c;
}

.ai-chat-status {
    font-size: 11px;
    color: #00a854;
    display: flex;
    align-items: center;
    gap: 4px;
}

    .ai-chat-status::before {
        content: '';
        width: 6px;
        height: 6px;
        background: #00a854;
        border-radius: 50%;
        animation: statusPulse 2s infinite;
    }

@keyframes statusPulse {
    0%, 100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

.ai-chat-close {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: #8899aa;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

    .ai-chat-close:hover {
        background: #f0f2f5;
        color: #ef4444;
    }

/* 消息区域 */
.ai-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: #fafbfc;
}

    .ai-chat-body::-webkit-scrollbar {
        width: 3px;
    }

    .ai-chat-body::-webkit-scrollbar-thumb {
        background: #dde3ea;
        border-radius: 3px;
    }

/* 日期分隔线 */
.ai-date-divider {
    text-align: center;
    font-size: 11px;
    color: #a0aec0;
    padding: 8px 0 4px;
    user-select: none;
}

.ai-message {
    max-width: 88%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.6;
    animation: msgFadeIn 0.35s ease;
    word-break: break-word;
    position: relative;
}

    .ai-message .msg-time {
        font-size: 10px;
        color: #a0aec0;
        margin-top: 4px;
        text-align: right;
    }

@keyframes msgFadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-message-system {
    align-self: flex-start;
    background: #eef2ff;
    border: 1px solid #dde4f5;
    color: #4a5568;
    max-width: 100%;
}

.ai-message-ai {
    align-self: flex-start;
    background: #ffffff;
    border: 1px solid #eef1f5;
    color: #2d3748;
}

.ai-message-user {
    align-self: flex-end;
    background: linear-gradient(135deg, #4a6cf7, #5b7df9);
    color: #ffffff;
}

/* AI思考中 */
.ai-message-thinking {
    align-self: flex-start;
    background: #ffffff;
    border: 1px solid #eef1f5;
    color: #8899aa;
    font-size: 12px;
    padding: 10px 14px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: msgFadeIn 0.35s ease;
}

.ai-thinking-dot {
    width: 6px;
    height: 6px;
    background: #c0c8d4;
    border-radius: 50%;
    animation: dotBounce 1.4s infinite;
}

    .ai-thinking-dot:nth-child(2) {
        animation-delay: 0.2s;
    }

    .ai-thinking-dot:nth-child(3) {
        animation-delay: 0.4s;
    }

@keyframes dotBounce {
    0%, 80%, 100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-4px);
    }
}

/* 快捷指令 */
.ai-quick-commands {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.ai-quick-cmd {
    padding: 5px 12px;
    border-radius: 6px;
    background: #ffffff;
    border: 1px solid #dde4f5;
    color: #4a6cf7;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

    .ai-quick-cmd:hover {
        background: #eef2ff;
        border-color: #4a6cf7;
    }

/* 底部输入 */
.ai-chat-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-top: 1px solid #f0f2f5;
    background: #ffffff;
}

.ai-chat-input {
    flex: 1;
    background: #f5f7fa;
    border: 1px solid #e8ecf2;
    border-radius: 8px;
    padding: 9px 12px;
    color: #2d3748;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

    .ai-chat-input::placeholder {
        color: #a0aec0;
    }

    .ai-chat-input:focus {
        border-color: #4a6cf7;
        background: #ffffff;
    }

.ai-chat-send {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #4a6cf7;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    transition: all 0.2s;
    flex-shrink: 0;
}

    .ai-chat-send:hover {
        background: #3651d5;
    }

    .ai-chat-send:disabled {
        opacity: 0.4;
        cursor: not-allowed;
    }

/* 底部工具栏 */
.ai-chat-toolbar {
    display: flex;
    justify-content: flex-end;
    padding: 0 14px 8px;
    background: #ffffff;
}

.ai-chat-clear {
    font-size: 11px;
    color: #a0aec0;
    cursor: pointer;
    background: none;
    border: none;
    font-family: inherit;
    padding: 2px 6px;
}

    .ai-chat-clear:hover {
        color: #ef4444;
    }

@media (max-width: 480px) {
    .ai-chat-overlay {
        width: calc(100vw - 40px);
        right: 20px;
        height: 460px;
    }
}

/* ========== 深色主题毛玻璃适配 ========== */
body.dark-theme .ai-trigger-btn {
    background: rgba(20, 30, 50, 0.6);
    backdrop-filter: blur(10px);
    border-color: rgba(72, 187, 255, 0.25);
    color: #60a5fa;
}

    body.dark-theme .ai-trigger-btn:hover {
        background: rgba(30, 45, 70, 0.75);
        border-color: rgba(72, 187, 255, 0.5);
    }

body.dark-theme .ai-chat-overlay {
    background: rgba(15, 25, 45, 0.75);
    backdrop-filter: blur(20px);
    border-color: rgba(72, 187, 255, 0.2);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

body.dark-theme .ai-chat-header {
    background: rgba(10, 20, 35, 0.5);
    backdrop-filter: blur(10px);
    border-bottom-color: rgba(72, 187, 255, 0.1);
}

body.dark-theme .ai-chat-name {
    color: #eef5ff;
}

body.dark-theme .ai-chat-close {
    color: #6b7fa0;
}

    body.dark-theme .ai-chat-close:hover {
        background: rgba(255,255,255,0.08);
        color: #ef4444;
    }

body.dark-theme .ai-chat-body {
    background: rgba(10, 20, 35, 0.3);
}

    body.dark-theme .ai-chat-body::-webkit-scrollbar-thumb {
        background: rgba(72,187,255,0.15);
    }

body.dark-theme .ai-message-system {
    background: rgba(59,130,246,0.15);
    backdrop-filter: blur(6px);
    border-color: rgba(59,130,246,0.2);
    color: #b0c4f0;
}

body.dark-theme .ai-message-ai {
    background: rgba(255,255,255,0.06);
    backdrop-filter: blur(6px);
    border-color: rgba(255,255,255,0.06);
    color: #e0e0e0;
}

body.dark-theme .ai-message-user .msg-time {
    color: rgba(255,255,255,0.6);
}

body.dark-theme .ai-message-thinking {
    background: rgba(255,255,255,0.04);
    backdrop-filter: blur(6px);
    border-color: rgba(255,255,255,0.04);
    color: #8899aa;
}

body.dark-theme .ai-thinking-dot {
    background: #6b7fa0;
}

body.dark-theme .ai-quick-cmd {
    background: rgba(59,130,246,0.12);
    backdrop-filter: blur(4px);
    border-color: rgba(59,130,246,0.2);
    color: #60a5fa;
}

    body.dark-theme .ai-quick-cmd:hover {
        background: rgba(59,130,246,0.25);
        border-color: #3b82f6;
        color: #fff;
    }

body.dark-theme .ai-chat-footer {
    background: rgba(10,20,35,0.5);
    backdrop-filter: blur(10px);
    border-top-color: rgba(72,187,255,0.1);
}

body.dark-theme .ai-chat-input {
    background: rgba(10,20,35,0.5);
    border-color: rgba(72,187,255,0.2);
    color: #eef5ff;
}

    body.dark-theme .ai-chat-input::placeholder {
        color: #6b7fa0;
    }

    body.dark-theme .ai-chat-input:focus {
        border-color: #3b82f6;
        background: rgba(10,20,35,0.7);
    }

body.dark-theme .ai-chat-toolbar {
    background: rgba(10,20,35,0.5);
}

body.dark-theme .ai-chat-clear {
    color: #6b7fa0;
}

    body.dark-theme .ai-chat-clear:hover {
        color: #ef4444;
    }

body.dark-theme .ai-date-divider {
    color: #6b7fa0;
}

/* ========== 银灰主题毛玻璃适配 ========== */
body.silver-theme .ai-trigger-btn {
    background: rgba(245,248,250,0.6);
    backdrop-filter: blur(10px);
    border-color: rgba(100,120,140,0.3);
    color: #4a6cf7;
}

    body.silver-theme .ai-trigger-btn:hover {
        background: rgba(255,255,255,0.75);
        border-color: #4a6cf7;
    }

body.silver-theme .ai-chat-overlay {
    background: rgba(245,248,250,0.75);
    backdrop-filter: blur(20px);
    border-color: rgba(100,120,140,0.2);
    box-shadow: 0 8px 32px rgba(0,0,0,0.08);
}

body.silver-theme .ai-chat-header {
    background: rgba(235,240,245,0.5);
    backdrop-filter: blur(10px);
    border-bottom-color: rgba(100,120,140,0.1);
}

body.silver-theme .ai-chat-name {
    color: #1e2a3a;
}

body.silver-theme .ai-chat-close {
    color: #5a6e7c;
}

    body.silver-theme .ai-chat-close:hover {
        background: rgba(100,120,140,0.1);
        color: #ef4444;
    }

body.silver-theme .ai-chat-body {
    background: rgba(235,240,245,0.3);
}

    body.silver-theme .ai-chat-body::-webkit-scrollbar-thumb {
        background: rgba(100,120,140,0.2);
    }

body.silver-theme .ai-message-system {
    background: rgba(74,108,247,0.08);
    backdrop-filter: blur(6px);
    border-color: rgba(74,108,247,0.12);
    color: #3a4a5a;
}

body.silver-theme .ai-message-ai {
    background: rgba(255,255,255,0.6);
    backdrop-filter: blur(6px);
    border-color: rgba(100,120,140,0.08);
    color: #1e2a3a;
}

body.silver-theme .ai-message-thinking {
    background: rgba(255,255,255,0.6);
    backdrop-filter: blur(6px);
    border-color: rgba(100,120,140,0.08);
    color: #6a7a8a;
}

body.silver-theme .ai-thinking-dot {
    background: #a0b0c0;
}

body.silver-theme .ai-quick-cmd {
    background: rgba(255,255,255,0.6);
    backdrop-filter: blur(4px);
    border-color: rgba(100,120,140,0.25);
    color: #4a6cf7;
}

    body.silver-theme .ai-quick-cmd:hover {
        background: #eef2ff;
        border-color: #4a6cf7;
    }

body.silver-theme .ai-chat-footer {
    background: rgba(235,240,245,0.5);
    backdrop-filter: blur(10px);
    border-top-color: rgba(100,120,140,0.1);
}

body.silver-theme .ai-chat-input {
    background: rgba(255,255,255,0.6);
    border-color: rgba(100,120,140,0.3);
    color: #1e2a3a;
}

    body.silver-theme .ai-chat-input::placeholder {
        color: #8a9aaa;
    }

    body.silver-theme .ai-chat-input:focus {
        border-color: #4a6cf7;
        background: rgba(255,255,255,0.9);
    }

body.silver-theme .ai-chat-toolbar {
    background: rgba(235,240,245,0.5);
}

body.silver-theme .ai-chat-clear {
    color: #8a9aaa;
}

    body.silver-theme .ai-chat-clear:hover {
        color: #ef4444;
    }

body.silver-theme .ai-date-divider {
    color: #8a9aaa;
}
