
/* --- AI Assistant Panel --- */
.ai-btn {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border: none;
    padding: 4px 12px;
    font-size: 0.85rem;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.3);
    transition: all 0.3s ease;
}

.ai-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(99, 102, 241, 0.4);
}

/* ==========================================================================
   AI Panel Styles
   ========================================================================== */
.ai-panel {
    position: fixed;
    top: 0;
    right: -350px;
    width: 350px;
    height: 100vh;
    background: white;
    box-shadow: -5px 0 25px rgba(0,0,0,0.1);
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.ai-panel.open {
    right: 0;
}

.ai-header {
    padding: 20px;
    border-bottom: 1px solid #eaeaea;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
}

.ai-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-header h3 i {
    color: #8b5cf6;
}

.ai-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.ai-section {
    margin-bottom: 25px;
}

.ai-section h4 {
    margin: 0 0 10px 0;
    font-size: 0.9rem;
    color: #4b5563;
    display: flex;
    align-items: center;
    gap: 6px;
}

.diagnosis-box {
    background: #f9fafb;
    border-radius: 8px;
    padding: 12px;
    font-size: 0.9rem;
    color: #374151;
    border: 1px solid #f3f4f6;
}

.diagnosis-item {
    margin-bottom: 8px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.diagnosis-item:last-child { margin-bottom: 0; }

.diagnosis-item.good i { color: #10b981; }
.diagnosis-item.warning i { color: #f59e0b; margin-top: 2px;}
.diagnosis-item.info i { color: #3b82f6; margin-top: 2px;}

.ai-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ai-actions .btn {
    justify-content: flex-start;
    text-align: left;
    padding: 10px 16px;
    background: white;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    transition: all 0.2s;
}

.ai-actions .btn:hover {
    border-color: var(--primary-color);
    background: #f8fafc;
    color: var(--primary-color);
}

.recommendation-box {
    background: #fdfeef;
    border: 1px dashed #fde047;
    border-radius: 8px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.tag-btn {
    background: #fef08a;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #854d0e;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tag-btn:hover {
    background: #fde047;
    transform: scale(1.05);
}

.ai-footer {
    padding: 20px;
    border-top: 1px solid #eaeaea;
    background: white;
}

/* --- AI Image Container & Actions --- */
.qwen-image-container {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.qwen-image-container:hover .image-action-overlay {
    opacity: 1;
}

.image-action-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10;
    backdrop-filter: blur(2px);
}

.image-action-overlay .btn {
    min-width: 120px;
    padding: 8px 16px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 6px;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-regenerate {
    background: #4f46e5;
    color: white;
}

.btn-regenerate:hover {
    background: #4338ca;
    transform: scale(1.05);
}

.btn-edit-prompt {
    background: white;
    color: #1f2937;
}

.btn-edit-prompt:hover {
    background: #f3f4f6;
    transform: scale(1.05);
}

/* Prompt Editor Inline */
.prompt-editor-inline {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    padding: 12px;
    border-top: 1px solid #e5e7eb;
    z-index: 20;
    display: none;
}

.prompt-editor-inline.show {
    display: block;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.prompt-editor-inline textarea {
    width: 100%;
    height: 80px;
    padding: 8px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.85rem;
    resize: none;
    margin-bottom: 8px;
    outline: none;
}

.prompt-editor-inline textarea:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}

.prompt-editor-btns {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.prompt-editor-btns .btn {
    padding: 4px 12px;
    font-size: 0.8rem;
}

/* ==========================================================================
   Adaptive Renderer Brackets (JS Dynamic Hooks)
   ========================================================================== */
.template-custom-ai[style*="--ai-title-decor-type: brackets"] .ai-bracket-left,
.template-custom-ai[style*="--ai-title-decor-type: brackets"] .ai-bracket-right {
    display: inline-block !important;
}

/* Helper utilities */
.mb-2 { margin-bottom: 0.5rem; }
