/* Streaming animation styles */
.iva-cursor {
    color: #667eea;
    font-weight: bold;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.iva-streaming-text {
    display: inline;
}

/* Enhanced message animations */
.iva-message {
    margin-bottom: 15px;
    animation: fadeInUp 0.4s ease;
    transform-origin: bottom;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(15px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Smooth transitions for all elements */
.iva-message-content {
    transition: all 0.3s ease;
}

.iva-message-content:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
#iva-chat-widget {
    max-width: 400px;
    margin: 20px auto;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    background: #ffffff;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#iva-chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    border-radius: 10px 10px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

#iva-chat-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
}

#iva-chat-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

#iva-chat-container {
    display: flex;
    flex-direction: column;
    height: 500px;
}

#iva-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
}

.iva-message {
    margin-bottom: 15px;
    animation: fadeInUp 0.3s ease;
}

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

.iva-user-message {
    display: flex;
    justify-content: flex-end;
}

.iva-bot-message {
    display: flex;
    justify-content: flex-start;
}

.iva-user-message .iva-message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 16px;
    border-radius: 18px 18px 4px 18px;
    max-width: 80%;
    word-wrap: break-word;
    position: relative;
}

.iva-bot-message .iva-message-content {
    background: white;
    color: #333;
    padding: 12px 16px;
    border-radius: 18px 18px 18px 4px;
    max-width: 80%;
    word-wrap: break-word;
    border: 1px solid #e0e0e0;
    position: relative;
}

.iva-message-time {
    font-size: 11px;
    color: #999;
    margin-top: 5px;
    text-align: right;
}

.iva-bot-message .iva-message-time {
    text-align: left;
}

.iva-suggestions {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.iva-suggestions ul {
    list-style: none;
    padding: 0;
    margin: 5px 0 0 0;
}

.iva-suggestions li {
    background: #f0f2f5;
    padding: 8px 12px;
    margin: 5px 0;
    border-radius: 15px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.iva-suggestions li:hover {
    background: #e4e6ea;
}

#iva-chat-input-container {
    padding: 15px 20px;
    border-top: 1px solid #e0e0e0;
    background: white;
    border-radius: 0 0 10px 10px;
    display: flex;
    gap: 10px;
}

#iva-chat-input {
    flex: 1;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    padding: 12px 16px;
    font-size: 14px;
    outline: none;
    resize: none;
    min-height: 20px;
    max-height: 120px;
    transition: border-color 0.2s ease;
    font-family: inherit;
}

#iva-chat-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

#iva-chat-send {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 12px 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    white-space: nowrap;
}

#iva-chat-send:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

#iva-chat-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#iva-chat-loading {
    padding: 20px;
    text-align: center;
    background: #f8f9fa;
}

.iva-typing-indicator {
    display: inline-block;
}

.iva-typing-indicator span {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #999;
    margin: 0 2px;
    animation: typing 1.4s infinite;
}

.iva-typing-indicator span:nth-child(1) {
    animation-delay: 0s;
}

.iva-typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.iva-typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Scrollbar styling */
#iva-chat-messages::-webkit-scrollbar {
    width: 6px;
}

#iva-chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#iva-chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

#iva-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Responsive design */
@media (max-width: 480px) {
    #iva-chat-widget {
        max-width: 100%;
        margin: 10px;
        border-radius: 0;
    }
    
    #iva-chat-header {
        border-radius: 0;
    }
    
    #iva-chat-container {
        height: 400px;
    }
    
    .iva-message-content {
        max-width: 85%;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    #iva-chat-widget {
        background: #2c2c2c;
        border-color: #404040;
    }
    
    #iva-chat-messages {
        background: #1e1e1e;
    }
    
    .iva-bot-message .iva-message-content {
        background: #3c3c3c;
        color: #e0e0e0;
        border-color: #555;
    }
    
    #iva-chat-input-container {
        background: #2c2c2c;
        border-top-color: #404040;
    }
    
    #iva-chat-input {
        background: #3c3c3c;
        color: #e0e0e0;
        border-color: #555;
    }
    
    #iva-chat-input:focus {
        border-color: #667eea;
    }
    
    .iva-message-time {
        color: #aaa;
    }
    
    .iva-suggestions li {
        background: #3c3c3c;
        color: #e0e0e0;
    }
    
    .iva-suggestions li:hover {
        background: #4c4c4c;
    }
}