/* public/css/public/live-chat.css
   Le 376 righe del widget di chat. Stavano in un <style> dentro a
   @push('styles'), quindi partivano dentro all'HTML della home a ogni visita. */

.nedate-live-chat-widget {
        position: fixed;
        right: 1.25rem;
        bottom: 1.25rem;
        z-index: 1080;
        font-family: var(--theme-font-base, inherit);
    }
    .nedate-chat-launcher {
        width: 4rem;
        height: 4rem;
        border: 0;
        border-radius: 999px;
        color: #fff;
        background: linear-gradient(135deg, var(--theme-primary), color-mix(in srgb, var(--theme-secondary) 72%, var(--theme-primary)));
        box-shadow: 0 18px 45px -14px color-mix(in srgb, var(--theme-primary) 58%, #000);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 1.55rem;
        position: relative;
        transition: transform .2s ease, box-shadow .2s ease;
    }
    .nedate-chat-launcher:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 22px 50px -14px color-mix(in srgb, var(--theme-primary) 70%, #000); }
    .nedate-chat-launcher__pulse {
        position: absolute;
        inset: -.35rem;
        border-radius: inherit;
        border: 1px solid color-mix(in srgb, var(--theme-primary) 42%, transparent);
        animation: nedateChatPulse 2.3s ease-out infinite;
    }
    .nedate-chat-launcher__badge {
        position: absolute;
        top: -.15rem;
        right: -.15rem;
        min-width: 1.35rem;
        height: 1.35rem;
        padding: 0 .35rem;
        border-radius: 999px;
        background: #ef4444;
        color: #fff;
        font-size: .72rem;
        font-weight: 800;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border: 2px solid #fff;
    }

    /* Desktop: the chat opens to the LEFT of the launcher, not above it. */
    .nedate-chat-panel {
        width: min(25.8rem, calc(100vw - 7.75rem));
        height: min(45rem, calc(100vh - 6rem));
        position: absolute;
        right: 5.25rem;
        bottom: 0;
        background: rgba(255,255,255,.98);
        border: 1px solid rgba(20, 39, 74, .10);
        border-radius: 1rem;
        box-shadow: 0 26px 80px -28px rgba(20,39,74,.45);
        overflow: hidden;
        backdrop-filter: blur(18px);
        transform-origin: bottom right;
        animation: nedateChatEnter .18s ease-out;
        display: flex;
        flex-direction: column;
        box-sizing: border-box;
    }
    .nedate-chat-panel[hidden] { display: none !important; }
    .nedate-chat-panel, .nedate-chat-panel * { box-sizing: border-box; }
    .nedate-chat-panel__header {
        min-height: 4.8rem;
        padding: 1rem 1.15rem;
        color: #fff;
        background: linear-gradient(135deg, var(--nd-public-red, #ff3b2f), #ff1f1f);
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 1rem;
        flex: 0 0 auto;
    }
    .nedate-chat-panel__avatar {
        width: 2.85rem;
        height: 2.85rem;
        border-radius: 999px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background: rgba(255,255,255,.14);
        font-size: 1.2rem;
        flex: 0 0 auto;
    }
    .nedate-chat-panel__status { font-size: .78rem; opacity: .95; display: flex; align-items: center; gap: .35rem; }
    .nedate-chat-panel__status span { width: .48rem; height: .48rem; border-radius: 999px; background: #22c55e; box-shadow: 0 0 0 .22rem rgba(34,197,94,.22); flex: 0 0 auto; }
    .nedate-chat-panel__close {
        width: 2.85rem;
        height: 2.85rem;
        border: 0;
        border-radius: 999px;
        color: #fff;
        background: rgba(255,255,255,.14);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 auto;
    }
    .nedate-chat-panel__body {
        flex: 1 1 auto;
        min-height: 0;
        padding: 1.25rem 1rem;
        overflow-y: auto;
        background:
            radial-gradient(circle at top left, rgba(255, 59, 47, .05), transparent 24rem),
            linear-gradient(180deg, #fbfcff 0%, #ffffff 100%);
        scroll-behavior: smooth;
    }
    .nedate-chat-empty {
        min-height: 12rem;
        height: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
        gap: .35rem;
        color: #64748b;
    }
    .nedate-chat-empty strong { color: #0f172a; font-size: 1rem; }
    .nedate-chat-empty__icon {
        width: 3rem;
        height: 3rem;
        border-radius: 1.1rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin-bottom: .3rem;
        color: var(--theme-primary);
        background: color-mix(in srgb, var(--theme-primary) 10%, #fff);
    }
    .nedate-chat-day-separator {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: .6rem;
        margin: .2rem 0 1.15rem;
        color: #64748b;
        font-size: .72rem;
        font-weight: 800;
        letter-spacing: .04em;
        text-transform: uppercase;
    }
    .nedate-chat-day-separator::before,
    .nedate-chat-day-separator::after {
        content: "";
        height: 1px;
        flex: 1 1 auto;
        background: linear-gradient(90deg, transparent, #e2e8f0, transparent);
    }
    .nedate-chat-day-separator span {
        padding: .5rem .85rem;
        border-radius: 999px;
        background: rgba(255,255,255,.88);
        border: 1px solid rgba(20, 39, 74, .08);
        box-shadow: 0 8px 22px -18px rgba(20,39,74,.45);
    }
    .nedate-chat-panel .nedate-chat-message {
        width: 100% !important;
        display: flex !important;
        align-items: flex-end !important;
        gap: .55rem;
        margin: 0 0 .85rem !important;
        padding: 0 !important;
        min-height: 0 !important;
    }
    .nedate-chat-panel .nedate-chat-message--admin { justify-content: flex-start !important; }
    .nedate-chat-panel .nedate-chat-message--visitor { justify-content: flex-end !important; }
    .nedate-chat-panel .nedate-chat-message__avatar {
        width: 1.9rem;
        height: 1.9rem;
        border-radius: 999px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 auto;
        color: #fff;
        font-size: .82rem;
        box-shadow: 0 10px 22px -14px rgba(15,23,42,.45);
    }
    .nedate-chat-panel .nedate-chat-message--admin .nedate-chat-message__avatar {
        background: linear-gradient(135deg, #24314c, #101a31);
    }
    .nedate-chat-panel .nedate-chat-message--visitor .nedate-chat-message__avatar {
        order: 2;
        background: linear-gradient(135deg, #7f1d1d, #3f1720);
    }
    .nedate-chat-panel .nedate-chat-bubble {
        display: block !important;
        flex: 0 1 auto !important;
        width: fit-content !important;
        min-width: 4.5rem !important;
        max-width: min(78%, 20rem) !important;
        height: auto !important;
        min-height: 0 !important;
        padding: .86rem 1rem .68rem !important;
        border-radius: 1rem;
        font-size: .9rem;
        line-height: 1.42;
        box-shadow: 0 18px 34px -24px rgba(15,23,42,.55);
        overflow-wrap: anywhere;
        word-break: normal;
        text-align: left;
        position: relative;
    }
    .nedate-chat-panel .nedate-chat-bubble__text {
        display: block !important;
        width: auto !important;
        min-height: 0 !important;
        margin: 0 !important;
        white-space: pre-wrap;
    }
    .nedate-chat-panel .nedate-chat-message--admin .nedate-chat-bubble {
        background: #fff;
        border: 1px solid rgba(20,39,74,.10);
        color: var(--nd-public-navy, #14274a);
        border-bottom-left-radius: .42rem;
    }
    .nedate-chat-panel .nedate-chat-message--visitor .nedate-chat-bubble {
        background: linear-gradient(135deg, var(--nd-public-red, #ff3b2f), #ff1f1f);
        color: #fff;
        border-bottom-right-radius: .42rem;
    }
    .nedate-chat-panel .nedate-chat-meta {
        display: flex !important;
        align-items: center;
        gap: .28rem;
        width: auto !important;
        height: auto !important;
        min-height: 0 !important;
        font-size: .68rem;
        line-height: 1;
        opacity: .68;
        margin-top: .48rem;
        white-space: nowrap;
    }
    .nedate-chat-panel .nedate-chat-meta time { font-variant-numeric: tabular-nums; }
    .nedate-chat-panel__form {
        padding: .9rem 1rem 1rem;
        border-top: 1px solid rgba(20,39,74,.08);
        background: rgba(255,255,255,.98);
        flex: 0 0 auto;
        box-shadow: 0 -20px 42px -36px rgba(15,23,42,.55);
    }
    .nedate-chat-identity { margin-bottom: .55rem; }
    .nedate-chat-identity__title { display: flex; justify-content: space-between; gap: .75rem; align-items: baseline; margin-bottom: .35rem; font-size: .76rem; color: #64748b; }
    .nedate-chat-identity__title strong { color: #0f172a; }
    .nedate-chat-identity__grid { display: grid; grid-template-columns: 1fr 1fr; gap: .45rem; }
    .nedate-chat-input-row {
        display: flex;
        align-items: flex-end;
        gap: .45rem;
        padding: .48rem .5rem .48rem .95rem;
        border: 1px solid rgba(255,59,47,.20);
        border-radius: 1rem;
        background: #ffffff;
        transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
    }
    .nedate-chat-input-row:focus-within {
        background: #fff;
        border-color: rgba(255,59,47,.38);
        box-shadow: 0 0 0 .2rem rgba(255,59,47,.09);
    }
    .nedate-chat-input-row textarea {
        resize: none;
        min-height: 2.85rem;
        max-height: 7rem;
        border: 0 !important;
        border-radius: 0;
        padding: .65rem .1rem;
        background: transparent !important;
        box-shadow: none !important;
        line-height: 1.35;
    }
    .nedate-chat-input-row textarea:focus { outline: 0; box-shadow: none !important; }
    .nedate-chat-attach {
        width: 2.35rem;
        height: 2.35rem;
        border: 0;
        border-radius: 999px;
        flex: 0 0 auto;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        color: #738098;
        background: transparent;
        font-size: 1.05rem;
    }
    .nedate-chat-attach:hover { color: var(--nd-public-red, #ff3b2f); background: rgba(255,59,47,.07); }
    .nedate-chat-input-row button[type="submit"] {
        width: 2.8rem;
        height: 2.8rem;
        border: 0;
        border-radius: 999px;
        flex: 0 0 auto;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background: linear-gradient(135deg, var(--nd-public-orange, #ff8a3d), var(--nd-public-red, #ff3b2f));
        color: #fff;
        box-shadow: 0 12px 28px -16px rgba(255,59,47,.75);
        transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease;
    }
    .nedate-chat-input-row button[type="submit"]:hover { transform: translateY(-1px); box-shadow: 0 15px 32px -16px rgba(255,59,47,.9); }
    .nedate-chat-input-row button[type="submit"]:disabled { opacity: .62; transform: none; cursor: wait; }
    .nedate-chat-feedback { color: #b91c1c; font-size: .78rem; margin-top: .45rem; }
    .nedate-chat-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
    @media (max-width: 575.98px) {
        html.nedate-chat-mobile-lock,
        html.nedate-chat-mobile-lock body {
            overflow: hidden !important;
            overscroll-behavior: none;
        }
    }
    html[data-theme="dark"] .nedate-chat-panel { background: rgba(15,23,42,.97); border-color: rgba(51,65,85,.9); }
    html[data-theme="dark"] .nedate-chat-panel__body { background: linear-gradient(180deg, #0f172a, #111827); }
    html[data-theme="dark"] .nedate-chat-empty strong { color: #e5e7eb; }
    html[data-theme="dark"] .nedate-chat-panel__form { background: rgba(17,24,39,.98); border-color: #334155; }
    html[data-theme="dark"] .nedate-chat-identity__title strong { color: #e5e7eb; }
    html[data-theme="dark"] .nedate-chat-message--admin .nedate-chat-bubble { background: #1f2937; color: #e5e7eb; border-color: #334155; }
    html[data-theme="dark"] .nedate-chat-day-separator span { background: rgba(15,23,42,.92); border-color: #334155; color: #94a3b8; }
    html[data-theme="dark"] .nedate-chat-input-row { background: #0f172a; border-color: #334155; }
    html[data-theme="dark"] .nedate-chat-input-row:focus-within { background: #111827; }
    @keyframes nedateChatPulse { from { opacity: .65; transform: scale(.9); } to { opacity: 0; transform: scale(1.18); } }
    @keyframes nedateChatEnter { from { opacity: 0; transform: translateX(.5rem) scale(.97); } to { opacity: 1; transform: translateX(0) scale(1); } }
    @media (max-width: 575.98px) {
        .nedate-live-chat-widget {
            right: .9rem;
            bottom: .9rem;
            z-index: 2140;
        }
        .nedate-live-chat-widget.nedate-chat-open {
            inset: 0;
            width: 100vw;
            width: 100dvw;
            height: 100vh;
            height: 100dvh;
        }
        .nedate-live-chat-widget.nedate-chat-open .nedate-chat-launcher {
            display: none !important;
        }
        .nedate-live-chat-widget.nedate-chat-open .nedate-chat-panel {
            position: fixed !important;
            inset: 0 !important;
            left: 0 !important;
            right: auto !important;
            bottom: auto !important;
            width: 100vw !important;
            width: 100dvw !important;
            height: 100vh !important;
            height: 100dvh !important;
            max-height: none !important;
            border: 0 !important;
            border-radius: 0 !important;
            box-shadow: none !important;
        }
        .nedate-live-chat-widget.nedate-chat-open .nedate-chat-panel__header {
            padding-top: max(1rem, env(safe-area-inset-top));
        }
        .nedate-live-chat-widget.nedate-chat-open .nedate-chat-panel__body {
            padding-bottom: 1rem;
        }
        .nedate-live-chat-widget.nedate-chat-open .nedate-chat-panel__form {
            padding-bottom: max(.85rem, env(safe-area-inset-bottom));
        }
        .nedate-chat-identity__grid { grid-template-columns: 1fr; }
        .nedate-chat-identity__title { flex-direction: column; gap: .1rem; }
    }
