/* Floating AI chat widget — launcher + panel. Bottom-right, above page content. */

.hcw-root {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    z-index: 1300;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.875rem;
    pointer-events: none; /* children re-enable; lets clicks pass through the gap */
}

.hcw-root > * { pointer-events: auto; }

/* ── Launcher (FAB) ─────────────────────────────────────────── */
.hcw-fab {
    position: relative;
    width: 3.75rem;
    height: 3.75rem;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: var(--antologa-primary, #078282);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(7, 130, 130, 0.4), 0 2px 6px rgba(0, 0, 0, 0.15);
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
    align-self: flex-end;
}

.hcw-fab:hover {
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 12px 30px rgba(7, 130, 130, 0.5), 0 3px 8px rgba(0, 0, 0, 0.18);
}

.hcw-fab:active { transform: scale(0.97); }

.hcw-root--open .hcw-fab {
    background: var(--antologa-dark, #282828);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

/* Pulsing ring to draw the eye when closed */
.hcw-fab-ping {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid var(--antologa-primary, #078282);
    animation: hcwPing 2.4s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes hcwPing {
    0%   { transform: scale(1);    opacity: 0.6; }
    70%  { transform: scale(1.6);  opacity: 0;   }
    100% { transform: scale(1.6);  opacity: 0;   }
}

/* ── Panel ──────────────────────────────────────────────────── */
.hcw-panel {
    width: 360px;
    max-width: calc(100vw - 2rem);
    height: 520px;
    max-height: calc(100vh - 7rem);
    background: #fff;
    border-radius: 1.125rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.22), 0 4px 12px rgba(0, 0, 0, 0.1);
    transform-origin: bottom right;
    animation: hcwOpen 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.hcw-panel[hidden] { display: none; }

@keyframes hcwOpen {
    from { opacity: 0; transform: translateY(12px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

/* Header */
.hcw-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1rem;
    background: linear-gradient(135deg, var(--antologa-primary, #078282) 0%, var(--antologa-secondary, #004F71) 100%);
    color: #fff;
}

.hcw-header-id { display: flex; align-items: center; gap: 0.625rem; }

.hcw-avatar {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: Inter, sans-serif;
    font-weight: 800;
    font-size: 1.05rem;
}

.hcw-title { font-family: Inter, sans-serif; font-weight: 700; font-size: 0.95rem; line-height: 1.1; }
.hcw-status { font-family: Nunito, sans-serif; font-size: 0.72rem; opacity: 0.85; display: flex; align-items: center; gap: 0.3rem; margin-top: 0.1rem; }
.hcw-dot { width: 7px; height: 7px; border-radius: 50%; background: #5BD68A; box-shadow: 0 0 0 2px rgba(91, 214, 138, 0.3); }

.hcw-icon-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.4rem;
    display: flex;
    transition: background 0.15s, color 0.15s;
}
.hcw-icon-btn:hover { background: rgba(255, 255, 255, 0.15); color: #fff; }

/* Messages */
.hcw-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    background: var(--antologa-white, #FAF9F6);
}

.hcw-msg { display: flex; }
.hcw-msg--user { justify-content: flex-end; }
.hcw-msg--bot  { justify-content: flex-start; }

.hcw-bubble {
    font-family: Nunito, sans-serif;
    font-size: 0.875rem;
    line-height: 1.55;
    max-width: 82%;
    padding: 0.625rem 0.875rem;
    border-radius: 1rem;
}

.hcw-msg--user .hcw-bubble {
    background: var(--antologa-primary, #078282);
    color: #fff;
    border-bottom-right-radius: 0.3rem;
}

.hcw-msg--bot .hcw-bubble {
    background: #fff;
    color: var(--antologa-dark, #282828);
    border: 1px solid var(--antologa-light-gray, #E7E5E0);
    border-bottom-left-radius: 0.3rem;
}

/* Typing dots */
.hcw-bubble--typing { display: flex; gap: 0.3rem; align-items: center; padding: 0.75rem 0.875rem; }
.hcw-bubble--typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--antologa-gray, #9A968E); animation: hcwDot 1.2s infinite ease-in-out; }
.hcw-bubble--typing span:nth-child(2) { animation-delay: 0.2s; }
.hcw-bubble--typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes hcwDot { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-5px); } }

/* Suggestion chips */
.hcw-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0 1rem 0.75rem;
    background: var(--antologa-white, #FAF9F6);
}

.hcw-chip {
    font-family: Nunito, sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--antologa-secondary, #004F71);
    background: #fff;
    border: 1.5px solid var(--antologa-light-gray, #E7E5E0);
    border-radius: 1.5rem;
    padding: 0.3rem 0.75rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.hcw-chip:hover { background: var(--antologa-primary, #078282); border-color: var(--antologa-primary, #078282); color: #fff; }

/* Input */
.hcw-input-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.75rem;
    border-top: 1px solid var(--antologa-light-gray, #E7E5E0);
    background: #fff;
}

.hcw-input {
    flex: 1;
    font-family: Nunito, sans-serif;
    font-size: 0.875rem;
    border: 1px solid var(--antologa-light-gray, #E7E5E0);
    border-radius: 1.5rem;
    padding: 0.5rem 0.875rem;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.hcw-input:focus { border-color: var(--antologa-primary, #078282); box-shadow: 0 0 0 3px rgba(7, 130, 130, 0.12); }

.hcw-send {
    width: 2.5rem;
    height: 2.5rem;
    flex-shrink: 0;
    border: none;
    border-radius: 50%;
    background: var(--antologa-primary, #078282);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, transform 0.1s, opacity 0.15s;
}
.hcw-send:hover:not(:disabled) { background: var(--antologa-secondary, #004F71); }
.hcw-send:active:not(:disabled) { transform: scale(0.92); }
.hcw-send:disabled { opacity: 0.45; cursor: default; }

.hcw-foot {
    font-family: Nunito, sans-serif;
    font-size: 0.68rem;
    color: var(--antologa-gray, #9A968E);
    text-align: center;
    padding: 0.4rem 0.75rem 0.6rem;
    background: #fff;
}
.hcw-foot a { color: var(--antologa-primary, #078282); text-decoration: none; }
.hcw-foot a:hover { text-decoration: underline; }

/* ── Mobile ─────────────────────────────────────────────────── */

/* Lift the launcher/panel above the fixed mobile bottom nav (shown ≤1280px, 5rem tall). */
@media (max-width: 1280px) {
    .hcw-root { bottom: 6rem; } /* 5rem nav + 1rem gap */
}

/* Bottom nav shrinks to 4.5rem at ≤768px. */
@media (max-width: 768px) {
    .hcw-root { bottom: 5.5rem; }
}

@media (max-width: 480px) {
    .hcw-root { right: 1rem; }
    .hcw-panel {
        width: calc(100vw - 1.5rem);
        height: calc(100vh - 11rem);
        height: calc(100dvh - 11rem); /* viewport minus bottom nav, launcher, and gaps */
    }
}
