/* ── KND Support Chat Widget ── */

.knd-chat-btn {
    position: fixed; bottom: 24px; right: 24px; z-index: 9998;
    width: 56px; height: 56px; border-radius: 50%; border: none;
    background: linear-gradient(135deg, #00d4ff 0%, #0a8f9e 100%);
    color: #fff; font-size: 22px; cursor: pointer;
    box-shadow: 0 4px 20px rgba(0,212,255,.35);
    transition: transform .2s, box-shadow .2s;
    display: flex; align-items: center; justify-content: center;
}
.knd-chat-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(0,212,255,.5);
}
.knd-chat-btn.has-panel { display: none; }

.knd-chat-panel {
    display: none; flex-direction: column;
    position: fixed; bottom: 24px; right: 24px; z-index: 9999;
    width: 370px; max-width: calc(100vw - 32px);
    height: 520px; max-height: calc(100vh - 48px);
    background: #0b0e14;
    border: 1px solid rgba(0,212,255,.15);
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0,0,0,.6), 0 0 0 1px rgba(0,212,255,.08);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.knd-chat-panel.open { display: flex; }

.knd-chat-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px;
    background: rgba(0,212,255,.06);
    border-bottom: 1px solid rgba(0,212,255,.1);
}
.knd-chat-header-info h4 {
    margin: 0; font-size: 15px; font-weight: 700; color: #fff;
}
.knd-chat-header-info span {
    font-size: 11px; color: rgba(0,212,255,.7); letter-spacing: .3px;
}
.knd-chat-close {
    background: none; border: none; color: rgba(255,255,255,.5);
    font-size: 20px; cursor: pointer; padding: 0 4px; line-height: 1;
}
.knd-chat-close:hover { color: #fff; }

.knd-chat-messages {
    flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px;
    scrollbar-width: thin; scrollbar-color: rgba(0,212,255,.2) transparent;
}
.knd-chat-messages::-webkit-scrollbar { width: 5px; }
.knd-chat-messages::-webkit-scrollbar-thumb { background: rgba(0,212,255,.2); border-radius: 4px; }

.knd-chat-msg {
    max-width: 85%; padding: 10px 14px; border-radius: 14px;
    font-size: 13.5px; line-height: 1.45; word-wrap: break-word;
}
.knd-chat-msg.assistant {
    align-self: flex-start;
    background: rgba(0,212,255,.08); color: #e0e6ec;
    border-bottom-left-radius: 4px;
}
.knd-chat-msg.user {
    align-self: flex-end;
    background: rgba(0,212,255,.2); color: #fff;
    border-bottom-right-radius: 4px;
}
.knd-chat-msg.system {
    align-self: center; text-align: center;
    background: rgba(255,255,255,.04); color: rgba(255,255,255,.5);
    font-size: 11.5px; padding: 8px 14px; border-radius: 10px;
    max-width: 95%;
}
.knd-chat-msg a {
    color: #00d4ff; text-decoration: underline;
}

.knd-chat-quick {
    display: flex; flex-wrap: wrap; gap: 6px;
    padding: 8px 16px;
    border-top: 1px solid rgba(255,255,255,.05);
}
.knd-chat-quick-btn {
    background: rgba(0,212,255,.08); border: 1px solid rgba(0,212,255,.2);
    color: #00d4ff; font-size: 12px; font-weight: 500;
    padding: 5px 12px; border-radius: 20px; cursor: pointer;
    transition: background .15s, border-color .15s;
    white-space: nowrap;
}
.knd-chat-quick-btn:hover {
    background: rgba(0,212,255,.18); border-color: rgba(0,212,255,.4);
}

.knd-chat-input-bar {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 14px;
    border-top: 1px solid rgba(0,212,255,.1);
    background: rgba(0,212,255,.03);
}
.knd-chat-input {
    flex: 1; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1);
    border-radius: 22px; padding: 9px 16px; font-size: 13.5px;
    color: #fff; outline: none; resize: none; max-height: 80px;
    font-family: inherit;
}
.knd-chat-input::placeholder { color: rgba(255,255,255,.35); }
.knd-chat-input:focus { border-color: rgba(0,212,255,.35); }
.knd-chat-send {
    background: linear-gradient(135deg, #00d4ff, #0a8f9e); border: none;
    color: #fff; width: 38px; height: 38px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 15px; flex-shrink: 0;
    transition: opacity .15s;
}
.knd-chat-send:disabled { opacity: .4; cursor: not-allowed; }

.knd-chat-typing {
    align-self: flex-start; padding: 10px 14px;
    background: rgba(0,212,255,.08); border-radius: 14px; border-bottom-left-radius: 4px;
    display: none;
}
.knd-chat-typing span {
    display: inline-block; width: 7px; height: 7px; border-radius: 50%;
    background: rgba(0,212,255,.5); margin: 0 2px;
    animation: kndTyping .9s infinite;
}
.knd-chat-typing span:nth-child(2) { animation-delay: .15s; }
.knd-chat-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes kndTyping {
    0%, 60%, 100% { opacity: .3; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-4px); }
}

@media (max-width: 480px) {
    .knd-chat-panel {
        bottom: 0; right: 0; left: 0;
        width: 100%; max-width: 100%;
        height: 100vh; max-height: 100vh;
        border-radius: 0; border: none;
    }
    .knd-chat-btn { bottom: 16px; right: 16px; width: 50px; height: 50px; font-size: 20px; }
}
