﻿/* --- CONTAINER PRINCIPALE DEL SERVIZIO IA --- */
.vi-ai-locator {
    max-width: 850px;
    margin: 40px auto;
    padding: 30px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    font-family: 'Helvetica Neue', Arial, sans-serif;
    text-align: center;
}

    .vi-ai-locator h2 {
        color: #003366; /* Blu istituzionale VoglioInsegnare */
        font-size: 28px;
        font-weight: 700;
        margin-bottom: 12px;
    }

    .vi-ai-locator p {
        color: #555555;
        font-size: 16px;
        line-height: 1.5;
        margin-bottom: 25px;
    }

/* --- WRAPPER DELLA TEXTAREA + BOTTONE --- */
.vi-textarea-container {
    position: relative;
    width: 100%;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    border: 2px solid #e0e6ed;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

    /* Effetto focus quando l'utente clicca nella textarea */
    .vi-textarea-container:focus-within {
        border-color: #0056b3;
        box-shadow: 0 4px 20px rgba(0, 86, 179, 0.15);
    }

    .vi-textarea-container textarea {
        width: 100%;
        height: 110px;
        padding: 18px 140px 18px 18px; /* Spazio a destra per non far sovrapporre il testo al bottone */
        border: none;
        border-radius: 12px;
        font-size: 16px;
        color: #333333;
        resize: none; /* Impedisce il ridimensionamento manuale scomodo in Homepage */
        outline: none;
        box-sizing: border-box;
    }

        .vi-textarea-container textarea::placeholder {
            color: #999999;
            font-style: italic;
        }

/* --- BOTTONE DI INVIO (Dentro la Textarea) --- */
#vi-submit-btn {
    position: absolute;
    right: 12px;
    bottom: 12px;
    background: #ff6600; /* Arancione Call-to-Action per risaltare */
    color: #ffffff;
    border: none;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
    box-shadow: 0 4px 10px rgba(255, 102, 0, 0.3);
}

    #vi-submit-btn:hover {
        background: #e65c00;
        transform: translateY(-1px);
    }

    #vi-submit-btn:active {
        transform: translateY(1px);
    }

/* --- SUGGERIMENTI RAPIDI (Tag sotto la Textarea) --- */
.vi-quick-prompts {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
}

    .vi-quick-prompts span {
        font-size: 14px;
        color: #777777;
        align-self: center;
    }

    .vi-quick-prompts button {
        background: #f0f4f8;
        color: #003366;
        border: 1px solid #d0daf0;
        padding: 8px 16px;
        font-size: 14px;
        font-weight: 500;
        border-radius: 20px;
        cursor: pointer;
        transition: all 0.2s ease;
    }

        .vi-quick-prompts button:hover {
            background: #003366;
            color: #ffffff;
            border-color: #003366;
            transform: translateY(-1px);
        }

/* --- RESPONSIVE DESIGN (Per Tablet e Smartphone) --- */
@media (max-width: 768px) {
    .vi-ai-locator {
        margin: 20px 15px;
        padding: 20px;
    }

        .vi-ai-locator h2 {
            font-size: 22px;
        }

    .vi-textarea-container textarea {
        padding: 15px;
        height: 140px; /* Più alta sui telefoni per dare spazio */
    }

    #vi-submit-btn {
        position: static; /* Sgancia il bottone dall'interno su mobile */
        width: calc(100% - 24px);
        margin: 0 12px 12px 12px;
        text-align: center;
    }

    .vi-quick-prompts {
        flex-direction: column;
        align-items: stretch;
    }

        .vi-quick-prompts button {
            width: 100%;
            text-align: left;
        }
}


/* --- RESET E VARIABILI --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Helvetica Neue', Arial, sans-serif;
}

:root {
    --primary-blue: #003366;
    --light-blue: #f0f4f8;
    --accent-orange: #ff6600;
    --text-dark: #333333;
    --text-light: #666666;
    --border-color: #e0e6ed;
}

body, html {
    height: 100%;
    background-color: #f7f9fb;
    overflow: hidden;
}

/* --- LAYOUT GENERALE --- */
.chat-page-container {
    display: flex;
    width: 100vw;
    height: 100vh;
}

/* --- SIDEBAR (Nascosta su mobile per usabilità) --- */
.chat-sidebar {
    width: 300px;
    background-color: var(--color-blu);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    padding: 25px;
    justify-content: space-between;
}

.sidebar-logo h2 {
    font-size: 24px;
    font-weight: 700;
}

.sidebar-logo span {
    color: var(--accent-orange);
}

.sidebar-content h3 {
    font-size: 18px;
    margin-bottom: 15px;
    color: #e6f0ff;
}

.sidebar-content ul {
    list-style: none;
}

.sidebar-content li {
    margin-bottom: 12px;
    font-size: 15px;
    line-height: 1.4;
    color: #d0e1f9;
}

.sidebar-footer a {
    color: var(--accent-orange);
    text-decoration: none;
    font-weight: bold;
}

/* --- AREA CHAT COMPLETA --- */
.chat-main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #ffffff;
}

/* Header */
.chat-header {
    padding: 15px 30px;
    border-bottom: 1px solid var(--border-color);
    background: #ffffff;
}

.bot-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bot-avatar {
    width: 40px;
    height: 40px;
    background: var(--light-blue);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.bot-info h4 {
    color: var(--primary-blue);
    font-size: 16px;
}

.status-online {
    color: #28a745;
    font-size: 13px;
}

/* Contenitore Messaggi */
.chat-messages-container {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    background-color: #fcfdfe;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Bolle Messaggi (Stile Conversazionale) */
.message {
    display: flex;
    max-width: 75%;
    flex-direction: column;
}

    .message.utente {
        align-self: flex-end;
    }

    .message.bot {
        align-self: flex-start;
    }

.message-bubble {
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 15px;
    line-height: 1.5;
}

.utente .message-bubble {
    background-color: var(--primary-blue);
    color: #ffffff;
    border-bottom-right-radius: 2px;
}

.bot .message-bubble {
    background-color: var(--light-blue);
    color: var(--text-dark);
    border-bottom-left-radius: 2px;
}

/* Animazione di caricamento (Typing Indicator) */
.typing-indicator span {
    height: 8px;
    width: 8px;
    background: var(--text-light);
    display: inline-block;
    border-radius: 50%;
    animate: bounce 1.3s infinite;
    opacity: 0.4;
    margin: 0 2px;
}

    .typing-indicator span:nth-child(2) {
        animation-delay: 0.15s;
    }

    .typing-indicator span:nth-child(3) {
        animation-delay: 0.3s;
    }

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-6px);
    }
}

/* Input Area */
.chat-input-area {
    padding: 20px 30px;
    background: #ffffff;
    border-top: 1px solid var(--border-color);
}

.chat-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background: #fff;
}

    .chat-input-wrapper:focus-within {
        border-color: var(--primary-blue);
    }

    .chat-input-wrapper textarea {
        flex: 1;
        border: none;
        padding: 15px 60px 15px 15px;
        font-size: 15px;
        resize: none;
        outline: none;
        max-height: 120px;
    }

#chat-send-btn {
    position: absolute;
    right: 10px;
    background: var(--accent-orange);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

    #chat-send-btn:hover {
        background: #e65c00;
    }

.chat-disclaimer {
    font-size: 12px;
    color: var(--text-light);
    text-align: center;
    margin-top: 8px;
}

/* --- RESPONSIVE DESIGN --- */
@media (max-width: 768px) {
    .chat-sidebar {
        display: none;
    }
    /* Nasconde la sidebar su mobile */
    .chat-messages-container {
        padding: 15px;
    }

    .message {
        max-width: 90%;
    }

    .chat-input-area {
        padding: 15px;
    }
}