/* AI QingGongJu Plugin Styles - Modern Clean Design */

/* Trigger Button */
.ai-trigger-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: inherit;
    transition: transform 0.2s;
    padding: 0;
    margin-right: 10px;
}
.ai-trigger-btn:hover {
    transform: scale(1.1);
    color: #007bff;
}
.ai-trigger-btn svg {
    width: 24px;
    height: 24px;
}

/* Slide-out Panel - Card Style */
#ai-qinggongju-panel {
    position: fixed;
    top: 84px;
    bottom: 24px;
    right: -420px;
    width: 380px;
    max-width: 92vw;
    background: #ffffff;
    box-shadow: 0 12px 28px rgba(0,0,0,0.08);
    border-radius: 18px;
    z-index: 9999;
    transition: right 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

#ai-qinggongju-panel.active {
    right: 24px;
}

/* No Overlay - Allow interaction with background */
#ai-overlay {
    display: none !important;
}

/* Header */
.ai-header {
    display: grid;
    grid-template-columns: 40px 1fr 40px;
    align-items: center;
    padding: 12px 16px;
    background: #fff;
    border-bottom: 1px solid transparent;
}

.ai-header-spacer {
    width: 40px;
}

.ai-top-prompt {
    display: none; /* Hide for cleaner look as requested */
}

/* Mode Switch - Centered Pill Style */
.ai-mode-switch {
    display: flex;
    justify-content: center;
    background: #f3f4f6;
    border-radius: 20px;
    padding: 4px;
    width: fit-content;
    margin: 0 auto;
}

.ai-mode-btn {
    border: none;
    background: transparent;
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    color: #6b7280;
    border-radius: 16px;
    transition: all 0.2s ease;
}

.ai-mode-btn.active {
    background: #ffffff;
    color: #111827;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    font-weight: 600;
}

#ai-close-btn {
    border: none;
    background: transparent;
    font-size: 24px;
    cursor: pointer;
    color: #9ca3af;
    line-height: 1;
    padding: 0;
    justify-self: end;
    display: flex;
    align-items: center;
    justify-content: center;
}
#ai-close-btn:hover {
    color: #111827;
}

/* Body */
.ai-body {
    flex: 1;
    overflow-y: auto;
    padding: 0 20px 20px 20px;
    background: #fff;
    display: flex;
    flex-direction: column;
    scrollbar-width: thin;
    scrollbar-color: #e5e7eb transparent;
}

.ai-body::-webkit-scrollbar {
    width: 6px;
}
.ai-body::-webkit-scrollbar-track {
    background: transparent;
}
.ai-body::-webkit-scrollbar-thumb {
    background-color: #e5e7eb;
    border-radius: 20px;
}

/* Welcome Section (Assistant Mode) */
.ai-welcome-container {
    text-align: center;
    margin-top: 20px;
    margin-bottom: 30px;
    animation: fadeIn 0.5s ease;
}

.ai-welcome-avatar img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 15px;
    border: 2px solid #fff;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.ai-welcome-text h3 {
    margin: 0 0 5px 0;
    font-size: 20px;
    color: #333;
    font-weight: 600;
}

.ai-welcome-text p {
    margin: 0;
    font-size: 14px;
    color: #888;
}

/* Suggested Questions List - Clean List Style */
.ai-suggestions-list {
    display: flex;
    flex-direction: column;
    margin-top: 10px;
    background: #ffffff;
    border-radius: 16px;
    padding: 8px 0;
}

.ai-suggestion-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent;
    border: none;
    border-bottom: 1px solid #f3f4f6;
    border-radius: 0;
    padding: 16px 4px;
    cursor: pointer;
    transition: background 0.2s;
    text-align: left;
    width: 100%;
}

.ai-suggestion-item:last-child {
    border-bottom: none;
}

.ai-suggestion-item:hover {
    background: #f9fafb;
}

.ai-suggestion-icon {
    margin-right: 12px;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: #f3f4f6;
    border-radius: 6px;
    color: #4b5563;
}

.ai-suggestion-text {
    flex: 1;
    font-size: 14px;
    color: #374151;
    font-weight: 500;
}

.ai-suggestion-arrow {
    color: #9ca3af;
    display: flex;
    align-items: center;
}

/* Chat Messages */
.ai-messages {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-bottom: 20px;
}

.ai-message {
    display: flex;
    gap: 12px;
    max-width: 100%;
    animation: slideIn 0.3s ease;
}

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

.ai-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.ai-message.ai-bot .ai-avatar {
    background: #dbeafe;
    color: #2563eb;
}
.ai-message.ai-user .ai-avatar {
    background: #f3f4f6;
    color: #4b5563;
}

.ai-content {
    background: #f3f4f6;
    padding: 10px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    color: #1f2937;
    max-width: 85%;
    word-wrap: break-word;
}

.ai-message.ai-user .ai-content {
    background: #2563eb;
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.ai-message.ai-bot .ai-content {
    background: #f3f4f6;
    border-top-left-radius: 4px;
}

/* Loading Dot Animation */
.ai-loading-dots {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}
.ai-loading-dots span {
    width: 6px;
    height: 6px;
    background: #9ca3af;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}
.ai-loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.ai-loading-dots span:nth-child(2) { animation-delay: -0.16s; }

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* Footer & Input */
.ai-footer {
    padding: 16px;
    background: #fff;
    border-top: 1px solid #f3f4f6;
}

.ai-model-selector-wrapper {
    margin-bottom: 10px;
}

#ai-model-selector {
    width: 100%;
    padding: 6px 10px;
    font-size: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    color: #6b7280;
    background: #f9fafb;
    outline: none;
}

.ai-input-wrapper {
    position: relative;
    display: flex;
    align-items: flex-end;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 8px;
    transition: border-color 0.2s;
}

.ai-input-wrapper:focus-within {
    border-color: #d1d5db;
    background: #fff;
}

#ai-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 4px;
    font-size: 14px;
    color: #1f2937;
    resize: none;
    max-height: 140px;
    outline: none;
    line-height: 1.5;
}

#ai-send-btn {
    background: #2563eb;
    border: none;
    border-radius: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    margin-left: 8px;
    flex-shrink: 0;
    transition: background 0.2s;
}

#ai-send-btn:hover {
    background: #1d4ed8;
}

#ai-send-btn:disabled {
    background: #e5e7eb;
    cursor: not-allowed;
}

/* Responsive */
@media (max-width: 480px) {
    #ai-qinggongju-panel {
        width: 100%;
        max-width: 100vw;
        height: 100vh;
        top: 0;
        right: -100%;
        bottom: 0;
        border-radius: 0;
    }
    
    #ai-qinggongju-panel.active {
        right: 0;
    }
}
