/* Holistify Live Chat — Frontend Widget CSS */

#hlc-widget {
    --hlc-r: 16px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    position: fixed;
    bottom: 24px;
    z-index: 999999;
    line-height: 1.5;
    font-size: 14px;
}
#hlc-widget[data-position="right"] { right: 24px; }
#hlc-widget[data-position="left"] { left: 24px; }

/* Toggle button */
#hlc-toggle {
    width: 60px; height: 60px; border-radius: 50%;
    background: var(--hlc-t); color: var(--hlc-ti);
    border: none; cursor: pointer;
    box-shadow: 0 4px 20px rgba(0,0,0,.18);
    display: flex; align-items: center; justify-content: center;
    transition: transform .2s; position: relative;
}
#hlc-toggle:hover { transform: scale(1.08); }

#hlc-unread-badge {
    position: absolute; top: -4px; right: -4px;
    background: #e74c3c; color: #fff;
    font-size: 11px; font-weight: 700;
    min-width: 20px; height: 20px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    padding: 0 5px; border: 2px solid #fff;
}

/* Window */
#hlc-window {
    position: absolute; bottom: 76px;
    width: 376px; max-height: 540px; height: 540px;
    background: #fff; border-radius: var(--hlc-r);
    box-shadow: 0 8px 30px rgba(0,0,0,.15);
    display: flex; flex-direction: column;
    overflow: hidden; animation: hlcUp .25s ease;
}
#hlc-widget[data-position="right"] #hlc-window { right: 0; }

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

/* ─── TAB BAR ─── */
#hlc-tab-bar {
    background: var(--hlc-p); padding: 4px 14px;
    display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.hlc-tabs { display: flex; gap: 4px; }
.hlc-tab {
    background: rgba(255,255,255,.12); color: rgba(255,255,255,.7);
    border: none; padding: 6px 12px; border-radius: 6px;
    cursor: pointer; font-family: inherit; font-size: 12px; font-weight: 500;
    display: flex; align-items: center; gap: 5px;
    transition: background .15s, color .15s;
}
.hlc-tab.active { background: rgba(255,255,255,.22); color: #fff; }
.hlc-tab:hover { color: #fff; }
#hlc-minimize {
    background: none; border: none; color: rgba(255,255,255,.6);
    cursor: pointer; padding: 6px; font-size: 13px;
}
#hlc-minimize:hover { color: #fff; }

/* ─── SCREENS ─── */
.hlc-screen {
    flex: 1; display: flex; flex-direction: column;
    min-height: 0; overflow: hidden;
}

/* ─── HOME ─── */
#hlc-home { display: flex; flex-direction: column; height: 100%; }
#hlc-home-body {
    padding: 6px 14px 16px; text-align: center;
    color: #444444; position: relative;
}
.hlc-home-avatar { margin-bottom: 6px; }
.hlc-av-img {
    width: 50px; height: 50px; border-radius: 50%;
    object-fit: cover; border: 2px solid rgba(255,255,255,.3);
}
.hlc-av-letter {
    width: 50px; height: 50px; border-radius: 50%;
    background: rgba(255,255,255,.18);
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 20px; border: 2px solid rgba(255,255,255,.3);
}
.hlc-home-brand { font-size: 17px; font-weight: 700; margin-bottom: 1px; }
.hlc-home-subtitle { font-size: 13px; opacity: .85; line-height: 1.4; }

#hlc-home-actions { flex: 1; padding: 16px 16px 10px; background: var(--hlc-s); }
.hlc-section-title { font-size: 13px; font-weight: 600; color: #888; margin-bottom: 8px; }
.hlc-action-item {
    display: flex; align-items: center; gap: 12px; width: 100%;
    padding: 12px 14px; background: #fff; border: 1px solid #eee;
    border-radius: 10px; cursor: pointer; transition: box-shadow .15s;
    font-family: inherit; font-size: 14px; color: #333; text-align: left;
}
.hlc-action-item:hover { box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.hlc-ai-icon { font-size: 15px; color: var(--hlc-p); width: 18px; text-align: center; }
.hlc-ai-text { flex: 1; font-weight: 500; }
.hlc-ai-arrow { font-size: 11px; opacity: .3; }

#hlc-home-footer {
    padding: 9px 16px; border-top: 1px solid #eee;
    display: flex; align-items: center; gap: 6px;
    font-size: 12px; color: #999; background: #fff;
}
#hlc-online-dot { width: 7px; height: 7px; border-radius: 50%; background: #4ade80; }
#hlc-online-dot.offline { background: #f87171; }

/* ─── CHAT ─── */
#hlc-chat-screen { display: flex; flex-direction: column; height: 100%; }
#hlc-chat-hdr {
    background: var(--hlc-p); color: #fff;
    padding: 7px 12px; display: flex; align-items: center; gap: 8px;
}
.hlc-chdr-av { flex-shrink: 0; }
.hlc-av-sm { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.hlc-av-sm-l {
    width: 28px; height: 28px; border-radius: 50%;
    background: rgba(255,255,255,.18);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 11px;
}
.hlc-chdr-info { flex: 1; min-width: 0; }
.hlc-chdr-name { font-weight: 600; font-size: 13px; }
.hlc-chdr-sub { font-size: 10px; opacity: .65; }

#hlc-messages {
    flex: 1; overflow-y: auto; padding: 12px;
    display: flex; flex-direction: column; gap: 7px;
    background: var(--hlc-s); scroll-behavior: smooth;
}
#hlc-messages::-webkit-scrollbar { width: 3px; }
#hlc-messages::-webkit-scrollbar-thumb { background: rgba(0,0,0,.1); border-radius: 2px; }

.hlc-msg {
    max-width: 100%; padding: 8px 12px; border-radius: 14px;
    font-size: 13px; line-height: 1.45; word-wrap: break-word;
    animation: hlcFi .2s ease;
}

/* Chat list */
#hlc-chat-list { display: flex; flex-direction: column; height: 100%; }
#hlc-chat-list-inner { flex: 1; overflow-y: auto; padding: 8px; }
.hlc-conv-item {
    display: flex; align-items: center; gap: 10px; padding: 12px;
    border-radius: 10px; cursor: pointer; transition: background .12s;
    border: 1px solid transparent; margin-bottom: 4px;
}
.hlc-conv-item:hover { background: #f5f2ed; }
.hlc-conv-item.active-conv { border-color: var(--hlc-p); background: rgba(109,47,58,.06); }
.hlc-conv-ava {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--hlc-p);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 13px;
    flex-shrink: 0; overflow: hidden;
}
.hlc-conv-ava img { width: 100%; height: 100%; object-fit: cover; }
.hlc-conv-info { flex: 1; min-width: 0; }
.hlc-conv-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2px; }
.hlc-conv-name { font-weight: 600; font-size: 13px; color: #333; }
.hlc-conv-time { font-size: 10px; color: #aaa; }
.hlc-conv-preview { font-size: 12px; color: #888; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hlc-conv-status { font-size: 9px; padding: 2px 6px; border-radius: 4px; font-weight: 600; }
.hlc-conv-status.ended { background: #f0f0f0; color: #999; }
.hlc-conv-status.active { background: #dcfce7; color: #16a34a; }
.hlc-conv-empty { text-align: center; padding: 40px 20px; color: #bbb; font-size: 13px; }
#hlc-new-conv-wrap { padding: 10px 12px; border-top: 1px solid #eee; background: #fff; }
#hlc-new-conv-btn {
    width: 100%; padding: 10px; background: var(--hlc-p); color: #fff;
    border: none; border-radius: 8px; font-size: 13px; font-weight: 600;
    cursor: pointer; font-family: inherit;
    display: flex; align-items: center; justify-content: center; gap: 6px;
}
#hlc-new-conv-btn:hover { opacity: .9; }

@keyframes hlcFi {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}
.hlc-msg.visitor {
    align-self: flex-end; background: var(--hlc-p); color: #fff;
    border-bottom-right-radius: 4px;
}
.hlc-msg.agent {
    align-self: flex-start; background: #fff; color: #333;
    border-bottom-left-radius: 4px; box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.hlc-msg-sender { font-size: 11px; font-weight: 600; color: #999; margin-bottom: 2px; }
.hlc-msg-time { font-size: 10px; opacity: .5; margin-top: 2px; }
.hlc-msg.visitor .hlc-msg-time { text-align: right; }
.hlc-msg-row {
    display: flex; gap: 6px; align-items: flex-end;
    align-self: flex-start; max-width: 100%;
}
.hlc-msg-ava {
    width: 24px; height: 24px; border-radius: 50%;
    background: var(--hlc-p);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 9px; color: #fff;
    flex-shrink: 0; overflow: hidden;
}
.hlc-msg-ava img { width: 100%; height: 100%; object-fit: cover; }

/* Typing indicator */
#hlc-typing-indicator { padding: 2px 12px; }
.hlc-typing-bubble {
    display: inline-flex; align-items: center; gap: 3px;
    background: #fff; padding: 7px 12px; border-radius: 12px;
    border-bottom-left-radius: 4px; box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.hlc-dot {
    width: 5px; height: 5px; border-radius: 50%;
    background: #aaa; animation: hlcB 1.2s infinite;
}
.hlc-dot:nth-child(2) { animation-delay: .2s; }
.hlc-dot:nth-child(3) { animation-delay: .4s; }
@keyframes hlcB {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-4px); }
}

/* ─── Email prompt ─── */
#hlc-email-prompt { padding: 5px 12px 5px; }
#hlc-email-bar {
    display: flex; align-items: center; gap: 7px;
    padding: 7px 12px; background: #fff; border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0,0,0,.05); cursor: pointer;
    font-size: 11px; color: #888; transition: background .12s;
}
#hlc-email-bar:hover { background: #f9f7f4; }
#hlc-email-bar i { color: var(--hlc-p); font-size: 12px; }
#hlc-email-form {
    background: #fff; border-radius: 8px; padding: 12px;
    margin-top: 5px; box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.hlc-ef-title { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.hlc-ef-desc { font-size: 11px; color: #999; margin: 0 0 6px; }
#hlc-email-input {
    width: 100%; padding: 8px 10px; border: 1px solid #ddd;
    border-radius: 7px; font-size: 13px; font-family: inherit;
    outline: none; box-sizing: border-box;
}
#hlc-email-input:focus { border-color: var(--hlc-p); }
.hlc-ef-btns { display: flex; gap: 6px; margin-top: 7px; }
#hlc-email-submit {
    background: var(--hlc-p); color: #fff; border: none;
    padding: 7px 14px; border-radius: 7px; font-size: 12px;
    font-weight: 600; cursor: pointer; font-family: inherit;
}
#hlc-email-skip {
    background: none; border: 1px solid #ddd; padding: 7px 14px;
    border-radius: 7px; font-size: 12px; cursor: pointer;
    color: #999; font-family: inherit;
}
#hlc-email-saved { text-align: center; padding: 8px; color: #16a34a; font-size: 12px; }

/* ─── Input area ─── */
#hlc-input-area { border-top: 1px solid #eee; background: #fff; padding: 0; }
#hlc-input-box { display: flex; align-items: flex-end; padding: 8px 10px; gap: 6px; }
#hlc-input {
    flex: 1; border: none; padding: 8px 8px; font-size: 14px;
    font-family: inherit; resize: none; max-height: 90px;
    outline: none; line-height: 1.4; min-height: 40px;
}
.hlc-input-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; padding-bottom: 4px; }
.hlc-input-actions button {
    background: none; border: none; cursor: pointer; padding: 6px;
    font-size: 18px; color: #bbb; transition: color .15s; border-radius: 4px;
}
.hlc-input-actions button:hover { color: #666; }
.hlc-send-btn { color: var(--hlc-p) !important; font-size: 17px !important; transition: opacity .15s !important; }
.hlc-send-btn.disabled { opacity: .3 !important; cursor: default !important; pointer-events: none; }

/* Emoji picker */
.hlc-emoji-grid {
    display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px;
    padding: 8px; max-height: 160px; overflow-y: auto;
    border-top: 1px solid #f0f0f0; background: #fff;
}
.hlc-emoji-grid button {
    background: none; border: none; font-size: 18px; padding: 4px;
    cursor: pointer; border-radius: 4px; transition: background .12s;
}
.hlc-emoji-grid button:hover { background: #f0f0f0; }

/* ─── OFFLINE ─── */
#hlc-offline { display: flex; flex-direction: column; height: 100%; }
#hlc-off-hdr {
    background: var(--hlc-p); color: #fff; padding: 9px 14px;
    font-weight: 600; font-size: 13px; text-align: center;
}
#hlc-off-inner {
    flex: 1; display: flex; flex-direction: column;
    background: var(--hlc-s); overflow-y: auto;
}
#hlc-off-form { display: flex; flex-direction: column; gap: 10px; padding: 20px 18px; }
.hlc-fg input, .hlc-fg textarea {
    width: 100%; padding: 8px 10px; border: 1px solid #ddd;
    border-radius: 7px; font-size: 13px; font-family: inherit;
    outline: none; box-sizing: border-box;
}
.hlc-fg input:focus, .hlc-fg textarea:focus { border-color: var(--hlc-p); }

/* Honeypot — hidden from humans, visible to bots */
.hlc-hp-field {
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
    pointer-events: none !important;
}
#hlc-off-send {
    background: var(--hlc-p); color: #fff; border: none; padding: 10px;
    border-radius: 7px; font-size: 13px; font-weight: 600;
    cursor: pointer; font-family: inherit;
}

/* ─── FAQ ─── */
#hlc-faq-screen { display: flex; flex-direction: column; height: 100%; }
#hlc-faq-hdr {
    background: var(--hlc-p); color: #fff; padding: 9px 14px;
    font-weight: 600; font-size: 13px; text-align: center;
}
#hlc-faq-inner { flex: 1; overflow-y: auto; padding: 10px 12px; background: var(--hlc-s); }
.hlc-faq-card {
    background: #fff; border: 1px solid #eee; border-radius: 10px;
    margin-bottom: 8px; overflow: hidden; transition: box-shadow .12s;
}
.hlc-faq-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.04); }
.hlc-faq-q {
    display: flex; align-items: center; justify-content: space-between;
    padding: 11px 14px; cursor: pointer; font-size: 13px;
    font-weight: 600; color: #333; gap: 8px;
}
.hlc-faq-q i { font-size: 10px; color: #bbb; transition: transform .2s; flex-shrink: 0; }
.hlc-faq-card.open .hlc-faq-q i { transform: rotate(180deg); }
.hlc-faq-a {
    display: none; padding: 0 14px 12px; font-size: 12.5px;
    color: #666; line-height: 1.5;
}
.hlc-faq-a a { color: var(--hlc-p); text-decoration: underline; }
.hlc-faq-a a:hover { opacity: .8; }
.hlc-faq-cat {
    font-size: 12px; font-weight: 600; color: #888;
    letter-spacing: .5px; text-transform: uppercase;
    padding: 12px 4px 6px; margin-top: 4px;
}
.hlc-faq-cat:first-child { margin-top: 0; padding-top: 4px; }
.hlc-faq-card.open .hlc-faq-a { display: block; }
.hlc-faq-empty { text-align: center; padding: 40px 20px; color: #bbb; font-size: 13px; }

/* ─── Link preview ─── */
.hlc-link-preview {
    display: block; margin-top: 6px; padding: 8px 10px;
    background: #f9f7f4; border: 1px solid #eee; border-radius: 8px;
    text-decoration: none; color: #333; transition: background .12s; overflow: hidden;
}
.hlc-link-preview:hover { background: #f0ede7; }
.hlc-lp-img { width: 100%; height: 100px; object-fit: cover; border-radius: 6px; margin-bottom: 6px; }
.hlc-lp-title { font-size: 12px; font-weight: 600; line-height: 1.3; margin-bottom: 2px; color: #333; }
.hlc-lp-desc { font-size: 11px; color: #888; line-height: 1.35; }
.hlc-lp-domain { font-size: 10px; color: #aaa; margin-top: 3px; }
.hlc-msg.visitor .hlc-link-preview { background: rgba(255,255,255,.15); border-color: rgba(255,255,255,.2); }
.hlc-msg.visitor .hlc-link-preview:hover { background: rgba(255,255,255,.25); }
.hlc-msg.visitor .hlc-lp-title,
.hlc-msg.visitor .hlc-lp-desc,
.hlc-msg.visitor .hlc-lp-domain { color: rgba(255,255,255,.9); }
.hlc-msg a { color: inherit; text-decoration: underline; }
.hlc-msg.visitor a { color: #fff; }

/* Test banner */
#hlc-test-banner {
    position: fixed; bottom: 90px; right: 24px;
    background: #f59e0b; color: #78350f;
    font-size: 11px; font-weight: 600; padding: 5px 12px;
    border-radius: 6px; z-index: 999998;
    box-shadow: 0 2px 8px rgba(0,0,0,.1); pointer-events: none;
}

/* ─── Mobile ─── */
@media (max-width: 480px) {
    #hlc-window {
        width: calc(100vw - 32px); height: calc(100dvh - 120px);
        max-height: none; bottom: 72px; border-radius: 14px;
    }
    #hlc-widget { bottom: 16px; }
    #hlc-widget[data-position="right"] { right: 16px; }
}
