/* AI 助手悬浮组件样式 */

/* 悬浮球容?*/
#ai-assistant {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* 悬浮球按?*/
#ai-float-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: float 3s ease-in-out infinite;
    position: relative;
    overflow: hidden;
}

/* 悬浮球内部光?*/
#ai-float-button::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
}

#ai-float-button:hover::before {
    opacity: 1;
}

#ai-float-button:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 32px rgba(102, 126, 234, 0.5);
}

#ai-float-button:active {
    transform: scale(0.95);
}

/* 悬浮动画 */
@keyframes float {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* AI 图标 */
#ai-float-button svg {
    width: 30px;
    height: 30px;
    fill: white;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

/* 聊天窗口 */
#ai-chat-window {
    position: fixed;
    bottom: 110px;
    right: 30px;
    width: 380px;
    height: 550px;
    border-radius: 20px;
    /* 毛玻璃效?*/
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15),
        0 0 1px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: bottom right;
}

#ai-chat-window.hidden {
    opacity: 0;
    transform: scale(0.8) translateY(20px);
    pointer-events: none;
}

#ai-chat-window.show {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: all;
}

/* 聊天窗口标题?*/
.chat-header {
    padding: 20px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.2);
}

.chat-header span {
}

.header-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}

#speed-button {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    text-decoration: none;
    padding: 0;
}

#speed-button:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}

#speed-button svg {
    width: 18px;
    height: 18px;
    fill: white;
}

.chat-header span {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

#close-chat {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 24px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    line-height: 1;
    padding: 0;
}

#close-chat:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* 消息区域 */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: rgba(248, 249, 250, 0.5);
}

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

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

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.3);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.5);
}

/* 消息气泡 */
.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    animation: messageSlideIn 0.3s ease-out;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 用户消息 */
.message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

/* AI 消息 */
.message.ai {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #2d3748;
    border: 1px solid rgba(102, 126, 234, 0.1);
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* 系统消息 */
.message.system {
    align-self: center;
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    font-size: 13px;
    padding: 8px 12px;
    border-radius: 12px;
    max-width: 90%;
    text-align: center;
}

/* 加载动画 */
.message.ai.loading {
    display: flex;
    gap: 6px;
    padding: 16px;
}

.loading-dots {
    display: flex;
    gap: 6px;
    align-items: center;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #667eea;
    animation: loadingDot 1.4s ease-in-out infinite;
}

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

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

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

@keyframes loadingDot {

    0%,
    60%,
    100% {
        transform: scale(0.8);
        opacity: 0.5;
    }

    30% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* 输入区域 */
.chat-input-area {
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid rgba(102, 126, 234, 0.1);
    display: flex;
    gap: 10px;
    border-radius: 0 0 20px 20px;
}

#chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 12px;
    font-size: 14px;
    color: #000000 !important;
    outline: none;
    transition: all 0.2s;
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

#chat-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background: rgba(255, 255, 255, 1) !important;
}

#chat-input::placeholder {
    color: #a0aec0;
}

#send-message {
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

#send-message:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

#send-message:active {
    transform: translateY(0);
}

#send-message:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* 响应式设?*/
@media (max-width: 768px) {
    #ai-chat-window {
        width: calc(100vw - 40px);
        height: calc(100vh - 140px);
        right: 20px;
        bottom: 100px;
    }

    #ai-float-button {
        width: 56px;
        height: 56px;
        bottom: 20px;
        right: 20px;
    }

    #ai-float-button svg {
        width: 28px;
        height: 28px;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    #ai-chat-window {
        background: rgba(30, 30, 40, 0.85);
        border-color: rgba(255, 255, 255, 0.1);
    }

    .chat-messages {
        background: rgba(20, 20, 30, 0.5);
    }

    .message.ai {
        background: rgba(50, 50, 60, 0.9);
        color: #e2e8f0;
        border-color: rgba(102, 126, 234, 0.2);
    }

    .chat-input-area {
        background: rgba(40, 40, 50, 0.9);
        border-top-color: rgba(102, 126, 234, 0.2);
    }

    #chat-input {
        background: rgba(50, 50, 60, 0.95) !important;
        color: #ffffff !important;
        border-color: rgba(102, 126, 234, 0.3);
    }

    #chat-input::placeholder {
        color: #718096;
    }
}
/* 密码验证界面样式 */
.password-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
}

.password-content {
    text-align: center;
    width: 100%;
    max-width: 300px;
}

.password-icon {
    font-size: 60px;
    margin-bottom: 20px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.password-content h3 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 20px;
}

.password-hint {
    color: #666;
    font-size: 14px;
    margin: 0 0 25px 0;
}

#password-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    text-align: center;
    letter-spacing: 2px;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

#password-input:focus {
    outline: none;
    border-color: #667eea;
}

.password-error {
    color: #f44336;
    font-size: 14px;
    margin: 10px 0 0 0;
    min-height: 20px;
}

.password-error.hidden {
    display: none;
}

.password-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn-primary, .btn-secondary {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f5f5f5;
    color: #666;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.chat-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.chat-panel.hidden {
    display: none;
}
/* 确保 hidden 类正确隐藏元素 */
.hidden {
    display: none !important;
}

/* 密码面板和聊天面板应该占据整个聊天窗口 */
.password-panel,
.chat-panel {
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
}
