/* GRC WhatsApp - Gabriele Rispoli Consulting - v1.1.0 */
#grc-wa-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    z-index: 999;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.grc-wa-launcher {
    width: 60px; height: 60px; border-radius: 50%; border: none; cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex; align-items: center; justify-content: center;
    animation: grc-pulse 2s infinite; transition: transform 0.3s ease;
}
.grc-wa-launcher:hover { transform: scale(1.05); }
.grc-wa-launcher img { width: 35px; height: 35px; }

@keyframes grc-pulse {
    0% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.5); }
    70% { box-shadow: 0 0 0 15px rgba(37, 211, 102, 0); }
    100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}

/* Finestra Chat - Limitazione altezza per evitare allungamenti */
#grc-wa-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    max-height: 75vh; /* NON si allungherà oltre il 75% dello schermo */
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
#grc-wa-window.grc-hidden {
    transform: scale(0); opacity: 0; pointer-events: none;
}

@media (max-width: 480px) {
    #grc-wa-widget { bottom: env(safe-area-inset-bottom, 15px); right: 15px; }
    #grc-wa-window {
        position: fixed; bottom: 0; right: 0; width: 100%; height: 100%; max-height: -webkit-fill-available; border-radius: 0; z-index: 100000;
    }
}

.grc-wa-header { padding: 15px; display: flex; justify-content: space-between; align-items: center; }
.grc-header-info { display: flex; align-items: center; gap: 10px; }
.grc-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.grc-online-status { display: block; font-size: 12px; opacity: 0.8; }
#grc-wa-close { background: none; border: none; color: inherit; font-size: 24px; cursor: pointer; }

/* Corpo Chat con Scroll intelligente */
.grc-wa-body {
    padding: 15px;
    flex: 1; /* Prende tutto lo spazio disponibile */
    overflow-y: auto; /* Abilita lo scroll */
    overscroll-behavior-y: contain;
    background: #e5ddd5;
}

.grc-msg {
    padding: 10px 15px; border-radius: 10px; margin-bottom: 15px; max-width: 85%;
    font-size: 14px; line-height: 1.4; word-wrap: break-word;
}
.grc-msg-bot { background: #fff; border-top-left-radius: 0; box-shadow: 0 1px 2px rgba(0,0,0,0.1); }
.grc-msg-user { background: #dcf8c6; border-top-right-radius: 0; margin-left: auto; box-shadow: 0 1px 2px rgba(0,0,0,0.1); }

.grc-faq-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.grc-faq-btn { background: #fff; border: 1px solid #ddd; padding: 10px; border-radius: 20px; text-align: left; font-size: 13px; cursor: pointer; transition: background 0.2s; }
.grc-faq-btn:hover { background: #f9f9f9; }
.grc-orders-btn { border-color: #007cba; color: #007cba; font-weight: bold; }

/* Stili per il form di tracciamento ordini nella chat */
.grc-track-form { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.grc-track-form input { padding: 8px; border: 1px solid #ccc; border-radius: 5px; font-size: 13px; width: 100%; box-sizing: border-box; }
.grc-track-form button { background: #25D366; color: #fff; border: none; padding: 8px; border-radius: 5px; font-weight: bold; cursor: pointer; }

.grc-wa-footer { padding: 10px; background: #f0f0f0; border-top: 1px solid #ddd; }
.grc-wa-btn-main { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px; border-radius: 25px; text-decoration: none; font-weight: bold; font-size: 14px; transition: opacity 0.2s; }
.grc-wa-btn-main:hover { opacity: 0.9; }
.grc-btn-icon { width: 20px; height: 20px; filter: brightness(0) invert(1); }