﻿@import url("color-scheme.css"); /* Color scheme */

/* ------------------------------
    CSS WHATSAPP
--------------------------------*/

/* WRAPPER CHAT CENTRATA */
#waChatWrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    padding-top: 0px; /* margine uniforme su tutti i lati */
    padding-left: 25px; /* margine uniforme su tutti i lati */
    padding-right: 25px;
    padding-bottom: 25px;
    box-sizing: border-box;
}


/* CONTENITORE CHAT + COLONNA CONTATTI */
.wa-chat-inner {
    display: flex;
    gap: 20px;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
}


/* COLONNA CONTATTI */
.wa-contacts {
    width: 320px; /* allargata */
    background: #fff;
    border-radius: 10px;
    padding: 0;
    height: 100%;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    overflow: hidden; /* niente scroll */
}


/* TOP BAR */
.wa-contacts-topbar {
    background: #075E54;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    color: white;
}


/* RICERCA */
.wa-contacts-search {
    background: #f6f6f6;
    padding: 8px 10px;
    border-bottom: 1px solid #d1d7db;
}

.wa-contacts-search input {
        width: 100%;
        padding: 8px 32px;
        border-radius: 20px;
        background: white;
        border: 1px solid #ddd;
    }


/* LISTA CONTATTI — QUI LO SCROLL */
.wa-contacts-list {
    overflow-y: auto;
    height: calc(100% - 120px);
}


/* CONTATTO */
.wa-contact-item {
    display: flex;
    align-items: center;
    padding: 14px;
    border-bottom: 1px solid #f0f2f5;
    cursor: pointer;
    transition: background .2s;
}

.wa-contact-item:hover {
        background: #f5f6f6;
    }

.wa-contact-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    margin-right: 14px;
}

.wa-contact-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.wa-contact-name {
    font-weight: 600;
    font-size: 15px;
    color: #111;
}

.wa-contact-lastmsg {
    font-size: 13px;
    color: #666;
    max-width: 220px; /* allargata */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* CHAT */
.wa-chat-container {
    flex: 1; /* prende tutto lo spazio restante */
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 10px;
    height: 100%;
    min-width: 300px; /* larghezza minima per non schiacciare */
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}


/* HEADER */
.wa-chat-header {
    display: flex;
    align-items: center;
    padding: 12px;
    background: #075e54;
    color: white;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
}

.wa-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    margin-right: 12px;
    object-fit: cover;
}

.wa-chat-title {
    font-weight: bold;
    font-size: 16px;
}


/* MESSAGGI */
.wa-chat-messages {
    flex: 1;
    overflow-y: auto; /* scroll attivo */
    padding: 16px;
    display: flex;
    flex-direction: column;
    background: #ece5dd;
}


/* INPUT */

.wa-input {
    flex: 1;
    padding: 10px 14px;
    border-radius: 20px;
    border: 1px solid #ccc;
    min-height: 42px;
    max-height: 100px;
    overflow-y: auto;
    outline: none;
    white-space: pre-wrap;
}

.wa-input:empty:before {
    content: attr(placeholder);
    color: #999;
}

.wa-chat-input {
    display: flex;
    align-items: center;
    padding: 10px;
    background: #f0f0f0;
    border-top: 1px solid #ccc;
    gap: 6px;
}

    .wa-chat-input input {
        flex: 1;
        padding: 10px 14px;
        border-radius: 20px;
        border: 1px solid #ccc;
    }

    .wa-chat-input button {
        width: 42px;
        height: 42px;
        border-radius: 50%;
        border: none;
        cursor: pointer;
        font-size: 18px;
    }

.wa-attach {
    background: #fff;
    font-weight: bold;
}

.wa-emoji {
    background: #fff;
}

/*#waSendBtn {
    background: #075e54;
    color: white;
}
*/

/* ------------------------------
   MESSAGGI BOLLE + ANIMAZIONI
--------------------------------*/

.wa-msg {
    max-width: 70%;
    padding: 8px 12px;
    margin: 6px 0;
    border-radius: 10px;
    font-size: 15px;
    line-height: 19px;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(10px);
    animation: waFadeUp .25s ease-out forwards;
}

/* mio messaggio */
.wa-msg.me {
        background: #dcf8c6;
        margin-left: auto;
        border-bottom-right-radius: 2px;
    }

/* messaggio ricevuto */
.wa-msg.other {
        background: #fff;
        margin-right: auto;
        border-bottom-left-radius: 2px;
    }

/* Animazione WhatsApp */
@keyframes waFadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Spunte */
/*.wa-ticks {
    font-size: 12px;
    margin-top: 4px;
    text-align: right;
    color: #777;
}

.wa-ticks.delivered {
        color: #4a90e2;
    }

.wa-ticks.read {
        color: #0eb3ff;
    }*/

/* Timestamp */
.wa-time {
    font-size: 10px;
    color: #999;
    align-self: flex-end;
    margin-top: 2px;
}

/* Spunte */
.wa-ticks {
    font-size: 12px;
    color: #777;
    align-self: flex-end;
    margin-top: 2px;
}

    /* Spunte consegnato */
    .wa-ticks.delivered {
        color: #4a90e2;
    }

    /* Spunte lette */
    .wa-ticks.read {
        color: #0eb3ff;
    }

/* Pop-in animazione (usiamo la tua waFadeUp già esistente) */
.wa-msg {
    animation: waFadeUp .25s ease-out forwards;
    opacity: 0;
    transform: translateY(10px);
}

/* ------------------------------
   INDICATORE "sta scrivendo…"
--------------------------------*/

.wa-typing {
    background: #fff;
    padding: 6px 10px;
    border-radius: 10px;
    width: fit-content;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0;
    animation: waFadeUp .25s ease-out forwards;
}

.wa-dot {
    width: 6px;
    height: 6px;
    background: #555;
    border-radius: 50%;
    animation: waBlink 1.2s infinite;
}

    .wa-dot:nth-child(2) {
        animation-delay: .2s;
    }

    .wa-dot:nth-child(3) {
        animation-delay: .4s;
    }

@keyframes waBlink {
    0% {
        opacity: .2;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: .2;
    }
}


/* ------------------------------
   CONTATTI FILTRABILI
--------------------------------*/

.wa-contacts-search {
    margin-bottom: 10px;
}

.wa-contacts-search input {
        width: 100%;
        padding: 8px;
        border-radius: 6px;
        border: 1px solid #ccc;
    }

.wa-contacts p.active {
    background: #e5f3f1;
    border-radius: 6px;
    font-weight: bold;
}


/* TOP BAR VERDE (WHATSAPP WEB) */
.wa-contacts-topbar {
    background: #075E54;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    color: white;
}

.wa-top-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.wa-top-icons {
    display: flex;
    gap: 20px;
}

.wa-icon {
    font-size: 18px;
    cursor: pointer;
    opacity: .9;
    transition: .2s;
}

    .wa-icon:hover {
        opacity: 1;
    }


/* RICERCA WHATSAPP WEB */
.wa-contacts-search {
    background: #f6f6f6;
    padding: 8px 10px;
    border-bottom: 1px solid #d1d7db;
}

.wa-contacts-search input {
        width: 100%;
        padding: 8px 32px;
        border-radius: 20px;
        background: white;
        border: 1px solid #ddd;
    }


/* LISTA CONTATTI */

.wa-contacts-list {
    overflow-y: auto;
    height: calc(100% - 120px);
}


/* CONTATTO */

.wa-contact-item {
    display: flex;
    align-items: center;
    padding: 14px;
    border-bottom: 1px solid #f0f2f5;
    cursor: pointer;
    transition: background .2s;
}

    .wa-contact-item:hover {
        background: #f5f6f6;
    }

.wa-contact-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    margin-right: 14px;
}


/* CONTENUTO TESTO */

.wa-contact-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.wa-contact-top {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.wa-contact-name {
    font-weight: 600;
    font-size: 15px;
    color: #111;
}

.wa-contact-time {
    font-size: 12px;
    color: #999;
}

.wa-contact-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wa-contact-lastmsg {
    font-size: 13px;
    color: #666;
    max-width: 180px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* BADGE MESSAGGI NON LETTI */

.wa-unread-badge {
    background: #25D366;
    color: white;
    padding: 2px 7px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}

.wa-day-separator {
    text-align: center;
    margin: 10px 0;
    font-size: 12px;
    color: #999;
}


/* EMOJI */

#waAttachPopup {
    display: none; /* <- IMPORTANTISSIMO! */
    position: fixed;
    background: white;
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    flex-direction: column;
    gap: 8px;
    width: 200px;
    z-index: 1000;
}

#waAttachPopup .attach-option {
        display: flex;
        align-items: center;
        gap: 8px;
        background: none;
        border: none;
        padding: 6px 8px;
        border-radius: 8px;
        cursor: pointer;
        transition: background-color 0.2s ease;
    }

#waAttachPopup .attach-option:hover {
            background-color: #f0f0f0;
        }

#waAttachPopup .attach-icon {
        font-size: 20px;
    }

#waAttachPopup .attach-label {
        font-size: 14px;
        font-weight: 500;
    }

/* Anteprima file */
#waFilePreviewContainer {
    display: none; /* parte nascosto */
    position: fixed; /* meglio fixed per restare al centro dello schermo */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); /* centro esatto */
    width: 90%; /* puoi aumentare fino al 100% se vuoi */
    max-width: 600px; /* ingrandisci il massimo */
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
    z-index: 2000;
    padding: 20px; /* più spazio interno */
}

#waFilePreviewContent {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#waFilePreviewImages img {
    width: 100%; /* occupa tutta la larghezza del riquadro */
    border-radius: 10px;
    max-height: 400px; /* limita altezza se vuoi */
    object-fit: contain;
}

#waPreviewCloseBtn {
    align-self: flex-end;
    background: none;
    border: none;
    font-size: 22px; /* più grande */
    cursor: pointer;
}

#waPreviewSendBtn {
    background-color: #25d366;
    color: white;
    border: none;
    border-radius: 25px; /* più tondo */
    padding: 12px 20px; /* pulsante più grande */
    cursor: pointer;
    font-weight: 600;
    font-size: 16px;
}

#waPreviewSendBtn:hover {
        background-color: #1ebe5b;
    }

/* Emoji Picker */
#waEmojiPickerWrapper {
    display: none;
    position: fixed;
    z-index: 9999;
}

#pickerContainer {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    overflow: hidden;
}

#waEmojiTriangle {
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 12px solid white;
    position: absolute;
    bottom: -12px;
    left: 30px;
}

.bubblePreview {
    max-width: 250px;
    padding: 8px;
    background: #e1ffc7;
    border-radius: 12px;
}

.bubblePreview-img {
    width: 180px; /* Riduci qui l’anteprima */
    height: auto;
    border-radius: 8px;
    object-fit: cover;
}

#img-preview-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    justify-content: center;
    align-items: center;
    z-index: 9999;
    flex-direction: column;
    display: flex;
}

    #img-preview-overlay img {
        max-width: 90%;
        max-height: 80%;
        border-radius: 8px;
        box-shadow: 0 0 10px #000;
    }

#img-preview-close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 30px;
    color: white;
    cursor: pointer;
    z-index: 10000;
}

.bubblePreview-img {
    width: 120px; /* tua miniatura */
    border-radius: 10px;
    cursor: pointer;
}


.wa-unread-badge {
    background-color: red;
    color: white;
    font-size: 12px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    margin-left: 8px; /* distanza dal testo */
}

.wa-contacts [data-idcliente] {
    position: relative;
}

/*POPUP AUDIO*/
 .audio-popup {
   display: none;  
    position: absolute;
    background: #dcf8c6;
    border-radius: 12px;
    padding: 10px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
    min-width: 280px;
    z-index: 1000;
}

.audio-bubble {
    display: flex;
    align-items: center;
    gap: 8px;
}

.audio-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: #555;
}

.audio-progress {
    flex: 1;
}


/* ====== INPUT WRAPPER ====== */

.wa-chat-input-wrapper {
    padding: 12px;
}

/* ====== BOLLA INPUT ====== */

/**/
.wa-input-area {
    position: relative;
    width: 100%;
    min-height: 52px;
    background: #fff;
    border-radius: 25px;
    display: flex;
    align-items: flex-end;
    padding: 8px 10px;
    box-sizing: border-box;
}

.wa-textarea-wrapper {
    flex: 1;
    display: flex;
    align-items: flex-end;
}

.wa-btn {
    flex-shrink: 0; /* 🔥 IMPORTANTISSIMO */
}


/* ====== INPUT ====== */
#waInput {
    flex: 1;
    resize: none;
    border: none;
    outline: none;
    min-height: 22px;
    max-height: calc(22px * 6); /* 6 righe max */
    overflow-y: auto; /* 🔥 scroll SOLO QUI */
    padding: 6px 8px;
    font-size: 14px;
    line-height: 22px;
    background: transparent;
    padding-left: 95px;
    padding-right: 70px;
}


/* ====== BOTTONI ICONA ====== */

.wa-input-area .wa-btn {
    position: absolute;
    background: none;
    border: none;
    font-size: 22px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #54656F;
    z-index: 50; /* sopra input */
    margin-right:30px;
}

/* POSIZIONI ESATTE */
#waAttach {
    left: 15px;
}

#waEmoji {
    left: 55px;
}

#record-btn {
    right: 15px;
}

#waSendBtn {
    right: 15px;
    display: none;
}

/* ICONA */
/*.wa-input-area .wa-btn i {
    color: #54656F;
    font-size: 22px;
}*/

.chat-input {
    min-height: 40px;
    max-height: 150px;
    overflow-y: auto;
    padding: 8px;
    border-radius: 20px;
    border: 1px solid #ccc;
}

    .chat-input:empty:before {
        content: attr(data-placeholder);
        color: #999;
    }

#RichiestaLead {
    height: auto;
}

/* Stile base pulsante */
.btn-toggle {
    padding: 6px 18px;
    border: 1px solid #007bff;
    background-color: #ffffff;
    color: #007bff;
    border-radius: 20px; /* arrotondato tipo pill */
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

    /* Hover */
    .btn-toggle:hover {
        background-color: #007bff;
        color: white;
    }

    /* Stato attivo */
    .btn-toggle.active {
        background-color: #007bff;
        color: white;
        box-shadow: 0 2px 6px rgba(0, 123, 255, 0.4);
    }


/* Wrapper della partial view */
/*.wa-wrapper {
    max-height: 600px;*/ /* Altezza massima */
    /*overflow-y: auto;*/ /* Abilita scroll verticale */
    /*border: 1px solid #ccc;*/ /* Facoltativo, solo per vedere il container */
    /*padding: 10px;*/ /* Spazio interno */
    /*background: #f9f9f9;*/ /* Facoltativo */
/*}*/

/* Stile contenitore chat */
.wa-chat-container p {
    margin: 5px 0;
}

.wa-wrapper {
    max-height: 450px; /* altezza massima */
    overflow-y: auto; /* scroll verticale */
    padding: 10px;
    background: #f9f9f9;
}

/* #wa-messages non deve avere overflow o altezza */
#wa-messages {
    display: flex;
    flex-direction: column;
}

/* MOBILE */
@media (max-width: 768px) {
    .wa-chat-inner {
        flex-direction: column;
        align-items: center;
    }

    .wa-contacts {
        display: none;
    }

    .wa-chat-container {
        width: 100%;
        max-width: 420px;
    }

    .wa-chat-messages {
        height: 300px;
    }
}