/* === LIVE CHAT WIDGET === */
#sc-widget { position: fixed; bottom: 20px; right: 20px; z-index: 9999; font-family: inherit; }

/* Trigger button (floating) */
#sc-trigger {
    width: 60px; height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #22d3ee, #06b6d4);
    border: 0; cursor: pointer;
    box-shadow: 0 8px 24px rgba(34, 211, 238, 0.4);
    display: flex; align-items: center; justify-content: center;
    transition: transform .2s, box-shadow .2s;
    position: relative;
}
#sc-trigger:hover { transform: scale(1.08); box-shadow: 0 10px 30px rgba(34, 211, 238, 0.6); }
#sc-trigger svg { width: 28px; height: 28px; fill: #06212a; }
#sc-badge {
    position: absolute; top: -2px; right: -2px;
    min-width: 22px; height: 22px;
    background: #ef4444; color: #fff;
    border-radius: 11px; font-size: 11px; font-weight: 700;
    line-height: 22px; padding: 0 6px; text-align: center;
    box-shadow: 0 0 0 3px #0a1020;
    display: none;
}
#sc-badge.show { display: block; }

/* Chat box (when open) */
#sc-box {
    display: none;
    position: absolute; bottom: 80px; right: 0;
    width: 360px; max-width: calc(100vw - 40px);
    height: 540px; max-height: calc(100vh - 120px);
    background: #0f1830;
    border: 1px solid rgba(34, 211, 238, 0.2);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    flex-direction: column;
    overflow: hidden;
    animation: sc-pop .25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes sc-pop {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
#sc-widget.open #sc-box { display: flex; }

/* Header */
#sc-head {
    background: linear-gradient(135deg, #22d3ee, #0e7490);
    padding: 16px;
    color: #fff;
    flex-shrink: 0;
}
#sc-head h3 { margin: 0; font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
#sc-head .sc-status {
    display: inline-block; width: 8px; height: 8px;
    background: #10b981; border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(16,185,129,0.3);
}
#sc-head p { margin: 4px 0 0; font-size: 12px; opacity: 0.85; }
#sc-close {
    position: absolute; top: 14px; right: 12px;
    background: transparent; border: 0; color: #fff;
    cursor: pointer; font-size: 22px; line-height: 1;
    width: 30px; height: 30px; border-radius: 50%;
    transition: background .15s;
}
#sc-close:hover { background: rgba(255,255,255,0.15); }

/* Messages area */
#sc-messages {
    flex: 1; overflow-y: auto;
    padding: 14px;
    display: flex; flex-direction: column;
    gap: 8px;
    background: #0a1020;
}
#sc-messages::-webkit-scrollbar { width: 6px; }
#sc-messages::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }
.sc-msg {
    max-width: 80%;
    padding: 8px 12px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.4;
    word-wrap: break-word;
    animation: sc-msg-in .2s ease;
}
@keyframes sc-msg-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.sc-msg.user, .sc-msg.guest {
    align-self: flex-end;
    background: linear-gradient(135deg, #22d3ee, #06b6d4);
    color: #06212a;
    border-bottom-right-radius: 4px;
}
.sc-msg.admin {
    align-self: flex-start;
    background: #1e293b;
    color: #e2e8f0;
    border: 1px solid #334155;
    border-bottom-left-radius: 4px;
}
.sc-msg.system {
    align-self: center;
    background: transparent;
    color: #64748b;
    font-size: 11px;
    font-style: italic;
    max-width: 100%;
    text-align: center;
    padding: 4px 8px;
}
.sc-msg .sc-time {
    display: block;
    font-size: 9px;
    opacity: 0.7;
    margin-top: 4px;
}

/* Input area */
#sc-input-area {
    padding: 12px;
    background: #0f1830;
    border-top: 1px solid rgba(255,255,255,0.06);
    display: flex; gap: 8px;
    flex-shrink: 0;
}
#sc-input {
    flex: 1;
    background: #0a1020;
    border: 1px solid #334155;
    color: #e2e8f0;
    border-radius: 20px;
    padding: 10px 14px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color .15s;
}
#sc-input:focus { border-color: #22d3ee; }
#sc-send {
    background: linear-gradient(135deg, #22d3ee, #06b6d4);
    border: 0;
    color: #06212a;
    width: 40px; height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: transform .12s;
}
#sc-send:hover { transform: scale(1.1); }
#sc-send svg { width: 18px; height: 18px; fill: currentColor; }

/* Guest form (when not logged in) */
#sc-guest-form {
    padding: 14px;
    display: none;
    flex-direction: column;
    gap: 10px;
}
#sc-widget.guest:not(.has-chat) #sc-guest-form { display: flex; }
#sc-widget.guest:not(.has-chat) #sc-messages,
#sc-widget.guest:not(.has-chat) #sc-input-area { display: none; }
#sc-guest-form input, #sc-guest-form textarea {
    background: #0a1020;
    border: 1px solid #334155;
    color: #e2e8f0;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
}
#sc-guest-form button {
    background: linear-gradient(135deg, #22d3ee, #06b6d4);
    color: #06212a;
    border: 0;
    padding: 10px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
}

/* Typing indicator */
.sc-typing {
    align-self: flex-start;
    color: #64748b;
    font-size: 11px;
    padding: 4px 12px;
    font-style: italic;
}
.sc-typing::after {
    content: '...';
    animation: sc-dots 1.4s infinite;
}
@keyframes sc-dots {
    0%, 60%, 100% { content: ''; }
    20% { content: '.'; }
    40% { content: '..'; }
}
