/**
 * 神马主题 - AI 聊天助手样式
 * 
 * @package Onenavsub
 */

/* ============================================
 * 浮动按钮
 * ============================================ */
.snc-chat-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    z-index: 9999;
}

.snc-chat-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 28px rgba(102, 126, 234, 0.5);
}

.snc-chat-fab.active {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.snc-chat-icon {
    width: 28px;
    height: 28px;
    fill: #fff;
}

#footer-tools .snc-chat-fab {
    position: relative;
    right: auto;
    bottom: auto;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    color: var(--muted-color2);
    background: var(--muted-blur-bg-color);
    border-radius: var(--main-radius);
    box-shadow: none;
}

#footer-tools .snc-chat-fab:hover {
    color: var(--main-color);
    background: var(--muted-bg-color);
    transform: none;
    box-shadow: none;
}

#footer-tools .snc-chat-fab.active {
    color: var(--theme-color);
    background: var(--theme-color-bg);
}

#footer-tools .snc-chat-icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

#footer-tools + .snc-chat-window,
.snc-chat-window {
    right: 70px;
}

/* ============================================
 * 聊天窗口
 * ============================================ */
.snc-chat-window {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 380px;
    height: 520px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    animation: snc-chat-slide-in 0.3s ease;
}

@keyframes snc-chat-slide-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
 * 头部
 * ============================================ */
.snc-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.snc-chat-title {
    font-size: 16px;
    font-weight: 600;
}

.snc-chat-controls {
    display: flex;
    gap: 8px;
}

.snc-chat-btn-icon {
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background 0.2s;
}

.snc-chat-btn-icon:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ============================================
 * 模式切换
 * ============================================ */
.snc-chat-modes {
    display: flex;
    padding: 12px 16px;
    gap: 8px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
}

.snc-chat-mode-btn {
    flex: 1;
    padding: 8px 16px;
    border: none;
    background: #fff;
    color: #666;
    font-size: 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.snc-chat-mode-btn:hover {
    color: #667eea;
}

.snc-chat-mode-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-weight: 500;
}

/* ============================================
 * 消息区域
 * ============================================ */
.snc-chat-body {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: #f5f7fa;
}

.snc-chat-message {
    margin-bottom: 12px;
    display: flex;
}

.snc-chat-message.snc-chat-user {
    justify-content: flex-end;
}

.snc-chat-message.snc-chat-ai {
    justify-content: flex-start;
}

.snc-chat-message .snc-chat-content {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.6;
    word-break: break-word;
}

.snc-chat-user .snc-chat-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.snc-chat-ai .snc-chat-content {
    background: #fff;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.snc-chat-login-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 104px;
    height: 38px;
    margin-top: 10px;
    padding: 0 18px;
    color: #fff !important;
    background: #5c6ee6;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none !important;
}

.snc-chat-login-btn:hover {
    color: #fff !important;
    background: #485bd3;
}

/* Markdown 样式 */
.snc-chat-content p {
    margin: 0 0 8px;
}

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

.snc-chat-content code {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
}

.snc-chat-content pre {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
}

.snc-chat-content pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.snc-chat-content a {
    color: #667eea;
}

/* 加载动画 */
.snc-chat-loading {
    color: #999;
    font-style: italic;
}

.snc-chat-loading::after {
    content: '';
    animation: snc-dots 1.5s infinite;
}

@keyframes snc-dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* ============================================
 * 搜索结果卡片
 * ============================================ */
.snc-chat-search-results {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.snc-tool-card {
    display: flex;
    align-items: center;
    padding: 12px;
    background: #fff;
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.2s;
}

.snc-tool-card:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.snc-tool-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: contain;
    flex-shrink: 0;
}

.snc-tool-info {
    flex: 1;
    margin-left: 12px;
    min-width: 0;
}

.snc-tool-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.snc-tool-category {
    display: inline-block;
    font-size: 11px;
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    margin-bottom: 4px;
}

.snc-tool-desc {
    font-size: 12px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.snc-tool-arrow {
    width: 20px;
    height: 20px;
    fill: #ccc;
    flex-shrink: 0;
}

/* ============================================
 * 输入区域
 * ============================================ */
.snc-chat-footer {
    padding: 12px 16px;
    background: #fff;
    border-top: 1px solid #eee;
}

.snc-chat-input-wrap {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.snc-chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    max-height: 120px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.snc-chat-input:focus {
    outline: none;
    border-color: #667eea;
}

.snc-chat-btn-send {
    width: 40px;
    height: 40px;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.snc-chat-btn-send:hover {
    transform: scale(1.05);
}

.snc-chat-btn-send:disabled,
.snc-chat-input:disabled {
    cursor: not-allowed;
    opacity: .55;
}

.snc-chat-btn-send svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.snc-chat-btn-clear {
    width: 100%;
    margin-top: 8px;
    padding: 6px;
    border: none;
    background: none;
    color: #999;
    font-size: 12px;
    cursor: pointer;
    transition: color 0.2s;
}

.snc-chat-btn-clear:hover {
    color: #f5576c;
}

.snc-chat-quota {
    color: #a0a4ad;
    font-size: 11px;
    line-height: 1.4;
    text-align: center;
}

/* ============================================
 * 响应式
 * ============================================ */
@media (max-width: 480px) {
    .snc-chat-window {
        width: calc(100vw - 32px);
        height: calc(100vh - 120px);
        bottom: 80px;
        right: 16px;
        left: 16px;
        border-radius: 12px;
    }
    
    .snc-chat-fab {
        bottom: 16px;
        right: 16px;
    }
}
