/* Chat Widget Styles */

/* Floating Button */
.chat-widget-button {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, #239c99 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(44, 189, 185, 0.4);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.chat-widget-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(44, 189, 185, 0.5);
}

.chat-widget-button i {
    font-size: 24px;
    color: white;
}

.chat-widget-button .chat-close-icon {
    display: none;
}

.chat-widget-button.active .chat-open-icon {
    display: none;
}

.chat-widget-button.active .chat-close-icon {
    display: inline;
}

/* Chat Window */
.chat-widget-window {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 380px;
    height: 520px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 9998;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.chat-widget-window.active {
    display: flex;
}

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

/* Chat Header */
.chat-widget-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #239c99 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-widget-header .header-icon {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-widget-header .header-icon i {
    font-size: 20px;
}

.chat-widget-header .header-text h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chat-widget-header .header-text p {
    margin: 0;
    font-size: 12px;
    opacity: 0.9;
}

/* Chat Messages Area */
.chat-widget-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8f9fa;
}

/* Message Bubbles */
.chat-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    animation: fadeIn 0.3s ease;
}

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

.chat-message.user {
    align-self: flex-end;
    background: var(--primary-color);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.assistant {
    align-self: flex-start;
    background: white;
    color: var(--text-color);
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.chat-message.assistant a {
    color: var(--primary-color);
    text-decoration: none;
}

.chat-message.assistant a:hover {
    text-decoration: underline;
}

.chat-message.assistant ul,
.chat-message.assistant ol {
    margin: 8px 0;
    padding-left: 20px;
}

.chat-message.assistant li {
    margin: 4px 0;
}

/* Welcome Message */
.chat-welcome {
    text-align: center;
    padding: 20px;
}

.chat-welcome h5 {
    color: var(--text-color);
    margin-bottom: 8px;
}

.chat-welcome p {
    color: var(--muted-text);
    font-size: 13px;
    margin-bottom: 16px;
}

/* Suggested Questions */
.chat-suggestions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-suggestion-btn {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 10px 14px;
    text-align: left;
    font-size: 13px;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-suggestion-btn:hover {
    border-color: var(--primary-color);
    background: rgba(44, 189, 185, 0.05);
    color: var(--primary-color);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    align-self: flex-start;
}

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

.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-8px); }
}

/* Feedback Buttons */
.chat-feedback {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #eee;
}

.chat-feedback span {
    font-size: 12px;
    color: var(--muted-text);
}

.chat-feedback button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.chat-feedback button:hover {
    background: #f0f0f0;
}

.chat-feedback button.active {
    color: var(--primary-color);
}

/* Chat Input Area */
.chat-widget-input {
    padding: 12px 16px;
    background: white;
    border-top: 1px solid #eee;
    display: flex;
    gap: 8px;
}

.chat-widget-input input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

.chat-widget-input input:focus {
    border-color: var(--primary-color);
}

.chat-widget-input button {
    width: 44px;
    height: 44px;
    border: none;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.chat-widget-input button:hover {
    background: #239c99;
}

.chat-widget-input button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Source Badge */
.source-badge {
    display: inline-block;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    margin-top: 8px;
}

.source-badge.faq {
    background: #e8f5e9;
    color: #2e7d32;
}

.source-badge.knowledge {
    background: #e3f2fd;
    color: #1565c0;
}

.source-badge.regulation {
    background: #fff3e0;
    color: #e65100;
}

/* Responsive */
@media (max-width: 480px) {
    .chat-widget-window {
        width: calc(100% - 20px);
        height: calc(100% - 120px);
        right: 10px;
        bottom: 80px;
        border-radius: 12px;
    }

    .chat-widget-button {
        right: 16px;
        bottom: 16px;
        width: 54px;
        height: 54px;
    }
}
