/**
 * Akcepti AI Chat Widget Styles
 * Color scheme: red #e53328, cyan #b2cee0, grey #575756
 */

/* Floating Action Button */
.ai-chat-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #e53328;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(229, 51, 40, 0.4);
    transition: all 0.3s ease;
    z-index: 1000;
    border: none;
}

.ai-chat-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(229, 51, 40, 0.5);
}

.ai-chat-fab img {
    width: 32px;
    height: 32px;
    pointer-events: none;
}

/* Chat Widget Container */
.ai-chat-widget {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 380px;
    height: 520px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    z-index: 1001;
    overflow: hidden;
}

.ai-chat-widget[hide] {
    display: none;
}

/* Header */
.ai-chat-header {
    background: linear-gradient(135deg, #e53328 0%, #c42a21 100%);
    color: white;
    padding: 14px 16px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ai-chat-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-chat-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-chat-header a {
    color: white;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.ai-chat-header a:hover {
    opacity: 1;
}

.ai-chat-title {
    font-weight: 600;
    font-size: 14px;
}

.ai-chat-icon {
    font-size: 18px;
}

/* Messages Container */
.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f8f9fa;
    scroll-behavior: smooth;
}

.ai-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.ai-chat-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

/* Welcome Message */
.ai-chat-welcome {
    text-align: center;
    padding: 20px;
    color: #575756;
}

.ai-chat-welcome .ai-chat-avatar {
    width: 60px;
    height: 60px;
    background: #b2cee0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.ai-chat-welcome .ai-chat-avatar i {
    font-size: 28px;
    color: #575756;
}

.ai-chat-welcome p {
    margin: 8px 0;
    font-size: 14px;
}

.ai-chat-welcome ul {
    text-align: left;
    display: inline-block;
    margin: 10px 0;
    padding-left: 20px;
}

.ai-chat-welcome ul li {
    font-size: 13px;
    margin: 4px 0;
    color: #666;
}

/* Message Bubbles */
.ai-chat-message {
    max-width: 85%;
    margin-bottom: 12px;
    animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-chat-message.user {
    margin-left: auto;
}

.ai-chat-message.assistant {
    margin-right: auto;
}

.ai-chat-message-content {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.ai-chat-message.user .ai-chat-message-content {
    background: #e53328;
    color: white;
    border-bottom-right-radius: 4px;
}

.ai-chat-message.assistant .ai-chat-message-content {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.ai-chat-message-time {
    font-size: 10px;
    color: #999;
    margin-top: 4px;
    padding: 0 4px;
}

.ai-chat-message.user .ai-chat-message-time {
    text-align: right;
}

/* Typing Indicator */
.ai-chat-typing {
    padding: 8px 16px;
    display: flex;
    gap: 4px;
    align-items: center;
}

.ai-chat-typing[hide] {
    display: none;
}

.ai-chat-typing span {
    width: 8px;
    height: 8px;
    background: #b2cee0;
    border-radius: 50%;
    animation: bounce 1.4s ease-in-out infinite both;
}

.ai-chat-typing span:nth-child(1) { animation-delay: -0.32s; }
.ai-chat-typing span:nth-child(2) { animation-delay: -0.16s; }
.ai-chat-typing span:nth-child(3) { animation-delay: 0; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Quick Actions */
.ai-chat-quick-actions {
    padding: 8px 12px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    border-top: 1px solid #eee;
    background: white;
}

.ai-quick-action {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 20px;
    background: white;
    font-size: 11px;
    color: #575756;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.ai-quick-action:hover {
    border-color: #e53328;
    color: #e53328;
}

.ai-quick-action i {
    font-size: 12px;
}

/* Input Area */
.ai-chat-input-area {
    padding: 12px;
    border-top: 1px solid #eee;
    background: white;
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

#ai-chat-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 13px;
    resize: none;
    max-height: 100px;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
    line-height: 1.4;
}

#ai-chat-input:focus {
    border-color: #b2cee0;
}

.ai-chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e53328;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.ai-chat-send-btn:hover:not(:disabled) {
    background: #c42a21;
}

.ai-chat-send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.ai-chat-send-btn i {
    font-size: 16px;
}

/* Tool execution indicator */
.ai-chat-tool-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #b2cee0;
    color: #333;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    margin-top: 6px;
}

/* Error message */
.ai-chat-error {
    background: #fff3f3;
    border: 1px solid #e53328;
    color: #c42a21;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    margin: 8px 0;
}

/* Responsive */
@media (max-width: 480px) {
    .ai-chat-widget {
        width: calc(100vw - 20px);
        right: 10px;
        bottom: 80px;
        height: calc(100vh - 160px);
        height: calc(100dvh - 160px); /* Safari 15.4+ fix */
        max-height: 500px;
    }

    .ai-chat-fab {
        bottom: 16px;
        right: 16px;
    }
}
