/* Leka AI Assistant - Chat Widget Styles */

.leka-ai-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
}

/* Toggle Button - Chat Icon */
.leka-ai-toggle-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ea580c 0%, #f97316 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(234, 88, 12, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.leka-ai-toggle-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 24px rgba(234, 88, 12, 0.5);
}

.leka-ai-toggle-btn:active {
    transform: scale(0.98);
}

.leka-ai-toggle-icon {
    color: #fff;
}

/* Chat Panel */
.leka-ai-chat-panel {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 48px);
    height: 520px;
    max-height: calc(100vh - 140px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.leka-ai-chat-header {
    background: linear-gradient(135deg, #2d5a3d 0%, #3d7a4d 100%);
    color: #fff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.leka-ai-chat-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 16px;
}

.leka-ai-chat-icon {
    font-size: 20px;
}

.leka-ai-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    transition: background 0.2s;
}

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

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

.leka-ai-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    line-height: 1.5;
    font-size: 14px;
}

.leka-ai-message-bot {
    align-self: flex-start;
    background: #fff;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.leka-ai-message-user {
    align-self: flex-end;
    background: linear-gradient(135deg, #2d5a3d 0%, #3d7a4d 100%);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.leka-ai-message-content {
    white-space: pre-wrap;
    word-wrap: break-word;
}

.leka-ai-message-image {
    max-width: 200px;
    border-radius: 8px;
    margin-top: 8px;
}

.leka-ai-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.leka-ai-typing span {
    width: 8px;
    height: 8px;
    background: #2d5a3d;
    border-radius: 50%;
    animation: leka-ai-bounce 1.4s infinite ease-in-out;
}

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

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

/* Photo upload row - отдельная строка над полем ввода */
#leka-ai-widget .leka-ai-photo-row {
    padding: 10px 16px !important;
    background: #fff !important;
    border-top: 1px solid #eee !important;
    display: block !important;
}

#leka-ai-widget .leka-ai-upload-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100% !important;
    padding: 10px 16px !important;
    background: #e8f0ec !important;
    color: #2d5a3d !important;
    border-radius: 10px;
    font-size: 14px !important;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    border: 2px solid #2d5a3d !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.leka-ai-upload-btn:hover {
    background: #d4e6dc;
    border-color: #3d7a4d;
}

.leka-ai-upload-btn.disabled {
    opacity: 0.6;
    pointer-events: none;
}

/* Input Area */
.leka-ai-chat-input-wrap {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 10px 16px 12px;
    background: #fff;
    border-top: 1px solid #eee;
}

.leka-ai-chat-input-wrap .leka-ai-input {
    flex: 1;
    min-width: 0;
}

#leka-ai-widget .leka-ai-input {
    flex: 1;
    padding: 8px 14px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 14px;
    resize: none;
    max-height: 100px;
    min-height: 32px;
    font-family: inherit;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.leka-ai-input:focus {
    outline: none;
    border-color: #2d5a3d;
}

#leka-ai-widget .leka-ai-send-btn {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    border-radius: 50%;
    background: linear-gradient(135deg, #ea580c 0%, #f97316 100%);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.2s, opacity 0.2s;
}

#leka-ai-widget .leka-ai-send-btn .leka-ai-send-icon {
    flex-shrink: 0;
    pointer-events: none;
}

.leka-ai-send-btn:hover {
    transform: scale(1.05);
}

.leka-ai-send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Mobile */
@media (max-width: 480px) {
    .leka-ai-widget {
        bottom: 16px;
        right: 16px;
    }
    
    .leka-ai-chat-panel {
        width: calc(100vw - 32px);
        right: -8px;
        bottom: 64px;
        height: 70vh;
    }
}
