/* assets/css/chatbot.css */

/* Box-sizing base per tutti gli elementi della chat */
#chat-widget-container *,
#chat-widget-container *::before,
#chat-widget-container *::after {
    box-sizing: border-box;
}

/* Stili Toggle */
#chat-toggle-wrapper {
   position: fixed;
   bottom: 20px;
   right: 20px;
   width: 70px;
   height: auto;
   display: flex;
   flex-direction: column;
   align-items: center;
   z-index: 9999;
}
#chat-toggle {
    font-size: 16px !important;
    touch-action: manipulation !important;
    position: fixed !important;
    bottom: 50px !important;
    right: 20px !important;
    width: 70px !important;
    height: 70px !important;
    background: url('../Images/toggle-bebot-chat.png') no-repeat center center !important; /* Usa percorso relativo */
    background-size: contain !important;
    background-color: transparent !important;
    border: none !important;
    cursor: pointer !important;
    z-index: 9998 !important;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none; 
}
#chat-toggle-indicator {
    position: fixed !important;
    bottom: 55px !important;
    right: 25px !important;
    width: 60px !important;
    height: 60px !important;
    border-radius: 50%;
    z-index: 9997 !important;
    /* Il background-color verrà aggiunto inline da PHP */
}
/* Stili Chatbot Container */
#chatbot {
    position: fixed;
    bottom: 120px;
    right: 30px;
    width: 320px;
    max-height: 450px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.25);
    display: none; /* Inizia nascosto */
    flex-direction: column; /* Impila header, log, input */
    z-index: 9999;
    overflow: hidden; /* Nasconde contenuto extra */
    animation: slideUp 0.3s ease-out;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; /* Font stack più moderno */
}
#chat-header {
    position: relative;
    top: 50%;
    color: #fff;
    padding: 0 14px;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: left; /* CENTRA il testo */
    height: 35px;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
}
#chat-header::after {
    content: "Chatta con " attr(data-botname);
    display: block;
}
#chat-header #bebot-close-btn {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #ffffff;
    font-size: 22px;
    font-weight: 300;
    cursor: pointer;
    opacity: 0.7;
    line-height: 1;
    height: 24px;
    width: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    outline: none;
}
#bebot-close-btn {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 22px;
    font-weight: 300;
    cursor: pointer;
    opacity: 0.7;
    padding: 0;
    margin: 0;
    line-height: 1;
    height: 24px;
    width: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    outline: none;
}
#bebot-close-btn:hover {
    opacity: 1;
}
#chat-header #bebot-close-btn:hover {
    opacity: 1;
}
#chatbot #chat-header #bebot-close-btn:hover {
     opacity: 1; /* Opacità piena al passaggio del mouse */

}
#chat-log {
    flex: 1; /* Occupa lo spazio rimanente */
    overflow-y: auto; /* Scroll verticale */
    padding: 10px;
    background-color: #f4f4f4;
    scrollbar-width: thin;
    scrollbar-color: #ccc #f4f4f4;
}
#chat-log::-webkit-scrollbar { width: 6px; }
#chat-log::-webkit-scrollbar-track { background: #f4f4f4; }
#chat-log::-webkit-scrollbar-thumb { background-color: #ccc; border-radius: 3px; border: 1px solid #f4f4f4; }
/* Stili Messaggi */
#chat-log div {
    margin-bottom: 10px;
    max-width: 80%;
    padding: 6px 10px;
    border-radius: 16px;
    line-height: 1.4;
    word-wrap: break-word;
    clear: both;
    opacity: 0;
    animation: fadeIn 0.4s ease forwards;
    font-size: 13px;
}
#chat-log div strong {
    display: block;
    margin-bottom: 2px;
    font-weight: 600;
    font-size: 12px;
}
#chat-log div.bot {
    background-color: #e0e0e0; /* Colore di default bot */
    float: left;
    border-bottom-left-radius: 4px;
    color: #333;
}
#chat-log div.user {
    color: #fff; /* Colore testo utente */
    float: right;
    border-bottom-right-radius: 4px;
    /* Il background-color verrà aggiunto inline da PHP */
}

/* === Stili aggiornati per i Link nei messaggi (Pillole) === */
#chat-log div a {
    /* Aspetto Box/Pillola */
    display: inline-block;    /* Necessario per applicare padding/bordi correttamente */
    padding: 3px 9px;       /* Spazio interno (verticale, orizzontale) - aggiusta se vuoi */
    border-radius: 14px;    /* Angoli arrotondati per effetto pillola */
    background-color: rgba(0, 0, 0, 0.06); /* Sfondo grigio chiaro semi-trasparente (cambia se vuoi) */

    /* Stile Testo */
    color: #007aff;          /* Colore testo link (blu iOS-like, puoi cambiarlo) */
    text-decoration: none;    /* Rimuove la sottolineatura standard */
    font-weight: 500;         /* Leggermente bold (opzionale) */
    font-size: inherit;       /* Usa dimensione font del messaggio */
    line-height: 1.4;         /* Altezza linea per spaziatura interna */

    /* Spaziatura e Transizione */
    margin: 1px 2px;        /* Piccolo margine attorno al link */
    transition: background-color 0.2s ease, color 0.2s ease; /* Transizione per hover */
}

/* Effetto al passaggio del mouse (hover) e focus */
#chat-log div a:hover,
#chat-log div a:focus {
    background-color: rgba(0, 0, 0, 0.09); /* Sfondo leggermente più scuro */
    color: #005ecb;          /* Testo leggermente più scuro */
    text-decoration: none;    /* Mantiene senza sottolineatura */
}
/* Stile specifico per i link DENTRO le bolle UTENTE (assicura contrasto) */
/* Se la tua bolla utente ha uno sfondo molto scuro, potresti aver bisogno di colori diversi */
#chat-log div.user a {
    /* Esempio: sfondo bianco semi-trasparente e testo bianco */
     background-color: rgba(255, 255, 255, 0.2);
     color: #ffffff;
}
 #chat-log div.user a:hover,
 #chat-log div.user a:focus {
      background-color: rgba(255, 255, 255, 0.3);
      color: #ffffff;
 }
/* === Fine Stili Link === */
/* Stili Area Input Fissa */
#input-wrapper {
    align-items: center;
    height: 70px;
    display: flex;
    padding: 10px;
    background-color: #fff;
    border-top: 1px solid #ddd;
    flex-shrink: 0;
}
#user-input {
    margin: 0px 0px 20px 0px;
    align-items: center;
    margin-top: 20px !important;
    flex-grow: 1;
    height: 30px !important;
    line-height: normal !important;
    padding: 6px 10px 6px 10px !important;
    border: 1px solid #ccc !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    background-color: #fff !important;
    color: #000 !important;
}
#send-btn {
    align-items: center;
    color: #fff;
    border: none;
    border-radius: 8px;
    margin: 5px 5px 5px 5px !important;
    padding: 0 14px;
    font-size: 16px;
    cursor: pointer;
    flex-shrink: 0;
    height: 38px;
    line-height: 0px;
    text-align: center;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Animazioni */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp {
    from { transform: translateY(50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
/* =================================== */
/* === Stili Mobile (Full Screen) === */
/* =================================== */
/* Dentro assets/css/chatbot.css */

@media (max-width: 600px) {

    #chatbot {
        position: fixed;
        bottom: 120px;
        right: 10px;
        width: calc(95%);
        max-height: calc(80%);
        background: #ffffff;
        border-radius: 16px;
        box-shadow: 0 8px 20px rgba(0,0,0,0.25);
        display: none;
        flex-direction: column;
        z-index: 9999;
        overflow: hidden;
        animation: slideUp 0.3s ease-out;
        font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
        /* RIMOSSO: font-size: 16px !important; da qui */
    }

    #chat-log {
        padding: 15px;
    }

    /* --- NUOVO: Aumenta font-size SOLO per input su mobile --- */
    #chatbot #input-wrapper #user-input {
        font-size: 16px !important; /* Forza 16px sull'input per evitare zoom iOS */
        /* padding: 7px 12px !important; */ /* Decommenta e aggiusta se necessario */
    }
    /* --- FINE NUOVA REGOLA --- */

    /* Commenti e stili bottone chiusura (se li hai lasciati) ... */

} /* Chiusura della @media query */