/* =========================
   CHATBOX
   ========================= */
#chatbox {
    padding: 0;
    position: fixed;
    bottom: 5%;
    right: 20px;
    width: 340px;
    display: none;
    z-index: 1060;
    border-radius: 12px;
    margin: 10px 10px 40px 10px;
}

/* =========================
   BOTTONE CHAT (toggle)
   ========================= */
#chat-toggle {
    height: 50px !important;
    width: 50px;
    background: linear-gradient(135deg,#ff640b,#e55300);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 0 12px rgba(255, 100, 11, 0.6);
    /* layout interno */
    display: flex;
    align-items: center;
    justify-content: flex-end; /* icona sempre a destra */
    gap: 8px;
    overflow: hidden;
    white-space: nowrap;
    transition: width 0.4s ease,
                box-shadow 0.2s ease,
                background 0.2s ease;
}

/* Hover bottone */
#chat-toggle:hover {
    width: 120px;
    background: linear-gradient(135deg,#ff7a2b,#ff640b);
    box-shadow: 0 0 20px rgba(255, 100, 11, 0.9);
}

/* Icona dentro il bottone */
#chat-toggle img {
    width: 28px;
    height: 28px;
    flex-shrink: 0; /* evita che l’icona venga compressa */
}

/* Testo che appare in hover */
#chat-toggle span {
    opacity: 0;
    transform: translateX(10px);
    transition: opacity 0.25s ease,
                transform 0.25s ease;
}

#chat-toggle:hover span {
    opacity: 1;
    transform: translateX(0);
}

.card-header {
    background: #6c757d;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-radius: calc(0.375rem - (1px))
                   calc(0.375rem - (1px))
                   0 0;
    border: 1px solid #6c757d;
}

.card-body {
    padding: 10px;
}

.card-footer {
    display: flex;
    padding: 8px;
    background-color: #21252908;
    border-top: 1px solid #0000002d;
}

.btn {
    border: none;
    cursor: pointer;
}

.btn-close {
    cursor: pointer;
    background:
        url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414'/%3e%3c/svg%3e")
        center /1em auto no-repeat;
    padding: .25em .25em;
    border: 0;
    border-radius: .375rem;
    width: 1em;
    height: 1em;
    box-sizing: content-box;
    filter: invert(1) grayscale(100%) brightness(200%);
}

.btn-close:hover {
    color: #fff;
    text-decoration: none;
    opacity: 0.75;
}

.shadow-lg {
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

/* =========================
   CAMPO INPUT
   ========================= */
.form-control {
    margin-bottom: 0px !important;
    margin-right: .5rem !important;
    height: auto !important;
    display: block;
    padding: .375rem .75rem !important;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #212529;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-color: #fff !important;
    background-clip: padding-box;
    border: 1px solid #dee2e6 !important;
    border-radius: .375rem !important;
    transition: border-color .15s ease-in-out,
                box-shadow .15s ease-in-out;
}

.form-control:focus {
    color: #212529;
    background-color: #fff !important;
    border-color: #e5a815 !important;
    outline: 0;
    box-shadow: 0 0 0 .1rem rgb(246 94 8) !important;
}

/* =========================
   RIGHE CHAT
   ========================= */
.chat-row {
    display: flex;
    margin: 6px 0;
}

.chat-row.user {
    justify-content: flex-end;
}

.chat-row.bot {
    justify-content: flex-start;
}

/* =========================
   BUBBLE CHAT
   ========================= */
.chat-bubble {
    overflow-wrap: break-word;
    max-width: 75%;
    padding: 8px 12px;
    border-radius: 14px;
    font-size: 1.2rem;
    line-height: 1.4;
}

/* Messaggio utente */
.user-bubble {
    background: #FF640B;
    color: white;
    border-bottom-right-radius: 4px;
}

/* Messaggio bot */
.bot-bubble {
    background: #f1f1f1;
    color: #333;
    border-bottom-left-radius: 4px;
}

.parole-arancioni {
    color: #FF640B;
    font-weight: bold;
}

/* =========================
   BOTTONI INVIO MESSAGGIO CHATBOX
   ========================= */
.btn-utility {
    line-height: 0;
    background: linear-gradient(135deg, #ff640b, #e55300);
    color: #fff;
    padding: 6px 10px;
}

.btn-utility:hover {
    background: linear-gradient(135deg, #ff7a2b, #ff640b);
    color: #6c757d57;
}