/* Chatbot Styles */

.chatbot-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    font-family: 'Segoe UI', Arial, sans-serif;
    max-width: 100vw;
    box-sizing: border-box;
}

.chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    position: relative;
}

.chatbot-toggle.active {
    transform: scale(0.9);
}

.chatbot-toggle i {
    font-size: 24px;
}

/* Image icon for chatbot toggle */
.chatbot-icon {
    width: 28px;
    height: 28px;
    display: block;
}

.chatbot-badge {
    position: absolute;
    top: -10px;
    right: -10px;
    background-color: var(--badge-featured);
    color: white;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s ease;
}

.chatbot-toggle:hover .chatbot-badge {
    opacity: 1;
    transform: scale(1);
}

.chatbot-panel {
    position: absolute;
    top: 70px;
    right: 0;
    width: 380px;
    height: 540px;
    min-width: 320px;
    min-height: 420px;
    max-width: 95vw;
    max-height: 85vh;
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 20px;
    border: 1px solid rgba(176, 219, 156, 0.35);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.16), 0 2px 10px rgba(176, 219, 156, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(-16px) scale(0.98);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.4s cubic-bezier(0.4, 0, 0.2, 1), height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    resize: both;
}

.chatbot-panel.open {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.chatbot-header {
    padding: 14px 18px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: #1e293b;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.chatbot-model-selector {
    display: flex;
    align-items: center;
    margin: 0 10px;
    position: relative;
}

.model-current {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
    padding: 6px 10px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
}

.model-current i { font-size: 12px; }

.model-icon { width: 16px; height: 16px; }

.model-menu {
    position: absolute;
    top: 40px;
    left: 0;
    background: var(--card-bg);
    color: var(--text-color);
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.25);
    min-width: 220px;
    display: none;
    z-index: 10;
    padding: 8px;
}

.model-section { margin-bottom: 8px; }
.model-section-title {
    font-size: 11px;
    color: var(--muted-text);
    margin: 6px 8px;
}

.model-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 8px;
    color: var(--text-color);
    font-size: 13px;
    position: relative;
}

.model-item:hover { background: var(--tag-bg); }
.model-item.active { outline: 2px solid var(--primary-color); }
.model-badge { margin-left: auto; font-size: 10px; color: var(--primary-color); }
.model-item-disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.model-item-disabled:hover {
    background: transparent;
}

.model-lock-icon { 
    margin-left: auto; 
    font-size: 12px; 
    color: var(--muted-text);
    opacity: 0.6;
}

.chatbot-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    flex-grow: 1;
    text-align: center;
}

.chatbot-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 16px;
}

.chatbot-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chatbot-message {
    display: flex;
    margin-bottom: 10px;
}

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

.chatbot-message-content {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 18px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    word-break: break-word;
}

.chatbot-message.bot .chatbot-message-content {
    background-color: var(--tag-bg);
    color: var(--text-color);
    border-bottom-left-radius: 5px;
}

.chatbot-message.user .chatbot-message-content {
    background-color: var(--primary-color);
    color: white;
    border-bottom-right-radius: 5px;
}

.chatbot-message-content p {
    margin: 0;
    line-height: 1.4;
}

.chatbot-input-container {
    display: flex;
    padding: 10px 15px;
    border-top: 1px solid var(--input-border);
}

.chatbot-input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid var(--input-border);
    border-radius: 20px;
    outline: none;
    background-color: var(--input-bg);
    color: var(--text-color);
}

.chatbot-send {
    background-color: var(--primary-color);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-left: 10px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s ease;
}

.chatbot-send:hover {
    background-color: var(--primary-dark);
}

.chatbot-api-key-container {
    padding: 15px;
    border-top: 1px solid var(--input-border);
    background-color: var(--tag-bg);
    display: none;
}

.chatbot-api-key {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid var(--input-border);
    border-radius: 5px;
    background-color: var(--input-bg);
    color: var(--text-color);
}

.chatbot-save-key {
    width: 100%;
    padding: 10px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chatbot-save-key:hover {
    background-color: var(--primary-dark);
}

.chatbot-api-note {
    font-size: 12px;
    color: var(--muted-text);
    margin-top: 10px;
    text-align: center;
}

.chatbot-mode-note {
    margin: 0;
    padding: 0 15px 12px;
    font-size: 12px;
    line-height: 1.45;
    color: var(--muted-text);
    text-align: center;
    border-top: 1px solid var(--input-border);
    padding-top: 10px;
    background: var(--card-bg);
}

/* Typing indicator */
.typing-indicator, .typing-dots {
    display: flex;
    gap: 4px;
    padding: 5px 0;
}

.typing-indicator span, .typing-dots span {
    width: 8px;
    height: 8px;
    background-color: var(--muted-text);
    border-radius: 50%;
    display: inline-block;
    animation: typing 1.4s infinite ease-in-out both;
}

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

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

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

.typing-text {
    font-size: 13px;
    color: var(--muted-text);
    margin-top: 8px;
    margin-bottom: 0;
    font-style: italic;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

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

/* Tool recommendations styling */
.chatbot-message-content h2,
.chatbot-message-content h3,
.chatbot-message-content h4 {
    margin-top: 15px;
    margin-bottom: 8px;
    color: var(--text-color);
}

.chatbot-message-content h2 {
    font-size: 18px;
}

.chatbot-message-content h3 {
    font-size: 16px;
}

.chatbot-message-content h4 {
    font-size: 14px;
}

.chatbot-message-content ul {
    margin: 8px 0;
    padding-left: 20px;
}

.chatbot-message-content li {
    margin-bottom: 5px;
}

.chatbot-message-content .tool-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
}

.chatbot-message-content .tool-link:hover {
    text-decoration: underline;
}

/* Image styling in chatbot responses */
.chatbot-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 10px 0;
    display: block;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Resize handle styling */
.chatbot-panel {
    position: relative;
}

.chatbot-panel::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 15px;
    height: 15px;
    cursor: nwse-resize;
    background: linear-gradient(135deg, transparent 50%, var(--primary-color) 50%);
    border-bottom-right-radius: 16px;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.chatbot-panel:hover::after {
    opacity: 1;
}

/* Size controls */
.chatbot-size-controls {
    display: flex;
    gap: 5px;
    margin-right: 10px;
    z-index: 10;
}

.chatbot-size-btn {
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 25px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.chatbot-size-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.chatbot-size-btn:hover {
    background-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px) scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.chatbot-size-btn:hover::before {
    left: 100%;
}

.chatbot-size-btn.active {
    background-color: rgba(255, 255, 255, 0.4);
    font-weight: bold;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.6), 0 2px 8px rgba(0, 0, 0, 0.15);
    transform: scale(1.1);
}

.chatbot-size-btn:active {
    transform: translateY(0) scale(0.95);
}

.chatbot-size-btn:focus {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
}

/* Size variations */
.chatbot-panel.size-small {
    width: 280px;
    height: 400px;
    transform: translateY(0);
}

.chatbot-panel.size-default {
    width: 350px;
    height: 500px;
    transform: translateY(0);
}

.chatbot-panel.size-large {
    width: 450px;
    height: 600px;
    transform: translateY(0);
}

/* Ensure smooth transitions during size changes */
.chatbot-panel.size-transitioning {
    pointer-events: none;
}

.chatbot-panel.size-transitioning * {
    pointer-events: none;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .chatbot-container {
        right: 10px;
    }
    
    .chatbot-panel {
        width: 300px;
        height: 450px;
        right: 0;
        max-width: calc(100vw - 20px);
    }
    
    .chatbot-panel.size-small {
        width: 260px;
        height: 380px;
    }
    
    .chatbot-panel.size-default {
        width: 300px;
        height: 450px;
    }
    
    .chatbot-panel.size-large {
        width: calc(100vw - 20px);
        height: 520px;
        max-width: 380px;
    }
    
    .chatbot-message-content {
        max-width: 90%;
    }
    
    .chatbot-toggle {
        width: 50px;
        height: 50px;
    }
    
    .chatbot-size-controls {
        gap: 3px;
    }
    
    .chatbot-size-btn {
        padding: 3px 6px;
        font-size: 11px;
        min-width: 22px;
    }
}

@media (max-width: 768px) {
    .chatbot-panel.size-large {
        width: 400px;
        height: 550px;
        max-width: calc(100vw - 40px);
    }
}

/* Recommendation Response Styles */
.recommendation-response {
    margin-top: 10px;
}

.tool-recommendation {
    background-color: #f8f9fa;
    border-left: 3px solid var(--primary-color);
    padding: 12px;
    margin: 10px 0;
    border-radius: 6px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tool-recommendation:hover {
    transform: translateX(2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tool-recommendation h4 {
    margin: 0 0 8px 0;
    color: var(--primary-color);
    font-size: 16px;
}

.tool-recommendation h4 a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.tool-recommendation h4 a:hover {
    text-decoration: underline;
}

.tool-recommendation p {
    margin: 6px 0;
    font-size: 13px;
    line-height: 1.5;
}

.tool-recommendation p strong {
    color: #333;
    font-weight: 600;
}

.tool-recommendation .tag {
    display: inline-block;
    background-color: #e3f2fd;
    color: #1976d2;
    padding: 3px 8px;
    margin: 2px 3px 2px 0;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.intent-tags {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #e0e0e0;
    font-size: 12px;
    color: #666;
}

/* Mobile optimizations for recommendations */
@media (max-width: 480px) {
    .tool-recommendation {
        padding: 10px;
        font-size: 12px;
    }
    
    .tool-recommendation h4 {
        font-size: 14px;
    }
    
    .tool-recommendation p {
        font-size: 12px;
    }
    
    .tool-recommendation .tag {
        font-size: 10px;
        padding: 2px 6px;
    }
}
