/* AI Tool Finder Chat Styles v3.0.0 */

#ai-tool-finder-chat {
    max-width: 600px;
    margin: 40px auto;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
}

/* ==================== HEADER ==================== */
#chat-header {
    background-image: linear-gradient(240deg, #5336ff, #ff512e);
    padding: 20px;
    color: white;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.ai-avatar-header {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-avatar-header img {
    width: 42px !important;
    height: 42px !important;
    object-fit: contain;
    border-radius: 7px;
}

.header-text h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    line-height: 1.2;
    color: #fff;
}

.header-status {
    font-size: 13px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.header-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    display: inline-block;
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { 
        opacity: 1; 
    }
    50% { 
        opacity: 0.5; 
    }
}

/* ==================== MESSAGES ==================== */
#chat-messages {
    height: 500px;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    scroll-behavior: smooth;
}

.message {
    display: flex;
    margin-bottom: 20px;
    animation: fadeIn 0.4s ease-out;
    gap: 10px;
}

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

.avatar-container {
    flex-shrink: 0;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.message-content {
    padding: 14px 18px;
    border-radius: 16px;
    max-width: 75%;
    line-height: 1.6;
    font-size: 15px;
    word-wrap: break-word;
}

/* USER MESSAGE */
.user-message {
    justify-content: flex-end;
}

.user-message .message-content {
    background: #6C7FED;
    color: white;
    border-radius: 18px;
    border-bottom-right-radius: 4px;
    text-align: left;
    box-shadow: 0 2px 8px rgba(108, 127, 237, 0.25);
}

.user-message .message-avatar {
    box-shadow: 0 2px 6px rgba(108, 127, 237, 0.3);
    background: transparent;
}

/* BOT MESSAGE */
.bot-message {
    justify-content: flex-start;
}

.bot-message .message-content {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    text-align: left;
}

.bot-message .message-avatar {
    background: transparent;
}

.bot-message .message-content a {
    color: #007bff;
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid transparent;
    transition: all 0.2s;
}

.bot-message .message-content a:hover {
    color: #0056b3;
    border-bottom-color: #0056b3;
}

.bot-message .message-content strong {
    color: #1a1a1a;
    font-weight: 600;
}

/* ==================== CATEGORY BUTTONS ==================== */
.category-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 16px;
}

.category-btn {
    padding: 12px 16px;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    color: #495057;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    text-align: center;
    position: relative;
}

.category-btn:hover {
    background: #e9ecef;
    border-color: #6C7FED;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(108, 127, 237, 0.15);
}

.category-btn:active {
    transform: translateY(0);
}

.category-btn.selected {
    background: #6C7FED;
    color: white;
    border-color: #6C7FED;
    box-shadow: 0 4px 12px rgba(108, 127, 237, 0.3);
}

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

/* ==================== INPUT AREA ==================== */
#chat-input-container {
    display: flex;
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #e9ecef;
    gap: 12px;
}

#chat-input {
    flex: 1;
    padding: 0px 18px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    font-size: 15px;
    outline: none;
    transition: all 0.2s;
    font-family: inherit;
    background: #f8f9fa;
}

#chat-input::placeholder {
    color: #495057;
    opacity: 1;
}

#chat-input:disabled {
    background: #f8f9fa;
    cursor: not-allowed;
    opacity: 1;
}

#chat-input:disabled::placeholder {
    color: #495057;
    font-weight: 500;
}

#chat-input:focus {
    border-color: #6C7FED;
    background: white;
    box-shadow: 0 0 0 3px rgba(108, 127, 237, 0.1);
}

#chat-send {
    width: 48px;
    height: 48px;
    padding: 0;
    background: #6C7FED;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

#chat-send:hover {
    background: #5a6dd8;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 127, 237, 0.4);
}

#chat-send:active {
    transform: translateY(0) scale(0.98);
}

#chat-send:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ==================== LOADING (HIDDEN) ==================== */
#chat-loading {
    display: none !important;
    text-align: center;
    padding: 16px;
    color: #666;
    font-style: italic;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.loading-dots span {
    animation: blink 1.4s infinite;
}

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

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

@keyframes blink {
    0%, 60%, 100% {
        opacity: 1;
    }
    30% {
        opacity: 0.3;
    }
}

/* ==================== SCROLLBAR ==================== */
#chat-messages::-webkit-scrollbar {
    width: 8px;
}

#chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

#chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

#chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    #ai-tool-finder-chat {
        margin: 0px;
        border-radius: 12px;
    }
    
    #chat-header {
        padding: 16px;
    }
    
    .header-text h3 {
        font-size: 16px;
    }
    
    #chat-messages {
        height: 450px;
        padding: 16px;
    }
    
    .message-content {
        max-width: 80%;
        font-size: 14px;
        padding: 12px 16px;
    }
    
    .message-avatar {
        width: 32px;
        height: 32px;
    }
    
    .category-buttons {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    #chat-input-container {
        padding: 12px 16px;
    }
    
    #chat-input {
        font-size: 16px;
        padding: 0px 16px;
    }
    
    #chat-send {
        width: 44px;
        height: 44px;
    }
}

@media (max-width: 480px) {
    #chat-messages {
        height: 400px;
    }
    
    .message-content {
        max-width: 85%;
    }
}