/* Chat Button */
.chat-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 30px;
    background: linear-gradient(135deg, #0066ff, #0052cc);
    box-shadow: 0 4px 12px rgba(0, 102, 255, 0.3);
    cursor: pointer;
    z-index: 999;
    transition: all 0.3s ease;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 102, 255, 0.4);
}

.chat-button img {
    width: 30px;
    height: 30px;
    transition: all 0.3s ease;
}

/* Chat Window */
.chat-window {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 380px;
    height: 600px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1000;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(20px);
}

.chat-window.active {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #0066ff, #0052cc);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Poboljšani stilovi za avatar */
.chat-header .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.chat-header .avatar svg {
    width: 100%;
    height: 100%;
    display: block;
}

.chat-header .avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.chat-header .info {
    flex: 1;
}

.chat-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

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

.chat-header .status .dot {
    width: 10px;
    height: 10px;
    background: #4ade80;
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.2);
    animation: pulse 2s infinite;
}

.close-chat {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s;
}

.close-chat:hover {
    background: rgba(255, 255, 255, 0.2);
}

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

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

.message .time {
    font-size: 11px;
    color: #64748b;
    margin-top: 4px;
    display: block;
}

.message .sender {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
}

.message.user {
    background: #0066ff;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.message.user .time {
    color: rgba(255, 255, 255, 0.8);
    text-align: right;
}

.message.user .sender {
    color: rgba(255, 255, 255, 0.9);
    text-align: right;
}

.message.user .content {
    white-space: pre-wrap;
}

.message.assistant {
    background: white;
    color: #1f2937;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
}

.message.assistant .sender {
    color: #0066ff;
}

.message.assistant .content {
    white-space: pre-wrap;
    line-height: 1.6;
}

.message.assistant .content br {
    display: block;
    margin: 8px 0;
    content: "";
}

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

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

.message.error {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid #ef4444;
}

/* Typing indicator */
.typing-dots {
    display: flex;
    gap: 4px;
    padding: 8px;
    margin: 4px 0;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: #0066ff;
    border-radius: 50%;
    animation: typing 1s infinite ease-in-out;
}

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

@keyframes typing {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.5); }
}

/* Chat Input */
.chat-input {
    padding: 20px;
    background: white;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.chat-input textarea {
    flex: 1;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 14px;
    resize: none;
    outline: none;
    font-family: inherit;
    min-height: 24px;
    max-height: 120px;
    transition: all 0.2s;
}

.chat-input textarea:focus {
    border-color: #0066ff;
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.send-message {
    background: #0066ff;
    color: white;
    border: none;
    border-radius: 12px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.send-message:hover {
    background: #0052cc;
    transform: translateY(-1px);
}

.send-message:active {
    transform: translateY(1px);
}

.send-message:disabled {
    background: #e5e7eb;
    cursor: not-allowed;
    transform: none;
}

.send-message i {
    font-size: 20px;
}

/* Welcome Message */
.welcome-message {
    text-align: left;
    padding: 24px;
    color: #64748b;
    font-size: 14px;
    border-bottom: 1px solid #e5e7eb;
    background: white;
    transition: all 0.3s ease;
}

.welcome-message h4 {
    color: #0066ff;
    margin: 0 0 16px 0;
    font-size: 18px;
    text-align: center;
}

.welcome-message p {
    margin: 0;
    line-height: 1.6;
}

/* Animations */
@keyframes slideIn {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

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

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.4); }
    70% { box-shadow: 0 0 0 6px rgba(74, 222, 128, 0); }
    100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}

.message {
    animation: fadeIn 0.3s ease-out;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .chat-window {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
    
    .chat-header {
        padding: 16px;
    }
    
    .chat-messages {
        padding: 16px;
    }
    
    .chat-input {
        padding: 16px;
    }
}
