/*
 * WelcomeGuide — Homepage AI Assistant Widget
 * File: astra-child/css/homepage-assistant.css
 * Versione: v1.0
 *
 * Caricato da functions.php tramite wp_enqueue_style.
 * Classi prefissate wg-hpai-* — zero conflitti con widget turista (wg-chat-*).
 */

/* Reset scoped */
#wg-hpai-fab, #wg-hpai-bubble, #wg-hpai-panel,
#wg-hpai-fab *, #wg-hpai-bubble *, #wg-hpai-panel * {
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── FAB PILL ── */
#wg-hpai-fab {
    position: fixed;
    bottom: 28px;
    right: 24px;
    z-index: 9998;
    display: flex;
    align-items: center;
    gap: 9px;
    background: #1F3A66;
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 13px 20px;
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 24px rgba(31,58,102,0.38);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    line-height: 1;
}
#wg-hpai-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 32px rgba(31,58,102,0.48);
}
#wg-hpai-fab .wg-hpai-fab-icon { font-size: 1.15rem; line-height: 1; }
#wg-hpai-fab .wg-hpai-fab-label { white-space: nowrap; }

/* ── FUMETTO AUTO ── */
#wg-hpai-bubble {
    position: fixed;
    bottom: 88px;
    right: 24px;
    z-index: 9997;
    background: #fff;
    color: #1F3A66;
    border: 1.5px solid #1F3A66;
    border-radius: 16px 16px 4px 16px;
    padding: 12px 36px 12px 15px;
    font-size: 0.88rem;
    font-weight: 500;
    max-width: 230px;
    box-shadow: 0 4px 18px rgba(31,58,102,0.15);
    line-height: 1.45;
    display: none;
    cursor: pointer;
    animation: wgHpBubbleFade 0.4s ease;
}
@keyframes wgHpBubbleFade {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.wg-hpai-bubble-close {
    position: absolute;
    top: 7px;
    right: 9px;
    background: none;
    border: none;
    font-size: 0.75rem;
    color: #999;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}
.wg-hpai-bubble-close:hover { color: #444; }

/* ── PANNELLO CHAT ── */
#wg-hpai-panel {
    position: fixed;
    bottom: 28px;
    right: 24px;
    z-index: 9999;
    width: 350px;
    max-width: calc(100vw - 32px);
    max-height: 530px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 18px 52px rgba(31,58,102,0.22);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: wgHpPanelOpen 0.28s ease;
}
@keyframes wgHpPanelOpen {
    from { opacity: 0; transform: scale(0.94) translateY(10px); }
    to   { opacity: 1; transform: scale(1)    translateY(0); }
}

/* HEADER */
#wg-hpai-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: #1F3A66;
    color: #fff;
    font-size: 0.92rem;
    font-weight: 700;
    flex-shrink: 0;
    gap: 10px;
}
#wg-hpai-header-info {
    display: flex;
    align-items: center;
    gap: 9px;
    flex: 1;
    min-width: 0;
}
#wg-hpai-header-avatar {
    width: 32px;
    height: 32px;
    background: rgba(255,255,255,0.18);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}
#wg-hpai-header-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}
#wg-hpai-header-title {
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#wg-hpai-header-sub {
    font-size: 0.72rem;
    font-weight: 400;
    opacity: 0.78;
    white-space: nowrap;
}
#wg-hpai-close {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}
#wg-hpai-close:hover { background: rgba(255,255,255,0.35); }

/* AREA MESSAGGI */
#wg-hpai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f7f9fc;
    scroll-behavior: smooth;
}
#wg-hpai-messages::-webkit-scrollbar { width: 4px; }
#wg-hpai-messages::-webkit-scrollbar-thumb { background: #dde3ed; border-radius: 4px; }

/* MESSAGGI */
.wg-hpai-msg {
    max-width: 86%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 0.87rem;
    line-height: 1.5;
    word-break: break-word;
}
.wg-hpai-msg.user {
    align-self: flex-end;
    background: #1F3A66;
    color: #fff;
    border-bottom-right-radius: 4px;
}
.wg-hpai-msg.ai {
    align-self: flex-start;
    background: #fff;
    color: #2d3748;
    border: 1px solid #e8ecf2;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.wg-hpai-msg.ai.typing {
    color: #aaa;
    font-style: italic;
    font-size: 0.85rem;
}

/* PULSANTE CTA TARIFFE */
.wg-hpai-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 9px;
    background: #E65A5A;
    color: #fff !important;
    border-radius: 8px;
    padding: 9px 14px;
    font-size: 0.83rem;
    font-weight: 700;
    text-decoration: none !important;
    transition: background 0.2s, transform 0.15s;
    line-height: 1.2;
}
.wg-hpai-cta-btn:hover {
    background: #cc4444;
    transform: translateY(-1px);
}

/* INPUT AREA */
#wg-hpai-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-top: 1px solid #eef0f5;
    background: #fff;
    flex-shrink: 0;
}
#wg-hpai-input {
    flex: 1;
    border: 1.5px solid #dde3ed;
    border-radius: 50px;
    padding: 9px 15px;
    font-size: 0.87rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
    background: #f7f9fc;
    color: #1e293b;
}
#wg-hpai-input:focus {
    border-color: #1F3A66;
    background: #fff;
}
#wg-hpai-input::placeholder { color: #a0aec0; }
#wg-hpai-send {
    width: 38px;
    height: 38px;
    background: #1F3A66;
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.15s;
}
#wg-hpai-send:hover { background: #E65A5A; transform: scale(1.08); }
#wg-hpai-send:disabled { opacity: 0.42; cursor: not-allowed; transform: none; }

/* SUGGERIMENTI INIZIALI */
#wg-hpai-suggestions {
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 10px 14px 4px;
    flex-shrink: 0;
}
.wg-hpai-sugg-btn {
    background: #f0f4fa;
    border: 1px solid #dde3ed;
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 0.82rem;
    font-family: inherit;
    color: #1F3A66;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s, border-color 0.15s;
    line-height: 1.3;
}
.wg-hpai-sugg-btn:hover {
    background: #e2eaf7;
    border-color: #aab8d4;
}

/* RESPONSIVE */
@media (max-width: 420px) {
    #wg-hpai-panel {
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        border-radius: 20px 20px 0 0;
        max-height: 78vh;
    }
    #wg-hpai-fab    { bottom: 16px; right: 16px; }
    #wg-hpai-bubble { bottom: 78px; right: 16px; }
}
@media print {
    #wg-hpai-fab, #wg-hpai-bubble, #wg-hpai-panel { display: none !important; }
}