/* Article Chat Helper - Frontend Styles */

#ach-chat-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Toggle Button */
#ach-chat-toggle {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
}

#ach-chat-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.ach-toggle-icon {
    font-size: 24px;
}

.ach-toggle-text {
    font-weight: 600;
    font-size: 14px;
}

/* Chat Box */
#ach-chat-box {
    display: none;
    width: 400px;
    height: 600px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#ach-chat-container.ach-minimized #ach-chat-box {
    display: none;
}

#ach-chat-container.ach-minimized #ach-chat-toggle {
    display: flex;
}

#ach-chat-container:not(.ach-minimized) #ach-chat-toggle {
    display: none;
}

#ach-chat-container:not(.ach-minimized) #ach-chat-box {
    display: flex;
}

/* Header */
#ach-chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ach-header-icon {
    font-size: 24px;
}

.ach-header-title {
    flex: 1;
    font-weight: 600;
    font-size: 16px;
}

#ach-minimize {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

#ach-minimize:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Messages Area */
#ach-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
}

.ach-message {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ach-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.ach-bot-message .ach-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.ach-user-message .ach-avatar {
    background: #e0e0e0;
}

.ach-bubble {
    background: white;
    padding: 12px 16px;
    border-radius: 15px;
    max-width: 280px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    line-height: 1.5;
    font-size: 14px;
}

.ach-user-message {
    flex-direction: row-reverse;
}

.ach-user-message .ach-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

/* Loading State */
.ach-loading {
    display: flex;
    gap: 5px;
    padding: 10px 0;
}

.ach-loading span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #667eea;
    animation: bounce 1.4s infinite ease-in-out both;
}

.ach-loading span:nth-child(1) {
    animation-delay: -0.32s;
}

.ach-loading span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* Response Styles */
.ach-response-section {
    margin-bottom: 20px;
}

.ach-intro {
    margin-bottom: 12px;
    color: #667eea;
    font-size: 13px;
}

.ach-match {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    border-left: 3px solid #667eea;
}

.ach-match h4 {
    margin: 0 0 8px 0;
    color: #333;
    font-size: 14px;
    font-weight: 600;
}

.ach-content {
    font-size: 13px;
    color: #555;
    line-height: 1.6;
}

.ach-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    font-size: 12px;
}

.ach-content table th,
.ach-content table td {
    border: 1px solid #ddd;
    padding: 6px 8px;
    text-align: left;
}

.ach-content table th {
    background: #f0f0f0;
    font-weight: 600;
}

.ach-other-post {
    background: #fff;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    border: 1px solid #e0e0e0;
}

.ach-post-link {
    margin: 0 0 8px 0;
    font-weight: 600;
    font-size: 13px;
}

.ach-post-link a {
    color: #667eea;
    text-decoration: none;
}

.ach-post-link a:hover {
    text-decoration: underline;
}

.ach-snippet {
    font-size: 12px;
    color: #666;
    line-height: 1.5;
    margin-bottom: 8px;
    padding-left: 10px;
    border-left: 2px solid #e0e0e0;
}

.ach-no-results {
    text-align: center;
    padding: 20px 0;
}

.ach-no-results p {
    margin-bottom: 12px;
    color: #666;
    font-size: 13px;
}

.ach-no-results ul {
    text-align: left;
    list-style: none;
    padding: 0;
    margin: 0;
}

.ach-no-results li {
    padding: 6px 0;
    color: #667eea;
    font-size: 12px;
}

/* Input Area */
#ach-chat-input-wrapper {
    padding: 15px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
}

#ach-chat-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 10px 15px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

#ach-chat-input:focus {
    border-color: #667eea;
}

#ach-chat-send {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 10px 20px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
    font-size: 14px;
}

#ach-chat-send:hover {
    transform: scale(1.05);
}

#ach-chat-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Scrollbar */
#ach-chat-messages::-webkit-scrollbar {
    width: 6px;
}

#ach-chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

#ach-chat-messages::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 3px;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    #ach-chat-container {
        right: 10px;
        bottom: 10px;
    }
    
    #ach-chat-box {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        max-height: 600px;
    }
    
    .ach-bubble {
        max-width: 220px;
    }
    
    .ach-toggle-text {
        display: none;
    }
}