/* Container principale: eredita font e colori base dal tema */
#sdc-chatbot-container {
    max-width: 550px;
    margin: 30px auto;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 12px;
    padding: 25px;
    background: #ffffff; /* Fondo bianco per pulizia visiva */
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
}

/* Schermata Intro e Privacy */
#sdc-intro-screen h2 {
    margin-top: 0;
    color: inherit;
}

.sdc-privacy-box {
    background: rgba(0,0,0,0.02);
    padding: 15px;
    border-radius: 8px;
    font-size: 0.9em;
    margin: 20px 0;
    text-align: left;
    border-left: 4px solid #0073aa;
}

/* Finestra di Chat: Sistemata per lo scroll */
#sdc-chat-window {
    height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    /* Aggiunto padding laterale per staccare i box dallo scroll */
    padding: 10px 15px 10px 10px; 
    margin-bottom: 15px;
}

/* Personalizzazione barra di scorrimento (Webkit) */
#sdc-chat-window::-webkit-scrollbar {
    width: 6px;
}

#sdc-chat-window::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

#sdc-chat-window::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

#sdc-chat-window::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Supporto per Firefox */
#sdc-chat-window {
    scrollbar-width: thin;
    scrollbar-color: #ccc #f1f1f1;
}

/* Messaggi */
.sdc-chat-message {
    padding: 12px 16px;
    border-radius: 15px;
    margin-bottom: 15px; /* Aumentato il distacco tra i messaggi */
    line-height: 1.4;
    max-width: 85%;
    font-size: 15px;
    position: relative;
    word-wrap: break-word;
}

/* Messaggio del Bot */
.sdc-bot-message {
    background: #f1f1f1;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

/* Messaggio dell'Utente: distanziato dalla destra */
.sdc-user-message {
    background: #0073aa;
    color: #ffffff;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
    /* Margine destro aggiuntivo per sicurezza */
    margin-right: 5px; 
}

/* Bottoni */
.sdc-chat-options button, 
#sdc-start-btn, 
#sdc-user-form button {
    background-color: #0073aa;
    color: #ffffff !important;
    border: none;
    padding: 10px 18px;
    margin: 5px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    font-family: inherit;
    transition: all 0.2s ease;
}

.sdc-chat-options button:hover:not(:disabled), 
#sdc-start-btn:hover:not(:disabled) {
    background-color: #005a87;
    transform: translateY(-1px);
}

#sdc-start-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* Form finale */
#sdc-user-form {
    width: 100%;
    margin-top: 10px;
}

#sdc-user-form input {
    width: 100%;
    padding: 12px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: inherit;
    box-sizing: border-box;
}

/* Spinner e Risultato */
.sdc-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: sdc-spin 1s linear infinite;
    margin: 15px auto;
}

@keyframes sdc-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#sdc-result {
    text-align: center;
}

#sdc-result img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin-top: 20px;
    display: inline-block;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}