/*
 * Rozhika Widget Hub - composer, voice messages, «شروع گفتگوی جدید» (v2.12.0)
 * and conversation search (v2.13.0)
 *
 * Loaded in its own file, excluded from Remove Unused CSS and without blocking
 * rendering (see Rozhika_Widget_Hub::enqueue_assets()). Front-end rules are
 * scoped to #rwh-widget-hub and carry !important only where the widget's own
 * theme shield (`#rwh-widget-hub button { ... !important }` in widget-hub.css)
 * would otherwise flatten them; the admin rules need neither.
 */

/* ======================================================================
   1. Voice player (shared by the widget and the admin panel)
   ====================================================================== */

.rwhv-player {
    --rwhv-accent: #9d4edd;
    --rwhv-track: rgba(157, 78, 221, 0.28);
    --rwhv-text: #64748b;
    --rwhv-btn-bg: linear-gradient(135deg, #9d4edd 0%, #7b2cbf 100%);
    --rwhv-btn-fg: #ffffff;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 200px;
    max-width: 260px;
    direction: rtl;
    -webkit-user-select: none;
    user-select: none;
}

/* On a coloured bubble (the customer's own in the widget, the customer's in the
   admin panel) the player turns white-on-colour, like Telegram. */
:is(.rwh-message.user, .rwh-admin-message.user) .rwhv-player {
    --rwhv-accent: #ffffff;
    --rwhv-track: rgba(255, 255, 255, 0.42);
    --rwhv-text: rgba(255, 255, 255, 0.88);
    --rwhv-btn-bg: #ffffff;
    --rwhv-btn-fg: #7b2cbf;
}

:is(#rwh-widget-hub, .rwh-admin-wrap) .rwhv-play {
    flex: 0 0 auto;
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    border-radius: 50% !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    background: var(--rwhv-btn-bg) !important;
    color: var(--rwhv-btn-fg) !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(123, 44, 191, 0.25) !important;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

:is(#rwh-widget-hub, .rwh-admin-wrap) .rwhv-play:hover { transform: scale(1.06); }
:is(#rwh-widget-hub, .rwh-admin-wrap) .rwhv-play:active { transform: scale(0.94); }

:is(#rwh-widget-hub, .rwh-admin-wrap) .rwhv-play .rwhv-ico {
    width: 18px !important;
    height: 18px !important;
    fill: currentColor !important;
    stroke: none !important;
    transform: none !important;
}

:is(#rwh-widget-hub, .rwh-admin-wrap) .rwhv-play .rwhv-ico-play { margin-left: -2px; }
.rwhv-play .rwhv-ico-pause,
.rwhv-player.is-playing .rwhv-play .rwhv-ico-play { display: none !important; }
.rwhv-player.is-playing .rwhv-play .rwhv-ico-pause { display: block !important; }

.rwhv-body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.rwhv-wave {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 26px;
    cursor: pointer;
    outline: none;
    border-radius: 6px;
}

.rwhv-wave:focus-visible { box-shadow: 0 0 0 2px var(--rwhv-track); }

.rwhv-bar {
    flex: 1 1 0;
    min-width: 2px;
    max-width: 4px;
    height: calc(var(--rwhv-h, 0.3) * 100%);
    min-height: 3px;
    border-radius: 2px;
    background: var(--rwhv-track);
    transition: background-color 0.12s linear;
}

.rwhv-bar.is-played { background: var(--rwhv-accent); }

.rwhv-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 11.5px;
    color: var(--rwhv-text);
    line-height: 1.4;
}

.rwhv-time { font-variant-numeric: tabular-nums; }
.rwhv-status { font-style: italic; opacity: 0.85; }

:is(#rwh-widget-hub, .rwh-admin-wrap) .rwhv-speed {
    min-width: 30px !important;
    height: 18px !important;
    padding: 0 6px !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 9px !important;
    background: var(--rwhv-track) !important;
    color: var(--rwhv-accent) !important;
    font-size: 10.5px !important;
    font-weight: 700 !important;
    line-height: 18px !important;
    cursor: pointer;
    box-shadow: none !important;
}

:is(.rwh-message.user, .rwh-admin-message.user) .rwhv-player .rwhv-speed { color: #ffffff !important; }

.rwhv-player.is-pending .rwhv-play { opacity: 0.75; }
.rwhv-player.is-error .rwhv-time::after { content: ' · قابل پخش نیست'; }

/* A voice message is its own block in the bubble (not a file chip). */
.rwh-message-voice,
.rwh-admin-voice-wrap {
    display: block;
}

.rwh-message-voice > .rwh-msg-voice + .rwh-msg-voice,
.rwh-admin-voice-wrap > .rwh-admin-voice + .rwh-admin-voice {
    margin-top: 8px;
}

/* Text above the player (a captioned voice message) gets breathing room. */
.rwh-message-bubble > .rwh-message-voice:not(:first-child) {
    margin-top: 10px;
}

.rwh-admin-voice-wrap {
    margin: 2px 0 6px;
}

/* ======================================================================
   2. Widget composer: mic <-> send morph (Telegram-style)
   ====================================================================== */

#rwh-widget-hub .rwh-send-btn {
    position: relative !important;
    overflow: visible !important;
}

#rwh-widget-hub .rwh-send-btn .rwh-ico {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 20px !important;
    height: 20px !important;
    transition: opacity 0.18s ease, scale 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), rotate 0.22s ease;
}

/* The send arrow keeps widget-hub.css' own rotate(180deg) transform; the morph
   uses the independent scale/rotate properties so the two never collide. */
#rwh-widget-hub .rwh-send-btn .rwh-ico-mic,
#rwh-widget-hub .rwh-send-btn .rwh-ico-stop {
    transform: none !important;
    stroke: #ffffff !important;
    fill: none !important;
}

#rwh-widget-hub .rwh-send-btn .rwh-ico-stop { fill: #ffffff !important; stroke: none !important; }

#rwh-widget-hub .rwh-send-btn .rwh-ico-mic,
#rwh-widget-hub .rwh-send-btn .rwh-ico-stop {
    opacity: 0;
    scale: 0.4;
    rotate: -45deg;
}

#rwh-widget-hub .rwh-send-btn.is-mic .rwh-ico-send,
#rwh-widget-hub .rwh-send-btn.is-stop .rwh-ico-send {
    opacity: 0;
    scale: 0.4;
    rotate: 45deg;
}

#rwh-widget-hub .rwh-send-btn.is-mic .rwh-ico-mic,
#rwh-widget-hub .rwh-send-btn.is-stop .rwh-ico-stop {
    opacity: 1;
    scale: 1;
    rotate: 0deg;
}

#rwh-widget-hub .rwh-send-btn.is-busy { opacity: 0.7; }

/* Recording: the button becomes a red «stop» with a ring that breathes with the voice. */
#rwh-widget-hub .rwh-send-btn.is-stop {
    background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%) !important;
}

#rwh-widget-hub .rwh-send-btn.is-stop::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(244, 63, 94, 0.28);
    scale: calc(1 + var(--rwh-level, 0) * 0.65);
    transition: scale 0.08s linear;
    z-index: -1;
    pointer-events: none;
}

/* ======================================================================
   3. Widget composer: recording / preview bar
   ====================================================================== */

#rwh-widget-hub .rwh-voice-bar {
    display: none;
    flex: 1 1 auto;
    min-width: 0;
    align-items: center;
    gap: 10px;
    min-height: 32px;
    direction: rtl;
}

#rwh-widget-hub .rwh-input-wrapper.is-recording .rwh-voice-bar,
#rwh-widget-hub .rwh-input-wrapper.is-voice-preview .rwh-voice-bar {
    display: flex;
}

#rwh-widget-hub .rwh-input-wrapper.is-recording .rwh-input,
#rwh-widget-hub .rwh-input-wrapper.is-recording .rwh-attach-btn,
#rwh-widget-hub .rwh-input-wrapper.is-voice-preview .rwh-input,
#rwh-widget-hub .rwh-input-wrapper.is-voice-preview .rwh-attach-btn {
    display: none !important;
}

#rwh-widget-hub .rwh-input-wrapper.is-recording,
#rwh-widget-hub .rwh-input-wrapper.is-voice-preview {
    align-items: center !important;
}

.rwh-rec-dot {
    flex: 0 0 auto;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #f43f5e;
    animation: rwh-rec-blink 1.2s ease-in-out infinite;
}

@keyframes rwh-rec-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.25; }
}

.rwh-rec-time {
    flex: 0 0 auto;
    min-width: 34px;
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
    font-variant-numeric: tabular-nums;
}

/* Live level meter: newest bar on the left, scrolling toward the right edge. */
.rwh-rec-wave {
    flex: 1 1 auto;
    min-width: 0;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 2px;
    overflow: hidden;
    direction: ltr;
    /* the oldest bars fade out at the far end */
    mask-image: linear-gradient(to right, transparent 0, #000 22px);
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 22px);
}

.rwh-rec-wave span {
    flex: 0 0 3px;
    height: calc(var(--h, 0.1) * 100%);
    min-height: 3px;
    border-radius: 2px;
    background: #9d4edd;
    opacity: 0.85;
}

.rwh-rec-hint {
    flex: 0 0 auto;
    font-size: 11.5px;
    color: #64748b;
    white-space: nowrap;
}

#rwh-widget-hub .rwh-voice-trash,
.rwh-reply-container .rwh-voice-trash {
    flex: 0 0 auto;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    border: none !important;
    border-radius: 50% !important;
    padding: 0 !important;
    margin: 0 !important;
    background: rgba(239, 68, 68, 0.1) !important;
    color: #ef4444 !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: none !important;
    transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

#rwh-widget-hub .rwh-voice-trash:hover,
.rwh-reply-container .rwh-voice-trash:hover {
    background: #ef4444 !important;
    color: #ffffff !important;
    transform: scale(1.06);
}

#rwh-widget-hub .rwh-voice-trash svg,
.rwh-reply-container .rwh-voice-trash svg {
    width: 16px !important;
    height: 16px !important;
    stroke: currentColor !important;
    fill: none !important;
    transform: none !important;
}

#rwh-widget-hub .rwh-voice-bar .rwhv-player {
    flex: 1 1 auto;
    max-width: none;
    min-width: 0;
}

#rwh-widget-hub .rwh-voice-bar .rwhv-play {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
}

#rwh-widget-hub .rwh-voice-bar .rwhv-meta { font-size: 11px; }

/* ======================================================================
   4. «شروع گفتگوی جدید» (same treatment as رکسانا's control)
   ====================================================================== */

/* The control is a band continuing the composer's background; the visible
   pill is its label, so hover and focus highlight just the words. */
#rwh-widget-hub .rwh-newchat {
    display: none !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 16px 12px !important;
    border: none !important;
    border-radius: 0 !important;
    background: var(--rwh-bg-secondary, #f8fafc) !important;
    color: #7b2cbf !important;
    min-height: auto !important;
    cursor: pointer;
    box-shadow: none !important;
    justify-content: center;
    flex-shrink: 0;
}

#rwh-widget-hub .rwh-newchat-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 7px 12px;
    border-radius: 10px;
    font-size: 12.5px !important;
    font-weight: 700 !important;
    line-height: 1.6 !important;
    transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

#rwh-widget-hub .rwh-newchat:hover .rwh-newchat-label,
#rwh-widget-hub .rwh-newchat:focus-visible .rwh-newchat-label {
    background: rgba(157, 78, 221, 0.09);
}

#rwh-widget-hub .rwh-newchat:focus-visible { outline: none; }

#rwh-widget-hub .rwh-newchat svg {
    width: 15px !important;
    height: 15px !important;
    stroke: currentColor !important;
    fill: none !important;
    transform: none !important;
}

/* Shown whenever a conversation is open in the پشتیبانی tab. */
#rwh-widget-hub .rwh-tab-content[data-content="human"].rwh-has-chat .rwh-newchat {
    display: flex !important;
}

/* The composer is already flush with the bottom; tuck the control under it. */
#rwh-widget-hub .rwh-tab-content[data-content="human"].rwh-has-chat .rwh-input-container {
    padding-bottom: 6px !important;
    border-bottom: none !important;
}

/* In a closed conversation it is THE way forward, so it reads as a button. */
#rwh-widget-hub .rwh-tab-content[data-content="human"].rwh-chat-closed .rwh-newchat {
    background: transparent !important;
    padding: 0 16px 14px !important;
}

#rwh-widget-hub .rwh-tab-content[data-content="human"].rwh-chat-closed .rwh-newchat-label {
    background: linear-gradient(135deg, #9d4edd 0%, #7b2cbf 100%);
    color: #ffffff;
    padding: 11px 14px;
    border-radius: 14px;
    box-shadow: 0 6px 18px rgba(123, 44, 191, 0.28);
}

#rwh-widget-hub .rwh-tab-content[data-content="human"].rwh-chat-closed .rwh-newchat:hover .rwh-newchat-label {
    filter: brightness(1.06);
}

#rwh-widget-hub .rwh-tab-content[data-content="human"].rwh-chat-closed .rwh-closed-composer {
    margin-bottom: 10px !important;
}

/* While the last conversation is being fetched: no flash of the empty welcome. */
#rwh-widget-hub .rwh-chat-container.rwh-restoring .rwh-chat-welcome {
    display: none !important;
}

#rwh-widget-hub .rwh-chat-container.rwh-restoring::before {
    content: '';
    display: block;
    width: 26px;
    height: 26px;
    margin: 40px auto;
    border-radius: 50%;
    border: 3px solid rgba(157, 78, 221, 0.18);
    border-top-color: #9d4edd;
    animation: rwh-restore-spin 0.8s linear infinite;
}

@keyframes rwh-restore-spin {
    to { transform: rotate(360deg); }
}

/* ======================================================================
   5. Admin reply form
   ====================================================================== */

.rwh-reply-mic-btn {
    flex-shrink: 0;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 2px solid var(--rwh-admin-border, #e2e8f0);
    background: #ffffff;
    color: var(--rwh-admin-primary, #9d4edd);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.rwh-reply-mic-btn:hover {
    background: var(--rwh-admin-gradient-2, linear-gradient(135deg, #9d4edd 0%, #7b2cbf 100%));
    border-color: transparent;
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(157, 78, 221, 0.25);
}

.rwh-reply-mic-btn svg { width: 21px; height: 21px; }

.rwh-reply-mic-btn .rwh-ico-stop { display: none; width: 16px; height: 16px; }

.rwh-reply-input-wrapper.is-recording .rwh-reply-mic-btn {
    background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
    border-color: transparent;
    color: #ffffff;
}

.rwh-reply-input-wrapper.is-recording .rwh-reply-mic-btn::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    background: rgba(244, 63, 94, 0.25);
    scale: calc(1 + var(--rwh-level, 0) * 0.55);
    transition: scale 0.08s linear;
    z-index: -1;
}

.rwh-reply-input-wrapper.is-recording .rwh-reply-mic-btn .rwh-ico-mic { display: none; }
.rwh-reply-input-wrapper.is-recording .rwh-reply-mic-btn .rwh-ico-stop { display: block; }
.rwh-reply-input-wrapper.is-voice-preview .rwh-reply-mic-btn { display: none; }

.rwh-reply-container .rwh-voice-bar {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 54px;
    padding: 8px 14px;
    border: 2px solid var(--rwh-admin-border, #e2e8f0);
    border-radius: 16px;
    background: #ffffff;
    direction: rtl;
}

.rwh-reply-container .rwh-voice-bar[hidden] { display: none; }

.rwh-reply-input-wrapper.is-recording #rwh-reply-input,
.rwh-reply-input-wrapper.is-recording .rwh-reply-attach-btn,
.rwh-reply-input-wrapper.is-voice-preview #rwh-reply-input,
.rwh-reply-input-wrapper.is-voice-preview .rwh-reply-attach-btn {
    display: none;
}

.rwh-reply-container .rwh-voice-bar .rwhv-player {
    flex: 1 1 auto;
    max-width: 420px;
}

/* ======================================================================
   6. Motion preferences
   ====================================================================== */

@media (prefers-reduced-motion: reduce) {
    .rwh-rec-dot,
    #rwh-widget-hub .rwh-chat-container.rwh-restoring::before {
        animation: none;
    }
    #rwh-widget-hub .rwh-send-btn .rwh-ico { transition: none; }
}

/* ======================================================================
   Search in تاریخچه and «۲ از ۵» inside a conversation (v2.13.0)
   ====================================================================== */

#rwh-widget-hub .rwh-hsearch {
    padding: 10px 14px 8px;
    border-bottom: 1px solid var(--rwh-border, #e2e8f0);
    background: var(--rwh-bg, #fff);
}
#rwh-widget-hub .rwh-hsearch-field {
    position: relative;
    display: flex;
    align-items: center;
    height: 42px;
    background: var(--rwh-bg-secondary, #f8fafc);
    border: 1.5px solid var(--rwh-border, #e2e8f0);
    border-radius: 14px;
    transition: border-color .2s, box-shadow .2s, background-color .2s;
}
#rwh-widget-hub .rwh-hsearch-field:focus-within {
    background: #fff;
    border-color: var(--rwh-primary, #9d4edd);
    box-shadow: 0 0 0 4px rgba(157, 78, 221, .14);
}
#rwh-widget-hub .rwh-hsearch-ico {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin: 0 12px 0 4px;
    fill: none;
    stroke: var(--rwh-text-secondary, #64748b);
    stroke-width: 2.2;
    stroke-linecap: round;
}
#rwh-widget-hub .rwh-hsearch-field:focus-within .rwh-hsearch-ico { stroke: var(--rwh-primary, #9d4edd); }
#rwh-widget-hub .rwh-hsearch-input {
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
    border: 0 !important;
    outline: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    font: inherit;
    font-size: 16px; /* 16px: iOS does not zoom the page on focus */
    color: var(--rwh-text, #1e293b);
    -webkit-appearance: none;
    appearance: none;
}
#rwh-widget-hub .rwh-hsearch-input::placeholder { color: #94a3b8; font-size: 14px; }
#rwh-widget-hub .rwh-hsearch-input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
#rwh-widget-hub .rwh-hsearch-clear {
    flex: 0 0 auto;
    width: 26px !important;
    height: 26px !important;
    margin: 0 4px 0 10px !important;
    border: 0;
    border-radius: 50% !important;
    background: #ece5f7 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
#rwh-widget-hub .rwh-hsearch-clear[hidden] { display: none !important; }
#rwh-widget-hub .rwh-hsearch-clear svg { width: 12px; height: 12px; fill: none; stroke: #6b21a8; stroke-width: 2.6; stroke-linecap: round; }
#rwh-widget-hub .rwh-hsearch-spin {
    display: none;
    width: 16px;
    height: 16px;
    margin: 0 6px;
    border-radius: 50%;
    border: 2px solid rgba(157, 78, 221, .2);
    border-top-color: var(--rwh-primary, #9d4edd);
    animation: rwhs-spin .7s linear infinite;
}
#rwh-widget-hub .rwh-hsearch.is-loading .rwh-hsearch-spin { display: inline-block; }
@keyframes rwhs-spin { to { transform: rotate(360deg); } }

#rwh-widget-hub .rwh-history-container.is-searching .rwh-history-list { display: none !important; }
#rwh-widget-hub .rwh-hsearch-results {
    flex: 1;
    overflow-y: auto;
    padding: 10px 12px 16px;
    scrollbar-width: none;
}
#rwh-widget-hub .rwh-hsearch-results::-webkit-scrollbar { display: none; }
#rwh-widget-hub .rwh-hsearch-results[hidden] { display: none !important; }
#rwh-widget-hub .rwh-hs-summary {
    font-size: 12px;
    font-weight: 700;
    color: var(--rwh-text-secondary, #64748b);
    padding: 2px 4px 8px;
}
#rwh-widget-hub .rwh-hs-note {
    font-size: 12px;
    color: #92400e;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 10px;
    padding: 8px 10px;
    margin-bottom: 10px;
}
#rwh-widget-hub .rwh-hs-group {
    background: #fff;
    border: 1px solid var(--rwh-border, #e2e8f0);
    border-radius: 16px;
    margin-bottom: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(15, 23, 42, .04);
}
#rwh-widget-hub .rwh-hs-ghead {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: linear-gradient(180deg, #faf7ff 0%, #fff 100%);
    border-bottom: 1px solid #f1edf8;
}
#rwh-widget-hub .rwh-hs-gico {
    width: 26px;
    height: 26px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #9d4edd 0%, #7b2cbf 100%);
    flex: 0 0 auto;
}
#rwh-widget-hub .rwh-hs-gico.ai { background: linear-gradient(135deg, #4facfe 0%, #00c6fb 100%); }
#rwh-widget-hub .rwh-hs-gico svg { width: 14px; height: 14px; fill: none; stroke: #fff; stroke-width: 2.2; stroke-linejoin: round; }
#rwh-widget-hub .rwh-hs-gtitle { font-size: 13px; font-weight: 700; color: var(--rwh-text, #1e293b); }
#rwh-widget-hub .rwh-hs-status {
    font-size: 10.5px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #64748b;
}
#rwh-widget-hub .rwh-hs-status.pending { background: #fef3c7; color: #b45309; }
#rwh-widget-hub .rwh-hs-status.replied { background: #d1fae5; color: #047857; }
#rwh-widget-hub .rwh-hs-gtime { margin-inline-start: auto; font-size: 11.5px; color: #94a3b8; white-space: nowrap; }
#rwh-widget-hub .rwh-hs-item {
    position: relative;
    display: block;
    padding: 10px 14px 10px 34px;
    cursor: pointer;
    border-top: 1px solid #f5f2fa;
    transition: background-color .15s;
    outline: none;
}
#rwh-widget-hub .rwh-hs-ghead + .rwh-hs-item { border-top: 0; }
#rwh-widget-hub .rwh-hs-item:hover,
#rwh-widget-hub .rwh-hs-item.is-active { background: #f7f2fe; }
#rwh-widget-hub .rwh-hs-item.is-opening { opacity: .6; }
#rwh-widget-hub .rwh-hs-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
#rwh-widget-hub .rwh-hs-who {
    font-size: 11px;
    font-weight: 700;
    color: #6d28d9;
}
#rwh-widget-hub .rwh-hs-who.support { color: #047857; }
#rwh-widget-hub .rwh-hs-who.ai { color: #0369a1; }
#rwh-widget-hub .rwh-hs-when { font-size: 11px; color: #94a3b8; }
#rwh-widget-hub .rwh-hs-snippet {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 13px;
    line-height: 1.8;
    color: #475569;
    overflow-wrap: anywhere;
}
#rwh-widget-hub .rwh-hs-go {
    position: absolute;
    left: 10px;
    top: 50%;
    width: 16px;
    height: 16px;
    margin-top: -8px;
    fill: none;
    stroke: #c4b5fd;
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform .15s, stroke .15s;
}
#rwh-widget-hub .rwh-hs-item:hover .rwh-hs-go,
#rwh-widget-hub .rwh-hs-item.is-active .rwh-hs-go { stroke: var(--rwh-primary, #9d4edd); transform: translateX(-3px); }
#rwh-widget-hub mark.rwh-hl {
    background: linear-gradient(180deg, transparent 8%, rgba(157, 78, 221, .2) 8%, rgba(157, 78, 221, .2) 92%, transparent 92%);
    color: #5b21b6;
    font-weight: 700;
    border-radius: 3px;
    padding: 0 1px;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
}
#rwh-widget-hub .rwh-sr-ellipsis { color: #94a3b8; }
#rwh-widget-hub .rwh-hs-more {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    padding: 11px !important;
    margin: 4px 0 0 !important;
    border: 1.5px dashed #d8ccef !important;
    border-radius: 14px !important;
    background: #fff !important;
    color: var(--rwh-primary-dark, #7b2cbf) !important;
    font: inherit;
    font-size: 13px !important;
    font-weight: 700 !important;
    cursor: pointer;
}
#rwh-widget-hub .rwh-hs-more.is-busy { opacity: .6; }
#rwh-widget-hub .rwh-hs-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
    padding: 40px 20px;
    color: var(--rwh-text-secondary, #64748b);
    font-size: 13px;
}
#rwh-widget-hub .rwh-hs-empty b { color: var(--rwh-text, #1e293b); font-size: 14px; }
#rwh-widget-hub .rwh-hs-empty-ico {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #f3eefc;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
}
#rwh-widget-hub .rwh-hs-empty-ico svg { width: 26px; height: 26px; fill: none; stroke: #a78bdb; stroke-width: 2; stroke-linecap: round; }
#rwh-widget-hub .rwh-hs-skel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px;
    margin-bottom: 10px;
    border: 1px solid #f1edf8;
    border-radius: 16px;
}
#rwh-widget-hub .rwh-hs-skel span {
    display: block;
    height: 11px;
    border-radius: 6px;
    background: linear-gradient(90deg, #f1edf8 25%, #e7e0f3 37%, #f1edf8 63%);
    background-size: 400% 100%;
    animation: rwhs-skel 1.3s ease infinite;
}
#rwh-widget-hub .rwh-hs-skel span:nth-child(1) { width: 45%; }
#rwh-widget-hub .rwh-hs-skel span:nth-child(3) { width: 70%; }
@keyframes rwhs-skel { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* «۲ از ۵» bar above an open conversation */
#rwh-widget-hub .rwh-findbar-host { position: relative; z-index: 3; flex: 0 0 auto; }
#rwh-widget-hub .rwh-findbar {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 8px 12px 0;
    padding: 5px 6px;
    background: #1e1b2e;
    color: #fff;
    border-radius: 14px;
    box-shadow: 0 10px 24px rgba(30, 27, 46, .25);
    font-size: 12.5px;
    animation: rwhs-in .22s ease-out;
}
@keyframes rwhs-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
#rwh-widget-hub .rwh-findbar-ico { width: 15px; height: 15px; margin: 0 6px; fill: none; stroke: #c4b5fd; stroke-width: 2.2; stroke-linecap: round; flex: 0 0 auto; }
#rwh-widget-hub .rwh-findbar-q { font-weight: 700; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#rwh-widget-hub .rwh-findbar-count { flex: 1; color: #cbd5e1; padding: 0 4px; white-space: nowrap; }
#rwh-widget-hub .rwh-findbar-btn {
    width: 30px !important;
    height: 30px !important;
    border: 0 !important;
    border-radius: 9px !important;
    background: rgba(255, 255, 255, .1) !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex: 0 0 auto;
}
#rwh-widget-hub .rwh-findbar-btn:disabled { opacity: .35; cursor: default; }
#rwh-widget-hub .rwh-findbar-btn svg { width: 15px; height: 15px; fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
#rwh-widget-hub .rwh-message mark.rwh-hl {
    background: #fde68a;
    color: #1e293b;
    font-weight: inherit;
    border-radius: 4px;
    padding: 0 2px;
}
#rwh-widget-hub .rwh-message.user mark.rwh-hl { background: rgba(253, 230, 138, .95); color: #3b0764; }
#rwh-widget-hub .rwh-message.rwh-search-target .rwh-message-bubble {
    box-shadow: 0 0 0 3px rgba(245, 158, 11, .6), 0 10px 24px rgba(245, 158, 11, .2) !important;
    animation: rwhs-pulse 1.6s ease-out 1;
}
#rwh-widget-hub .rwh-message.rwh-search-target mark.rwh-hl { background: #f59e0b; color: #fff; }
@keyframes rwhs-pulse {
    0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, .75); }
    40% { box-shadow: 0 0 0 9px rgba(245, 158, 11, .15); }
    100% { box-shadow: 0 0 0 3px rgba(245, 158, 11, .6), 0 10px 24px rgba(245, 158, 11, .2); }
}
@media (prefers-reduced-motion: reduce) {
    #rwh-widget-hub .rwh-findbar,
    #rwh-widget-hub .rwh-hs-skel span,
    #rwh-widget-hub .rwh-message.rwh-search-target .rwh-message-bubble { animation: none; }
}
#rwh-widget-hub .rwh-hs-note.is-fix { color: #5b21b6; background: #f5f0ff; border-color: #ddd0f5; }
