/**
 * AI Assistant Chat - Styles
 * 🤖 Modern chat interface for tender search
 */

/* Modal */
#aiSearchModal.active {
    display: flex !important;
}

#aiSearchModal .modal-content {
    max-width: 800px;
    width: 95%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    border-radius: 16px;
    overflow: hidden;
}

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

.ai-chat-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.25rem;
    font-weight: 600;
}

.ai-chat-title i {
    font-size: 1.5rem;
}

.ai-chat-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.ai-chat-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Messages Container */
.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 300px;
    max-height: 50vh;
}

/* Dark theme */
body.dark-theme .ai-chat-messages {
    background: #1e293b;
}

/* Message Bubble */
.ai-message {
    display: flex;
    gap: 12px;
    max-width: 85%;
}

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

.ai-message-assistant {
    align-self: flex-start;
}

.ai-message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ai-message-user .ai-message-avatar {
    background: #667eea;
    color: white;
}

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

.ai-message-content {
    padding: 12px 16px;
    border-radius: 16px;
    line-height: 1.5;
    font-size: 14px;
}

.ai-message-user .ai-message-content {
    background: #667eea;
    color: white;
    border-bottom-right-radius: 4px;
}

.ai-message-assistant .ai-message-content {
    background: white;
    color: #334155;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

body.dark-theme .ai-message-assistant .ai-message-content {
    background: #334155;
    color: #e2e8f0;
}

/* Typing Indicator */
.ai-typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

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

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

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

/* Filters Info */
.ai-filters-info {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
}

body.dark-theme .ai-filters-info {
    border-top-color: #475569;
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: #f1f5f9;
    border-radius: 20px;
    font-size: 12px;
    color: #64748b;
}

body.dark-theme .filter-tag {
    background: #475569;
    color: #cbd5e1;
}

.filter-tag i {
    color: #667eea;
    font-size: 10px;
}

/* Search Results */
.ai-search-results {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-top: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

body.dark-theme .ai-search-results {
    background: #334155;
}

.ai-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
    font-size: 13px;
    color: #64748b;
}

body.dark-theme .ai-results-header {
    border-bottom-color: #475569;
    color: #94a3b8;
}

.btn-show-all-results {
    background: none;
    border: none;
    color: #667eea;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-show-all-results:hover {
    text-decoration: underline;
}

.ai-results-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-tender-card {
    padding: 12px;
    background: #f8fafc;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

body.dark-theme .ai-tender-card {
    background: #1e293b;
}

.ai-tender-card:hover {
    background: #f1f5f9;
    transform: translateX(4px);
}

body.dark-theme .ai-tender-card:hover {
    background: #475569;
}

.ai-tender-title {
    font-weight: 500;
    font-size: 13px;
    color: #334155;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

body.dark-theme .ai-tender-title {
    color: #e2e8f0;
}

.ai-tender-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 11px;
    color: #64748b;
}

body.dark-theme .ai-tender-meta {
    color: #94a3b8;
}

.ai-tender-meta i {
    margin-right: 4px;
    color: #667eea;
}

.tender-distance {
    color: #10b981;
}

.tender-distance i {
    color: #10b981;
}

/* Input Area */
.ai-chat-input-area {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #e2e8f0;
}

body.dark-theme .ai-chat-input-area {
    background: #1e293b;
    border-top-color: #334155;
}

.ai-chat-input-wrapper {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.ai-chat-input-wrapper textarea {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 24px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    max-height: 120px;
    transition: border-color 0.2s;
}

body.dark-theme .ai-chat-input-wrapper textarea {
    background: #334155;
    border-color: #475569;
    color: #e2e8f0;
}

.ai-chat-input-wrapper textarea:focus {
    outline: none;
    border-color: #667eea;
}

.ai-chat-input-wrapper textarea::placeholder {
    color: #94a3b8;
}

.ai-chat-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}

.ai-chat-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.ai-chat-send-btn:active {
    transform: scale(0.95);
}

/* Hints */
.ai-chat-hints {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.ai-hint {
    padding: 6px 12px;
    background: #f1f5f9;
    border-radius: 20px;
    font-size: 12px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
}

body.dark-theme .ai-hint {
    background: #334155;
    color: #94a3b8;
}

.ai-hint:hover {
    background: #667eea;
    color: white;
}

/* Responsive */
@media (max-width: 768px) {
    #aiSearchModal .modal-content {
        max-height: 90vh;
        border-radius: 16px 16px 0 0;
        margin-top: auto;
    }
    
    .ai-chat-messages {
        max-height: 40vh;
    }
    
    .ai-message {
        max-width: 95%;
    }
    
    .ai-chat-hints {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 4px;
    }
    
    .ai-hint {
        white-space: nowrap;
    }
}

/* Message Content Styling */
.ai-message-content strong {
    font-weight: 600;
}

.ai-message-content em {
    font-style: italic;
    opacity: 0.8;
}

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

.ai-message-content li {
    margin: 4px 0;
}
