/**
 * Stili chat WhatsApp Ollama Clone - Stile WhatsApp
 */

.whatsapp-ollama-chat-container {
    max-width: 600px;
    margin: 20px auto;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    background: #fff;
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

/* Header */
.whatsapp-chat-header {
    background: linear-gradient(135deg, #128c7e 0%, #075e54 100%);
    color: #fff;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.chat-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: #25d366;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-right: 12px;
    flex-shrink: 0;
}

.chat-info {
    flex: 1;
}

.chat-name {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 2px;
}

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

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #25d366;
    margin-right: 6px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Messages Container */
.whatsapp-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #e5ddd5;
    background-image:
        linear-gradient(rgba(0, 0, 0, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 0, 0, 0.02) 1px, transparent 1px);
    background-size: 20px 20px;
    min-height: 300px;
}

.chat-message {
    display: flex;
    margin-bottom: 12px;
    animation: slideIn 0.3s ease-out;
}

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

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

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

.message-bubble {
    max-width: 75%;
    padding: 8px 12px;
    border-radius: 8px;
    position: relative;
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.user-message .message-bubble {
    background: #dcf8c6;
    border-bottom-right-radius: 2px;
}

.bot-message .message-bubble {
    background: #fff;
    border-bottom-left-radius: 2px;
}

.message-bubble p {
    margin: 0;
    line-height: 1.5;
    font-size: 14px;
    color: #303030;
}

.message-time {
    font-size: 11px;
    color: rgba(0, 0, 0, 0.45);
    display: block;
    text-align: right;
    margin-top: 4px;
}

/* Input Container */
.whatsapp-chat-input-container {
    background: #f0f0f0;
    padding: 10px;
    border-top: 1px solid #ddd;
}

.chat-input-form {
    display: flex;
    align-items: flex-end;
}

.input-wrapper {
    display: flex;
    background: #fff;
    border-radius: 24px;
    padding: 8px 12px;
    flex: 1;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

#chat-message-input {
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    font-size: 14px;
    line-height: 1.5;
    max-height: 100px;
    overflow-y: auto;
    font-family: inherit;
    padding: 4px;
}

.send-button {
    background: transparent;
    border: none;
    color: #128c7e;
    cursor: pointer;
    padding: 4px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.send-button:hover {
    transform: scale(1.1);
}

.send-button:active {
    transform: scale(0.95);
}

.send-button svg {
    width: 24px;
    height: 24px;
}

/* Loading Indicator */
.chat-loading {
    padding: 10px 20px;
    background: #e5ddd5;
}

.typing-indicator {
    display: inline-flex;
    align-items: center;
    padding: 12px 16px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.typing-indicator span {
    height: 8px;
    width: 8px;
    background: #128c7e;
    border-radius: 50%;
    margin: 0 3px;
    animation: typing 1.4s infinite;
}

.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);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Scrollbar personalizzata */
.whatsapp-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.whatsapp-chat-messages::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
}

.whatsapp-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.whatsapp-chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* Responsive */
@media (max-width: 768px) {
    .whatsapp-ollama-chat-container {
        margin: 0;
        border-radius: 0;
        height: 100vh !important;
        max-width: 100%;
    }

    .message-bubble {
        max-width: 85%;
    }
}

/* Error Message */
.chat-error {
    padding: 10px;
    margin: 10px 20px;
    background: #ffebee;
    color: #c62828;
    border-radius: 8px;
    text-align: center;
    font-size: 14px;
}

/* Empty state */
.chat-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.chat-empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}
