/* Global AI Chat Widget Styles */

/* Chat Widget Container (Floating Bottom Right) */
.chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Chat Button (Minimized State) */
.chat-button {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    position: relative;
    animation: pulse 2s infinite;
}

.chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.6);
}

.chat-notification {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    animation: bounce 1s infinite;
}

/* Chat Window (Maximized State) */
.chat-window {
    width: 380px;
    height: 500px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    overflow: hidden;
    border: 1px solid #e2e8f0;
    animation: slideUp 0.3s ease-out;
}

.chat-header {
    padding: 15px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-size: 18px;
}

.chat-info {
    flex: 1;
}

.chat-title {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 2px;
}

.chat-status {
    font-size: 12px;
    opacity: 0.8;
    display: flex;
    align-items: center;
}

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

.btn-minimize, .btn-close {
    width: 28px;
    height: 28px;
    background: rgba(255,255,255,0.2);
    border: none;
    border-radius: 6px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.2s ease;
}

.btn-minimize:hover, .btn-close:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

.chat-body {
    display: flex;
    flex-direction: column;
    height: calc(100% - 70px);
}

.chat-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    min-height: 250px;
    max-height: 320px;
}

.chat-message {
    margin-bottom: 1rem;
    animation: fadeInUp 0.3s ease-out;
}

.user-message {
    text-align: right;
}

.bot-message {
    text-align: left;
}

.message-content {
    background: #f8fafc;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    display: inline-block;
    max-width: 85%;
    word-wrap: break-word;
}

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

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

.message-time {
    display: block;
    margin-top: 0.25rem;
    color: #6b7280;
    font-size: 0.75rem;
}

.chat-suggestions {
    padding: 0 1rem;
    max-height: 100px;
    overflow-y: auto;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}

.suggestions-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: #374151;
    padding: 0.5rem 0 0.25rem 0;
}

.suggestions-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding-bottom: 0.5rem;
}

.suggestion-chip {
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.suggestion-chip:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
    transform: translateY(-1px);
}

.chat-input-container {
    padding: 1rem;
    border-top: 1px solid #e5e7eb;
    background: white;
}

.chat-input {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

#chatInput {
    flex: 1;
    border: 2px solid #e5e7eb;
    border-radius: 25px;
    padding: 0.75rem 1rem;
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
}

#chatInput:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn-send {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s ease;
}

.btn-send:hover:not(:disabled) {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.chat-typing {
    margin-top: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.typing-indicator {
    display: flex;
    gap: 0.25rem;
}

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

.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

/* Chat Chart Links Styles */
.chat-chart-links {
    margin-top: 1rem;
    padding: 0.75rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.chart-links-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chart-links-title i {
    color: #667eea;
}

.chart-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
}

.chart-link:last-child {
    margin-bottom: 0;
}

.chart-link:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
    text-decoration: none;
    color: inherit;
}

.chart-link > i {
    font-size: 1.125rem;
    color: #667eea;
    min-width: 18px;
}

.chart-link-content {
    flex: 1;
}

.chart-link-title {
    font-weight: 600;
    font-size: 0.875rem;
    color: #1f2937;
    margin-bottom: 0.125rem;
}

.chart-link-description {
    font-size: 0.75rem;
    color: #6b7280;
    line-height: 1.3;
}

.chart-link-arrow {
    font-size: 0.75rem;
    color: #9ca3af;
    opacity: 0.7;
    transition: all 0.2s ease;
}

.chart-link:hover .chart-link-arrow {
    opacity: 1;
    color: #667eea;
    transform: translateX(2px);
}

/* Animations */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-5px); }
    60% { transform: translateY(-3px); }
}

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

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

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

/* Responsive Design */
@media (max-width: 768px) {
    .chat-widget {
        bottom: 15px;
        right: 15px;
    }
    
    .chat-window {
        width: calc(100vw - 30px);
        height: calc(100vh - 100px);
        max-width: 380px;
        max-height: 500px;
    }
    
    .chat-button {
        width: 55px;
        height: 55px;
        font-size: 20px;
    }
    
    .chat-header {
        padding: 12px 16px;
    }
    
    .chat-messages {
        padding: 0.75rem;
    }
    
    .chat-input-container {
        padding: 0.75rem;
    }
    
    .suggestions-container {
        flex-direction: column;
    }
    
    .suggestion-chip {
        text-align: center;
    }
}

/* Better space utilization when suggestions are hidden */
.chat-suggestions[style*="display: none"] {
    padding: 0;
    height: 0;
    min-height: 0;
    border: none;
    overflow: hidden;
}

/* Hidden state utility */
.hidden {
    display: none !important;
}