/* Chat - stili */
/* Nasconde la bolla standard di Respond.io quando chiusa, per usare il nostro launcher brandizzato */
#dbee1 iframe[state="widgetClose"],
iframe[title="Webchat Widget"][state="widgetClose"],
#dbee1 iframe.bda45 {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}
#dbee1 iframe[state="widgetOpen"],
#dbee1 iframe.c8d90 {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    z-index: 2147483647 !important;
}

/* Pulsante Flottante Launcher */
.crc-chat-launcher {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 2147483640;
    background: linear-gradient(135deg, #198754 0%, #157347 100%);
    color: #ffffff;
    border: none;
    border-radius: 50px;
    padding: 12px 20px;
    font-weight: 600;
    font-size: 15px;
    box-shadow: 0 8px 24px rgba(25, 135, 84, 0.35);
    cursor: pointer;
    transition: all 0.25s ease-in-out;
    display: flex;
    align-items: center;
    gap: 10px;
}
.crc-chat-launcher:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 12px 28px rgba(25, 135, 84, 0.45);
    background: linear-gradient(135deg, #157347 0%, #0f5132 100%);
    color: #ffffff;
}
.crc-chat-launcher .online-dot {
    width: 10px;
    height: 10px;
    background-color: #22c55e;
    border-radius: 50%;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.4);
    animation: crc-pulse 2s infinite;
}

/* Card di Benvenuto con le Scelte dei Reparti */
/* Mobile: launcher rotondo con sola icona, ben dentro lo schermo a destra */
@media (max-width: 576px) {
    .crc-chat-launcher {
        right: 16px;
        bottom: 16px;
        width: 56px;
        height: 56px;
        padding: 0;
        border-radius: 50%;
        justify-content: center;
        gap: 0;
    }
    .crc-chat-launcher svg {
        width: 24px;
        height: 24px;
    }
    .crc-chat-launcher .crc-chat-launcher-label {
        display: none;
    }
    .crc-chat-launcher .online-dot {
        position: absolute;
        top: 4px;
        right: 4px;
    }
    .crc-chat-card {
        right: 16px !important;
        bottom: 84px !important;
    }
}

.crc-chat-card {
    position: fixed;
    bottom: 85px;
    right: 25px;
    z-index: 2147483641;
    width: 360px;
    max-width: calc(100vw - 32px);
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18), 0 4px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.08);
    overflow: hidden;
    display: none;
    flex-direction: column;
    animation: crc-slide-up 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.crc-chat-card-header {
    background: linear-gradient(135deg, #198754 0%, #157347 100%);
    color: #ffffff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.crc-chat-card-body {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background-color: #f8fafc;
}
.crc-dept-btn {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 13px 15px;
    text-align: left;
    width: 100%;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: #1e293b;
}
.crc-dept-btn:hover {
    background: #ffffff;
    border-color: #198754;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(25, 135, 84, 0.12);
    color: #157347;
}
.crc-dept-icon {
    font-size: 22px;
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background-color: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
}
.crc-dept-btn:hover .crc-dept-icon {
    background-color: #e8f5e9;
}
.crc-dept-title {
    font-weight: 600;
    font-size: 14.5px;
    margin-bottom: 2px;
    display: block;
}
.crc-dept-desc {
    font-size: 11.5px;
    color: #64748b;
    display: block;
}

@keyframes crc-pulse {
    0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
    70% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}
/* Fascia "Sei connesso con il reparto" agganciata alla finestra della chat Respond.io */
.crc-chat-dept-banner {
    position: fixed;
    z-index: 2147483647;
    display: none;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    background: #e8f5e9;
    border: 1px solid #b7dfc0;
    border-radius: 14px 14px 0 0;
    color: #0f5132;
    font-size: 13px;
    line-height: 1.35;
    box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.08);
    box-sizing: border-box;
    pointer-events: auto;
}
.crc-chat-dept-banner.inside {
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}
.crc-chat-dept-banner .close-x {
    margin-left: auto;
    background: none;
    border: none;
    color: #0f5132;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
}

@keyframes crc-slide-up {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Classi di supporto (i siti WordPress non hanno Bootstrap) */
.crc-chat-card, .crc-chat-card *, .crc-chat-launcher, .crc-chat-dept-banner { box-sizing: border-box; font-family: inherit; }
.crc-chat-head-left { display: flex; align-items: center; gap: 8px; }
.crc-chat-head-title { font-weight: 700; font-size: 15px; }
.crc-chat-head-sub { font-size: 11px; opacity: 0.85; }
.crc-chat-head-dot { width: 9px; height: 9px; background-color: #22c55e; border-radius: 50%; display: inline-block; }
.crc-chat-close { background: none; border: 0; color: #ffffff; font-size: 22px; line-height: 1; cursor: pointer; padding: 0; }
.crc-chat-question { font-size: 13px; font-weight: 500; color: #64748b; }
.crc-chat-footer { background: #ffffff; padding: 8px 12px; border-top: 1px solid #e2e8f0; text-align: center; font-size: 11px; color: #94a3b8; }
.crc-chat-confirm { text-align: center; padding: 26px 20px !important; align-items: center; }
.crc-chat-confirm-title { font-size: 14.5px; font-weight: 600; color: #1e293b; }
.crc-chat-confirm-sub { font-size: 12.5px; color: #64748b; }
