/* =========================================================
   העוזר המשפטי — chatbot widget styles
   ========================================================= */

.hh-chat { display: contents; }

/* ---------- Launcher (FAB) ---------- */
.hh-fab {
    position: fixed;
    bottom: calc(92px + env(safe-area-inset-bottom, 0px));
    inset-inline-start: 24px;
    z-index: 160;
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold-light), var(--gold) 55%, var(--gold-deep));
    color: var(--ink-950);
    box-shadow: 0 12px 28px -8px rgba(175, 163, 123, .65);
    cursor: pointer;
    transition: transform .3s var(--ease), box-shadow .3s var(--ease),
                opacity .25s var(--ease);
}
.hh-fab::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1px solid rgba(175, 163, 123, .8);
    animation: hh-ping 3s var(--ease) 3;   /* finite — infinite motion is distracting */
    pointer-events: none;
}
@keyframes hh-ping {
    0%   { transform: scale(1);    opacity: .7; }
    70%  { transform: scale(1.45); opacity: 0; }
    100% { transform: scale(1.45); opacity: 0; }
}
.hh-fab:hover {
    transform: translateY(-3px) scale(1.04);
    box-shadow: 0 18px 34px -8px rgba(175, 163, 123, .75);
}
.hh-fab svg { width: 26px; height: 26px; }
.hh-fab .hh-fab-close { display: none; }

.hh-chat.hh-open .hh-fab {
    opacity: 0;
    pointer-events: none;
    transform: scale(.6);
}

.hh-fab-dot {
    position: absolute;
    top: 2px;
    inset-inline-end: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #E25C4F;
    border: 2px solid var(--paper);
}

/* ---------- Proactive nudge ---------- */
.hh-nudge {
    position: fixed;
    bottom: calc(106px + env(safe-area-inset-bottom, 0px));
    inset-inline-start: 90px;
    z-index: 160;
    background: var(--paper);
    color: var(--tx-strong);
    font-family: var(--font-body);
    font-size: 13.5px;
    font-weight: 600;
    padding: 9px 16px;
    border-radius: 12px;
    border: 1px solid var(--line);
    box-shadow: 0 14px 36px -10px rgba(7, 13, 22, .5);
    white-space: nowrap;
    animation: hh-nudge-pop .45s var(--ease) both;
}
.hh-nudge::before {
    content: "";
    position: absolute;
    inset-inline-start: -5px;
    top: 50%;
    width: 9px;
    height: 9px;
    background: inherit;
    border-inline-start: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    transform: translateY(-50%) rotate(45deg);
}
@keyframes hh-nudge-pop {
    from { opacity: 0; transform: translateY(8px) scale(.94); }
    to   { opacity: 1; transform: none; }
}

/* ---------- Panel ---------- */
.hh-panel {
    position: fixed;
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    inset-inline-start: 24px;
    z-index: 245;
    width: min(386px, calc(100vw - 32px));
    height: min(580px, calc(100dvh - 110px));
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, var(--ink-800), var(--ink-900) 80%);
    border: 1px solid rgba(175, 163, 123, .4);
    border-radius: 20px;
    box-shadow: 0 30px 80px -20px rgba(4, 8, 14, .85);
    overflow: hidden;
    opacity: 0;
    transform: translateY(16px) scale(.98);
    transform-origin: bottom right;
    transition: opacity .25s var(--ease), transform .25s var(--ease);
    pointer-events: none;
}
.hh-panel[hidden] { display: none; }
.hh-chat.hh-open .hh-panel {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}

/* ---------- Header ---------- */
.hh-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 16px;
    background: rgba(255, 255, 255, .035);
    border-bottom: 1px solid rgba(175, 163, 123, .25);
    flex: none;
}

.hh-ava {
    position: relative;
    flex: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: radial-gradient(circle at 35% 30%, var(--ink-600), var(--ink-900));
    border: 1px solid rgba(175, 163, 123, .5);
}
.hh-ava img { width: 24px; height: auto; }

.hh-online {
    position: absolute;
    bottom: 0;
    inset-inline-end: 0;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #3DC97A;
    border: 2px solid var(--ink-800);
}

.hh-head-text {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
    min-width: 0;
    margin-inline-end: auto;
}
.hh-head-text strong {
    color: var(--tx-inverse);
    font-size: 15.5px;
    font-weight: 600;
}
.hh-head-text small {
    color: var(--tx-inverse-soft);
    font-size: 12px;
    font-weight: 300;
}

.hh-iconbtn {
    flex: none;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    color: var(--tx-inverse-soft);
    transition: color .2s var(--ease), background-color .2s var(--ease);
}
.hh-iconbtn:hover { color: var(--gold-light); background: rgba(255, 255, 255, .06); }
.hh-iconbtn svg { width: 17px; height: 17px; }

/* ---------- Log ---------- */
.hh-log {
    flex: 1;
    overflow-y: auto;
    padding: 18px 14px 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scrollbar-width: thin;
    scrollbar-color: rgba(175, 163, 123, .35) transparent;
    overscroll-behavior: contain;
}
.hh-log::-webkit-scrollbar { width: 5px; }
.hh-log::-webkit-scrollbar-thumb {
    background: rgba(175, 163, 123, .35);
    border-radius: 99px;
}

.hh-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    animation: hh-rise .35s var(--ease) both;
}
@keyframes hh-rise {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: none; }
}

.hh-row-bot { justify-content: flex-start; }
.hh-row-user { justify-content: flex-end; }

.hh-msg-ava {
    flex: none;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--ink-700);
    border: 1px solid rgba(175, 163, 123, .4);
    align-self: flex-end;
    margin-bottom: 2px;
}
.hh-msg-ava img { width: 15px; height: auto; }

.hh-bubble {
    max-width: 82%;
    padding: 11px 15px;
    font-size: 14.5px;
    line-height: 1.6;
    border-radius: 15px;
    word-break: break-word;
}
.hh-row-bot .hh-bubble {
    background: #1B2C49;
    color: var(--tx-inverse);
    border-end-start-radius: 4px;
    border: 1px solid rgba(255, 255, 255, .06);
}
.hh-row-user .hh-bubble {
    background: linear-gradient(135deg, var(--gold-light), var(--gold));
    color: var(--ink-950);
    font-weight: 500;
    border-end-end-radius: 4px;
}

/* typing dots */
.hh-typing {
    display: inline-flex;
    gap: 5px;
    align-items: center;
    padding: 14px 16px;
}
.hh-typing i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--gold-light);
    opacity: .5;
    animation: hh-blink 1.2s infinite;
}
.hh-typing i:nth-child(2) { animation-delay: .18s; }
.hh-typing i:nth-child(3) { animation-delay: .36s; }
@keyframes hh-blink {
    0%, 60%, 100% { opacity: .35; transform: translateY(0); }
    30%           { opacity: 1;   transform: translateY(-3px); }
}

/* ---------- Quick-reply chips ---------- */
.hh-chips {
    flex-basis: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-inline-start: 34px;
    margin-top: 2px;
}
.hh-chip {
    padding: 7px 14px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, .25);
    color: #C7D0E0;
    font-size: 13.5px;
    font-weight: 500;
    transition: color .2s var(--ease), border-color .2s var(--ease),
                background-color .2s var(--ease), transform .2s var(--ease);
}
.hh-chip:hover:not(:disabled) {
    color: var(--gold-light);
    border-color: var(--gold);
    background: rgba(175, 163, 123, .1);
    transform: translateY(-1px);
}
.hh-chips.done .hh-chip {
    opacity: .35;
    cursor: default;
}

/* ---------- Link buttons ---------- */
.hh-links {
    flex-basis: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-inline-start: 34px;
    margin-top: 2px;
}
.hh-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 15px;
    border-radius: 999px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--gold-light);
    border: 1px solid rgba(175, 163, 123, .55);
    background: rgba(175, 163, 123, .1);
    transition: background-color .2s var(--ease), transform .2s var(--ease),
                box-shadow .2s var(--ease);
}
.hh-link:hover {
    background: rgba(175, 163, 123, .22);
    transform: translateY(-1px);
    box-shadow: 0 8px 18px -8px rgba(175, 163, 123, .5);
}
.hh-link svg { width: 15px; height: 15px; flex: none; }
.hh-link span { direction: ltr; unicode-bidi: embed; }
.hh-link-wa {
    color: #59E08D;
    border-color: rgba(37, 211, 102, .55);
    background: rgba(37, 211, 102, .1);
}
.hh-link-wa:hover {
    background: rgba(37, 211, 102, .2);
    box-shadow: 0 8px 18px -8px rgba(37, 211, 102, .45);
}
.hh-link-pulse {
    animation: hh-wa-pulse 2s var(--ease) 6;   /* finite attention pull, then rest */
}
@keyframes hh-wa-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, .45); }
    50%      { box-shadow: 0 0 0 6px rgba(37, 211, 102, 0); }
}

/* ---------- Input row ---------- */
.hh-inputrow {
    flex: none;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-top: 1px solid rgba(255, 255, 255, .08);
    background: rgba(7, 13, 22, .45);
}
.hh-inputrow input {
    flex: 1;
    min-width: 0;
    padding: 11px 17px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, .15);
    background: rgba(7, 13, 22, .65);
    color: var(--tx-inverse);
    font-size: 14.5px;
    transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.hh-inputrow input::placeholder { color: #5E6B82; font-weight: 300; }
.hh-inputrow input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(175, 163, 123, .15);
}

.hh-send {
    flex: none;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold-light), var(--gold) 60%, var(--gold-deep));
    color: var(--ink-950);
    box-shadow: 0 6px 16px -6px rgba(175, 163, 123, .6);
    transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.hh-send:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -6px rgba(175, 163, 123, .7);
}
.hh-send svg {
    width: 18px;
    height: 18px;
    transform: scaleX(-1);   /* point the plane in RTL send direction */
}

/* ---------- Footer ---------- */
.hh-foot {
    flex: none;
    text-align: center;
    font-size: 11.5px;
    font-weight: 300;
    color: #5E6B82;
    padding: 7px 10px 9px;
    border-top: 1px solid rgba(255, 255, 255, .05);
}

/* ---------- Mobile ---------- */
@media (max-width: 560px) {
    .hh-fab {
        bottom: calc(82px + env(safe-area-inset-bottom, 0px));
        inset-inline-start: 18px;
        width: 52px;
        height: 52px;
    }
    .hh-nudge {
        bottom: calc(94px + env(safe-area-inset-bottom, 0px));
        inset-inline-start: 80px;
    }
    .hh-panel {
        inset-inline: 12px;
        bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        width: auto;
        height: min(560px, calc(100dvh - 90px));
        border-radius: 18px;
    }
    .hh-bubble { max-width: 88%; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .hh-fab::after { animation: none; opacity: 0; }
    .hh-row, .hh-nudge { animation: none; }
    .hh-panel, .hh-fab, .hh-chip, .hh-link, .hh-send { transition: none; }
    .hh-typing i { animation: none; opacity: .8; }
    .hh-link-pulse { animation: none; }
}
