/* ── Support Chat Widget ─────────────────────────────────────────────────── */
#supportChatBtn {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 9999;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4c6ef7 0%, #00d4b4 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(76,110,247,.45);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .2s, box-shadow .2s;
    color: #fff;
    font-size: 1.4rem;
}
#supportChatBtn:hover { transform: scale(1.08); box-shadow: 0 6px 28px rgba(76,110,247,.6); }
#supportChatBtn .chat-unread {
    position: absolute;
    top: 4px;
    right: 4px;
    background: #ff4d6d;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: none;
    align-items: center;
    justify-content: center;
    border: 2px solid #07101f;
}
#supportChatBtn .chat-unread.show { display: flex; }

#supportChatBox {
    position: fixed;
    bottom: 100px;
    right: 28px;
    z-index: 9998;
    width: 360px;
    max-width: calc(100vw - 40px);
    background: #0d1e3a;
    border: 1px solid rgba(76,110,247,.25);
    border-radius: 18px;
    box-shadow: 0 12px 50px rgba(4,9,20,.5);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: chatSlideIn .2s ease;
}
#supportChatBox.open { display: flex; }

@keyframes chatSlideIn {
    from { opacity: 0; transform: translateY(20px) scale(.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.sc-header {
    padding: 14px 18px;
    background: linear-gradient(135deg, rgba(76,110,247,.18) 0%, rgba(0,212,180,.1) 100%);
    border-bottom: 1px solid rgba(76,110,247,.15);
    display: flex;
    align-items: center;
    gap: 12px;
}
.sc-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4c6ef7, #00d4b4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #fff;
    flex-shrink: 0;
}
.sc-header-info .sc-name { font-size: 14px; font-weight: 700; color: #dce8ff; }
.sc-header-info .sc-status { font-size: 11px; color: #00d4b4; display: flex; align-items: center; gap: 5px; }
.sc-status-dot { width: 7px; height: 7px; background: #00d4b4; border-radius: 50%; display: inline-block; animation: pulse 1.5s infinite; }
.sc-header-close {
    margin-left: auto;
    background: none;
    border: none;
    color: #7090b8;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px;
    border-radius: 6px;
    transition: color .15s;
}
.sc-header-close:hover { color: #dce8ff; }

/* Start form */
.sc-start-form { padding: 20px 18px; }
.sc-start-form h6 { font-size: 14px; color: #dce8ff; font-weight: 600; margin-bottom: 4px; }
.sc-start-form p  { font-size: 12px; color: #7090b8; margin-bottom: 14px; }
.sc-start-form .form-control {
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(76,110,247,.2);
    border-radius: 9px;
    color: #dce8ff;
    font-size: 13px;
    padding: 10px 14px;
    margin-bottom: 10px;
}
.sc-start-form .form-control::placeholder { color: #4a6080; }
.sc-start-form .form-control:focus { border-color: #4c6ef7; outline: none; box-shadow: 0 0 0 3px rgba(76,110,247,.15); background: rgba(76,110,247,.06); color: #dce8ff; }

/* Messages area */
.sc-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px 14px 8px;
    min-height: 240px;
    max-height: 320px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scroll-behavior: smooth;
}
.sc-messages::-webkit-scrollbar { width: 4px; }
.sc-messages::-webkit-scrollbar-track { background: transparent; }
.sc-messages::-webkit-scrollbar-thumb { background: rgba(76,110,247,.2); border-radius: 4px; }

.sc-msg { display: flex; flex-direction: column; max-width: 82%; }
.sc-msg.visitor { align-self: flex-end; align-items: flex-end; }
.sc-msg.admin   { align-self: flex-start; align-items: flex-start; }
.sc-msg.system  { align-self: center; max-width: 100%; }

.sc-bubble {
    padding: 9px 13px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.45;
    word-break: break-word;
}
.sc-msg.visitor .sc-bubble {
    background: linear-gradient(135deg, #4c6ef7, #3a5cd1);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.sc-msg.admin .sc-bubble {
    background: rgba(255,255,255,.07);
    color: #dce8ff;
    border: 1px solid rgba(76,110,247,.12);
    border-bottom-left-radius: 4px;
}
.sc-msg.system .sc-bubble {
    background: rgba(0,212,180,.07);
    color: #00d4b4;
    border: 1px dashed rgba(0,212,180,.25);
    font-size: 12px;
    text-align: center;
    border-radius: 8px;
}
.sc-msg-meta { font-size: 10px; color: #4a6080; margin-top: 3px; padding: 0 3px; }

/* Input area */
.sc-input-area {
    padding: 10px 12px 14px;
    border-top: 1px solid rgba(76,110,247,.1);
    display: flex;
    gap: 8px;
    align-items: flex-end;
}
.sc-input {
    flex: 1;
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(76,110,247,.2);
    border-radius: 10px;
    color: #dce8ff;
    font-size: 13px;
    padding: 9px 12px;
    resize: none;
    max-height: 80px;
    line-height: 1.4;
    font-family: inherit;
}
.sc-input::placeholder { color: #4a6080; }
.sc-input:focus { border-color: #4c6ef7; outline: none; box-shadow: 0 0 0 3px rgba(76,110,247,.12); background: rgba(76,110,247,.05); color: #dce8ff; }
.sc-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, #4c6ef7, #00d4b4);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    transition: opacity .15s;
}
.sc-send-btn:hover { opacity: .85; }
.sc-send-btn:disabled { opacity: .4; cursor: not-allowed; }

/* Typing indicator */
.sc-typing { display: flex; gap: 4px; padding: 8px 0; align-items: center; }
.sc-typing span { width: 6px; height: 6px; background: #4c6ef7; border-radius: 50%; animation: scBounce .8s infinite; }
.sc-typing span:nth-child(2) { animation-delay: .15s; }
.sc-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes scBounce { 0%,80%,100% { transform: scale(.8); opacity:.5; } 40% { transform: scale(1.2); opacity:1; } }

@keyframes pulse { 0%,100% { opacity:.7; } 50% { opacity:1; } }

@media (max-width: 480px) {
    #supportChatBtn { bottom: 18px; right: 18px; width: 52px; height: 52px; font-size: 1.2rem; }
    #supportChatBox { bottom: 82px; right: 10px; left: 10px; width: auto; }
}
