@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600&display=swap');

:root {
    --wsc-bg:        #0d1117;
    --wsc-surface:   #161b22;
    --wsc-surface2:  #21262d;
    --wsc-border:    #30363d;
    --wsc-accent:    #238636;
    --wsc-accent-h:  #2ea043;
    --wsc-blue:      #1f6feb;
    --wsc-text:      #c9d1d9;
    --wsc-muted:     #8b949e;
    --wsc-me-bg:     #1f6feb;
    --wsc-them-bg:   #21262d;
    --wsc-radius:    14px;
    --wsc-font:      'DM Sans', system-ui, sans-serif;
}

*,*::before,*::after { box-sizing:border-box; margin:0; padding:0; }

.wsc-wrap {
    font-family: var(--wsc-font);
    max-width: 680px;
    margin: 24px auto;
    border-radius: var(--wsc-radius);
    overflow: hidden;
    box-shadow: 0 16px 48px rgba(0,0,0,.6);
    border: 1px solid var(--wsc-border);
    background: var(--wsc-bg);
    color: var(--wsc-text);
}

/* ── Auth ─────────────────────────────────────────────────── */
.wsc-auth-panel {
    padding: 32px 36px 36px;
    min-height: 360px;
}
.wsc-auth-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 28px;
    background: var(--wsc-surface2);
    border-radius: 8px;
    padding: 4px;
}
.wsc-auth-tab {
    flex: 1;
    padding: 9px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--wsc-muted);
    font-family: var(--wsc-font);
    font-size: .875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all .2s;
}
.wsc-auth-tab.active {
    background: var(--wsc-surface);
    color: var(--wsc-text);
    box-shadow: 0 1px 4px rgba(0,0,0,.4);
}
.wsc-auth-form h3 { font-size: 1.1rem; font-weight:600; margin-bottom:6px; }
.wsc-auth-form p  { font-size:.85rem; color:var(--wsc-muted); margin-bottom:18px; }
.wsc-auth-form input {
    display: block;
    width: 100%;
    background: var(--wsc-surface2);
    border: 1px solid var(--wsc-border);
    color: var(--wsc-text);
    border-radius: 8px;
    padding: 11px 14px;
    font-size: .875rem;
    font-family: var(--wsc-font);
    outline: none;
    margin-bottom: 10px;
    transition: border-color .2s;
}
.wsc-auth-form input:focus { border-color: var(--wsc-blue); }
.wsc-btn-primary {
    display: block;
    width: 100%;
    padding: 12px;
    background: var(--wsc-accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: .9rem;
    font-weight: 600;
    font-family: var(--wsc-font);
    cursor: pointer;
    margin-top: 4px;
    transition: background .2s;
}
.wsc-btn-primary:hover { background: var(--wsc-accent-h); }
.wsc-msg {
    font-size: .8rem;
    margin-top: 10px;
    min-height: 1.2em;
    text-align: center;
}
.wsc-msg.error   { color: #f85149; }
.wsc-msg.success { color: #3fb950; }
.wsc-msg.info    { color: #58a6ff; }

/* ── Chat ─────────────────────────────────────────────────── */
.wsc-chat { display: flex; flex-direction: column; height: 560px; }

.wsc-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--wsc-surface);
    border-bottom: 1px solid var(--wsc-border);
    padding: 14px 20px;
    flex-shrink: 0;
}
.wsc-chat-header-left { display:flex; align-items:center; gap:12px; }
.wsc-support-avatar {
    width:38px; height:38px; border-radius:50%;
    background: var(--wsc-blue);
    display:flex; align-items:center; justify-content:center;
    font-size:1.1rem;
}
.wsc-chat-header-left strong { font-size:.95rem; font-weight:600; display:block; }
.wsc-online { font-size:.72rem; color:#3fb950; }
.wsc-chat-header-right { display:flex; align-items:center; gap:10px; }
.wsc-username-label { font-size:.8rem; color:var(--wsc-muted); }
.wsc-logout-btn {
    font-size:.75rem; padding:5px 12px;
    background:transparent; border:1px solid var(--wsc-border);
    color:var(--wsc-muted); border-radius:20px; cursor:pointer;
    transition:all .2s; font-family:var(--wsc-font);
}
.wsc-logout-btn:hover { border-color:#f85149; color:#f85149; }

.wsc-messages {
    flex:1; overflow-y:auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
}
.wsc-messages::-webkit-scrollbar { width:4px; }
.wsc-messages::-webkit-scrollbar-thumb { background:var(--wsc-border); border-radius:4px; }

.wsc-load-more-wrap { text-align:center; margin-bottom:12px; }
.wsc-load-more-wrap button {
    background:transparent; border:1px solid var(--wsc-border);
    color:var(--wsc-muted); padding:5px 16px; border-radius:20px;
    font-size:.75rem; cursor:pointer; font-family:var(--wsc-font);
    transition:all .2s;
}
.wsc-load-more-wrap button:hover { border-color:var(--wsc-blue); color:#58a6ff; }

.wsc-msg-list { display:flex; flex-direction:column; gap:6px; flex:1; justify-content:flex-end; }

.wsc-bubble-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    animation: wsc-in .2s ease;
    max-width: 80%;
}
@keyframes wsc-in { from{opacity:0;transform:translateY(5px)} to{opacity:1;transform:none} }

.wsc-bubble-row.from-me  { align-self:flex-end;   flex-direction:row-reverse; }
.wsc-bubble-row.from-them{ align-self:flex-start; }

.wsc-bubble-avatar {
    width:28px; height:28px; border-radius:50%;
    background:var(--wsc-surface2); border:1px solid var(--wsc-border);
    display:flex; align-items:center; justify-content:center;
    font-size:.75rem; flex-shrink:0;
}
.wsc-bubble-row.from-me .wsc-bubble-avatar { display:none; }

.wsc-bubble-inner { display:flex; flex-direction:column; gap:2px; }
.wsc-bubble-row.from-me   .wsc-bubble-inner { align-items:flex-end; }
.wsc-bubble-row.from-them .wsc-bubble-inner { align-items:flex-start; }

.wsc-bubble {
    padding: 10px 15px;
    border-radius: 18px;
    font-size: .875rem;
    line-height: 1.5;
    word-break: break-word;
    white-space: pre-wrap;
}
.wsc-bubble-row.from-me   .wsc-bubble { background:var(--wsc-me-bg);   color:#fff; border-bottom-right-radius:4px; }
.wsc-bubble-row.from-them .wsc-bubble { background:var(--wsc-them-bg); color:var(--wsc-text); border:1px solid var(--wsc-border); border-bottom-left-radius:4px; }

.wsc-bubble-time { font-size:.65rem; color:var(--wsc-muted); padding:0 4px; }

.wsc-empty-chat {
    flex:1; display:flex; flex-direction:column; align-items:center;
    justify-content:center; gap:8px; color:var(--wsc-muted);
    text-align:center; padding:30px 0;
}
.wsc-empty-chat .wsc-empty-icon { font-size:2.8rem; opacity:.4; }
.wsc-empty-chat p { font-size:.85rem; }

.wsc-chat-footer {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 12px 16px;
    background: var(--wsc-surface);
    border-top: 1px solid var(--wsc-border);
    flex-shrink: 0;
}
.wsc-textarea {
    flex: 1;
    background: var(--wsc-surface2);
    border: 1px solid var(--wsc-border);
    color: var(--wsc-text);
    border-radius: 12px;
    padding: 10px 14px;
    font-size: .875rem;
    font-family: var(--wsc-font);
    resize: none;
    outline: none;
    max-height: 120px;
    overflow-y: auto;
    transition: border-color .2s;
    line-height: 1.5;
}
.wsc-textarea:focus { border-color:var(--wsc-blue); }
.wsc-textarea::placeholder { color:var(--wsc-muted); }

.wsc-send-btn {
    width:42px; height:42px; border-radius:50%;
    background:var(--wsc-blue); border:none; color:#fff;
    cursor:pointer; display:flex; align-items:center; justify-content:center;
    flex-shrink:0; transition:transform .15s, opacity .15s;
}
.wsc-send-btn:hover  { opacity:.85; }
.wsc-send-btn:active { transform:scale(.92); }

@media(max-width:540px) {
    .wsc-wrap       { border-radius:0; margin:0; }
    .wsc-chat       { height:100svh; }
    .wsc-auth-panel { padding:24px 20px; }
}
