/**
 * File: assets/css/widget.css
 * Stili per il widget chatbot
 */

:root {
    --chatbot-primary-color: #2563eb;
    --chatbot-secondary-color: #f3f4f6;
    --chatbot-text-color: #1f2937;
    --chatbot-border-color: #e5e7eb;
    --chatbot-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* Container principale */
.chatbot-vertex-container {
    position: fixed;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.chatbot-vertex-container.bottom-right {
    bottom: 20px;
    right: 20px;
}

.chatbot-vertex-container.bottom-left {
    bottom: 20px;
    left: 20px;
}

/* Bolla chat */
.chatbot-vertex-bubble {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--chatbot-primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--chatbot-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.chatbot-vertex-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

.chatbot-vertex-bubble img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

/* Finestra chat */
.chatbot-vertex-window {
    width: 380px;
    height: 600px;
    background: white;
    border-radius: 16px;
    box-shadow: var(--chatbot-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

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

/* Header */
.chatbot-vertex-header {
    background: var(--chatbot-primary-color);
    color: white;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chatbot-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid white;
}

.chatbot-header-info h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chatbot-status {
    font-size: 12px;
    opacity: 0.9;
}

.chatbot-close-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background 0.2s;
}

.chatbot-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Area messaggi */
.chatbot-vertex-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #fafafa;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chatbot-vertex-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-vertex-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-vertex-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

/* Messaggio */
.chatbot-message {
    display: flex;
    gap: 10px;
    animation: fadeIn 0.3s ease;
}

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

.message-avatar {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.message-content {
    max-width: 70%;
}

.message-content p {
    margin: 0;
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.5;
    font-size: 14px;
}

/* Messaggio bot */
.bot-message {
    align-self: flex-start;
}

.bot-message .message-content p {
    background: white;
    color: var(--chatbot-text-color);
    border-bottom-left-radius: 4px;
}

/* Messaggio utente */
.user-message {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.user-message .message-content {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.user-message .message-content p {
    background: var(--chatbot-primary-color);
    color: white;
    border-bottom-right-radius: 4px;
}

/* Fonti */
.message-sources {
    margin-top: 8px;
    padding: 10px;
    background: var(--chatbot-secondary-color);
    border-radius: 8px;
    font-size: 12px;
}

.sources-label {
    margin: 0 0 6px 0;
    font-weight: 600;
    color: var(--chatbot-text-color);
}

.message-sources a {
    display: block;
    color: var(--chatbot-primary-color);
    text-decoration: none;
    padding: 4px 0;
    word-break: break-all;
}

.message-sources a:hover {
    text-decoration: underline;
}

/* Indicatore digitazione */
.typing-indicator .message-content {
    background: white;
    padding: 12px 16px;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--chatbot-primary-color);
    animation: bounce 1.4s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

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

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

/* Area input */
.chatbot-vertex-input {
    padding: 16px;
    background: white;
    border-top: 1px solid var(--chatbot-border-color);
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.chatbot-vertex-input textarea {
    flex: 1;
    border: 1px solid var(--chatbot-border-color);
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    outline: none;
    transition: border-color 0.2s;
    max-height: 120px;
}

.chatbot-vertex-input textarea:focus {
    border-color: var(--chatbot-primary-color);
}

.chatbot-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--chatbot-primary-color);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.1s;
}

.chatbot-send-btn:hover {
    background: #1d4ed8;
}

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

/* Responsive */
@media (max-width: 768px) {
    .chatbot-vertex-window {
        width: calc(100vw - 40px);
        height: calc(100vh - 40px);
        max-height: 600px;
    }
}

@media (max-width: 480px) {
    .chatbot-vertex-container.bottom-right,
    .chatbot-vertex-container.bottom-left {
        bottom: 10px;
        right: 10px;
        left: 10px;
    }

    .chatbot-vertex-window {
        width: 100%;
        height: calc(100vh - 20px);
        max-height: none;
        border-radius: 12px;
    }
}
