/* ────────────────────────────────────────
   Helseffekt Chatbot — chatbot.css v1.0
   ──────────────────────────────────────── */

/* Variables */
:root {
    --hsk-black:    #1a1a1a;
    --hsk-white:    #ffffff;
    --hsk-gray-bg:  #f4f4f4;
    --hsk-gray-mid: #e0e0e0;
    --hsk-gray-txt: #666666;
    --hsk-accent:   #1a1a1a;
    --hsk-green:    #22c55e;
    --hsk-radius:   16px;
    --hsk-shadow:   0 8px 32px rgba(0,0,0,0.18);
    --hsk-font:     -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ── Bubble ── */
#hsk-chat-bubble {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 58px;
    height: 58px;
    background: var(--hsk-black);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--hsk-shadow);
    z-index: 99998;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    user-select: none;
}
#hsk-chat-bubble:hover {
    transform: scale(1.08);
    box-shadow: 0 12px 40px rgba(0,0,0,0.25);
}
#hsk-notif-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 10px;
    height: 10px;
    background: var(--hsk-green);
    border-radius: 50%;
    border: 2px solid var(--hsk-white);
}

/* ── Window ── */
#hsk-chat-window {
    position: fixed;
    bottom: 100px;
    right: 28px;
    width: 360px;
    max-height: 560px;
    background: var(--hsk-white);
    border-radius: var(--hsk-radius);
    box-shadow: var(--hsk-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 99999;
    font-family: var(--hsk-font);
    font-size: 14px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(16px) scale(0.97);
    transition: opacity 0.22s ease, transform 0.22s ease;
}
#hsk-chat-window.hsk-open {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0) scale(1);
}

/* ── Header ── */
#hsk-chat-header {
    background: var(--hsk-black);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
#hsk-chat-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}
#hsk-avatar {
    width: 38px;
    height: 38px;
    background: #333;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    color: var(--hsk-white);
    flex-shrink: 0;
}
#hsk-chat-name {
    color: var(--hsk-white);
    font-weight: 600;
    font-size: 15px;
    line-height: 1.2;
}
#hsk-chat-status {
    color: #aaa;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
}
#hsk-status-dot {
    width: 7px;
    height: 7px;
    background: var(--hsk-green);
    border-radius: 50%;
    display: inline-block;
}
#hsk-chat-close {
    background: none;
    border: none;
    color: #aaa;
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    transition: color 0.15s;
}
#hsk-chat-close:hover { color: var(--hsk-white); }

/* ── Messages ── */
#hsk-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}
#hsk-chat-messages::-webkit-scrollbar { width: 4px; }
#hsk-chat-messages::-webkit-scrollbar-track { background: transparent; }
#hsk-chat-messages::-webkit-scrollbar-thumb { background: var(--hsk-gray-mid); border-radius: 4px; }

/* Bubble wrapper */
.hsk-msg {
    display: flex;
    flex-direction: column;
    max-width: 82%;
}
.hsk-msg.hsk-bot  { align-self: flex-start; }
.hsk-msg.hsk-user { align-self: flex-end; }

/* Bubble body */
.hsk-bubble {
    padding: 10px 13px;
    border-radius: 14px;
    line-height: 1.55;
    word-break: break-word;
}
.hsk-bot  .hsk-bubble {
    background: var(--hsk-gray-bg);
    color: var(--hsk-black);
    border-bottom-left-radius: 4px;
}
.hsk-user .hsk-bubble {
    background: var(--hsk-black);
    color: var(--hsk-white);
    border-bottom-right-radius: 4px;
}

/* Markdown-like inside bot bubbles */
.hsk-bubble strong { font-weight: 600; }
.hsk-bubble em     { font-style: italic; }
.hsk-bubble br     { display: block; content: ''; margin-top: 4px; }

/* Quick replies */
.hsk-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
.hsk-qr {
    background: var(--hsk-white);
    border: 1px solid var(--hsk-gray-mid);
    color: var(--hsk-black);
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}
.hsk-qr:hover {
    background: var(--hsk-gray-bg);
    border-color: #aaa;
}

/* Typing indicator */
.hsk-typing .hsk-bubble {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 14px;
}
.hsk-dot {
    width: 7px; height: 7px;
    background: #aaa;
    border-radius: 50%;
    animation: hsk-bounce 1.2s infinite ease-in-out;
}
.hsk-dot:nth-child(2) { animation-delay: 0.2s; }
.hsk-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes hsk-bounce {
    0%, 80%, 100% { transform: translateY(0);    opacity: 0.5; }
    40%            { transform: translateY(-6px); opacity: 1;   }
}

/* ── Contact form ── */
#hsk-contact-form {
    padding: 14px;
    border-top: 1px solid var(--hsk-gray-mid);
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
    background: var(--hsk-white);
}
#hsk-contact-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--hsk-black);
    margin-bottom: 2px;
}
#hsk-contact-form input,
#hsk-contact-form textarea {
    width: 100%;
    border: 1px solid var(--hsk-gray-mid);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    font-family: var(--hsk-font);
    color: var(--hsk-black);
    outline: none;
    transition: border-color 0.15s;
    box-sizing: border-box;
    resize: none;
}
#hsk-contact-form input:focus,
#hsk-contact-form textarea:focus {
    border-color: var(--hsk-black);
}
#hsk-contact-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 2px;
}
#hsk-contact-cancel {
    background: none;
    border: 1px solid var(--hsk-gray-mid);
    border-radius: 8px;
    padding: 7px 14px;
    font-size: 13px;
    cursor: pointer;
    color: var(--hsk-gray-txt);
    transition: background 0.15s;
}
#hsk-contact-cancel:hover { background: var(--hsk-gray-bg); }
#hsk-contact-send {
    background: var(--hsk-black);
    border: none;
    border-radius: 8px;
    padding: 7px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--hsk-white);
    cursor: pointer;
    transition: opacity 0.15s;
}
#hsk-contact-send:hover    { opacity: 0.85; }
#hsk-contact-send:disabled { opacity: 0.5; cursor: not-allowed; }
#hsk-contact-feedback {
    font-size: 12px;
    min-height: 16px;
    text-align: center;
}
#hsk-contact-feedback.hsk-ok  { color: #16a34a; }
#hsk-contact-feedback.hsk-err { color: #dc2626; }

/* ── Input area ── */
#hsk-chat-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid var(--hsk-gray-mid);
    flex-shrink: 0;
}
#hsk-chat-input {
    flex: 1;
    border: 1px solid var(--hsk-gray-mid);
    border-radius: 22px;
    padding: 9px 14px;
    font-size: 13px;
    font-family: var(--hsk-font);
    outline: none;
    transition: border-color 0.15s;
}
#hsk-chat-input:focus { border-color: var(--hsk-black); }
#hsk-chat-send {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--hsk-black);
    border: none;
    color: var(--hsk-white);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: opacity 0.15s;
}
#hsk-chat-send:hover { opacity: 0.8; }

/* ── Footer ── */
#hsk-chat-footer {
    padding: 8px 12px 10px;
    border-top: 1px solid var(--hsk-gray-mid);
    display: flex;
    justify-content: center;
    flex-shrink: 0;
}
#hsk-contact-btn {
    background: none;
    border: 1px solid var(--hsk-gray-mid);
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 12px;
    color: var(--hsk-gray-txt);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    display: flex;
    align-items: center;
    gap: 4px;
    font-family: var(--hsk-font);
}
#hsk-contact-btn:hover {
    background: var(--hsk-gray-bg);
    color: var(--hsk-black);
}

/* ── Responsive ── */
@media (max-width: 420px) {
    #hsk-chat-window {
        right: 0;
        bottom: 0;
        width: 100%;
        max-height: 90vh;
        border-radius: var(--hsk-radius) var(--hsk-radius) 0 0;
    }
    #hsk-chat-bubble {
        bottom: 20px;
        right: 20px;
    }
}
