﻿/* Stili base chat */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1rem;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 1rem;
}

/* Messaggi */
.message {
    margin-bottom: 1rem;
    padding: 0.8rem;
    border-radius: 8px;
    max-width: 100%;
    font-size: 16px;
    line-height: 1.6;
}

.user-message {
    background: #007bff;
    color: white;
    margin-left: auto;
    max-width: 70%;
}

.ai-message {
    background: #f5f5f5;
    margin-right: auto;
    font-size: 20px;
    white-space: pre-line;
}

.ai-response {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background: transparent;
    padding: 0;
    margin: 0;
}

.message-content {
    color: inherit;
    padding: 0.5rem 0;
    font-size: 18px;
}


/* Typing indicator */
.typing-indicator span {
    animation: blink 1.4s infinite;
    font-size: 1.2rem;
}

    .typing-indicator span:nth-child(2) {
        animation-delay: 0.2s;
    }

    .typing-indicator span:nth-child(3) {
        animation-delay: 0.4s;
    }

@keyframes blink {
    0%, 60%, 100% {
        opacity: 0;
    }

    20% {
        opacity: 1;
    }
}

/* Footer e input */
.chat-footer {
    padding: 1rem 1.5rem;
    background: white;
    border-top: 1px solid #e0e0e0;
}

.chat-input-container {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
}

.chat-input {
    flex: 1;
    padding: 0.8rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 18px;
    min-height: 60px;
    max-height: 120px;
    resize: vertical;
    overflow-y: auto;
    line-height: 1.4;
    white-space: pre-wrap;
    word-wrap: break-word;
    width: 100%;
    box-sizing: border-box;
    font-family: inherit;
}

    .chat-input:focus {
        border-color: #1e3c72;
        outline: none;
        box-shadow: 0 0 0 2px rgba(30, 60, 114, 0.1);
    }

.chat-send-btn {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: transform 0.2s;
    min-height: 60px;
    max-height: 120px;
}

    .chat-send-btn:hover:not(:disabled) {
        transform: translateY(-2px);
    }

    .chat-send-btn:disabled {
        opacity: 0.6;
        cursor: not-allowed;
    }

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .chat-container {
        width: 95%;
        height: 90%;
        max-height: none;
    }

    .chat-input {
        font-size: 16px;
        min-height: 50px;
    }

    .chat-send-btn {
        padding: 0.6rem 1rem;
        min-height: 50px;
    }

    .message {
        font-size: 14px;
    }

}

.chat-container .message {
    margin-bottom: 4px !important;
    margin-top: 4px !important;
}

.chat-container .message-content {
    padding: 6px 12px !important;
    line-height: 1.3 !important;
}

.chat-container .ai-response {
    margin: 0 !important;
    padding: 0 !important;
}

.chat-body {
    gap: 4px !important;
}