:root {
    --bg-gradient: linear-gradient(135deg, #0f0c20 0%, #15102a 50%, #06020f 100%);
    --panel-bg: rgba(22, 18, 45, 0.45);
    --panel-border: rgba(255, 255, 255, 0.08);
    --accent-color: #5865F2;
    --accent-hover: #4752C4;
    --text-primary: #FFFFFF;
    --text-secondary: #9B98B0;
    --text-muted: #64617A;
    --msg-incoming: rgba(255, 255, 255, 0.06);
    --msg-outgoing: rgba(88, 101, 242, 0.25);
    --msg-outgoing-border: rgba(88, 101, 242, 0.4);
    --success-color: #2ECC71;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-gradient);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.app-container {
    width: 95vw;
    height: 90vh;
    max-width: 1400px;
    max-height: 900px;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    display: flex;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

/* Sidebar styling */
.sidebar {
    width: 320px;
    border-right: 1px solid var(--panel-border);
    display: flex;
    flex-direction: column;
    background: rgba(10, 8, 20, 0.4);
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--panel-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    font-size: 24px;
}

.logo-text {
    font-weight: 700;
    font-size: 18px;
    letter-spacing: 0.5px;
    background: linear-gradient(90deg, #FFFFFF, #B9BBFF);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.status {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(46, 204, 113, 0.1);
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid rgba(46, 204, 113, 0.2);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.online {
    background: var(--success-color);
    box-shadow: 0 0 10px var(--success-color);
}

.status-text {
    font-size: 11px;
    font-weight: 600;
    color: var(--success-color);
}

.tab-switcher {
    display: flex;
    flex-wrap: wrap;
    padding: 12px 16px;
    gap: 8px;
}

.tab-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    padding: 10px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.3s ease;
}

.tab-btn.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: var(--text-primary);
    box-shadow: 0 4px 15px rgba(88, 101, 242, 0.3);
}

.tab-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.07);
    color: var(--text-primary);
}

.search-box {
    padding: 0 16px 12px 16px;
    display: flex;
    gap: 8px;
}

.search-box input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    outline: none;
    transition: all 0.3s ease;
}

.search-box input:focus {
    border-color: var(--accent-color);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 10px rgba(88, 101, 242, 0.15);
}

.search-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    padding: 0 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-btn:hover {
    background: var(--accent-color);
    border-color: var(--accent-color);
    box-shadow: 0 4px 10px rgba(88, 101, 242, 0.2);
}

.chat-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 16px 20px 16px;
}

/* Scrollbar customization */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

.chat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
    margin-bottom: 8px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.chat-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.chat-item.active {
    background: rgba(88, 101, 242, 0.12);
    border-color: rgba(88, 101, 242, 0.25);
}

.chat-item-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 18px;
    flex-shrink: 0;
}

.chat-item-info {
    flex: 1;
    min-width: 0;
}

.chat-item-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-item-sub {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

/* Chat area styling */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(5, 4, 10, 0.25);
}

.chat-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--panel-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(10, 8, 20, 0.2);
}

#active-chat-name {
    font-size: 18px;
    font-weight: 700;
}

#active-chat-sub {
    font-size: 13px;
    color: var(--text-secondary);
    display: block;
    margin-top: 4px;
}

.action-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-placeholder {
    margin: auto;
    text-align: center;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.placeholder-icon {
    font-size: 60px;
    opacity: 0.6;
    animation: float 4s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.chat-placeholder h3 {
    font-size: 20px;
    font-weight: 700;
}

.chat-placeholder p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Message items */
.message {
    display: flex;
    gap: 12px;
    max-width: 75%;
}

.message.incoming {
    align-self: flex-start;
}

.message.outgoing {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.msg-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 15px;
    flex-shrink: 0;
}

.msg-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.msg-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
}

.msg-author {
    font-weight: 600;
    color: var(--text-primary);
}

.msg-time {
    color: var(--text-muted);
}

.msg-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}

.message.incoming .msg-bubble {
    background: var(--msg-incoming);
    border: 1px solid var(--panel-border);
    border-top-left-radius: 4px;
}

.message.outgoing .msg-bubble {
    background: var(--msg-outgoing);
    border: 1px solid var(--msg-outgoing-border);
    border-top-right-radius: 4px;
    color: #FFFFFF;
}

/* Input area styling */
.chat-input-area {
    padding: 20px 24px;
    border-top: 1px solid var(--panel-border);
    display: flex;
    gap: 12px;
    background: rgba(10, 8, 20, 0.2);
}

.chat-input-area textarea {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 14px;
    outline: none;
    resize: none;
    height: 48px;
    font-family: inherit;
    transition: all 0.3s ease;
}

.chat-input-area textarea:focus:not(:disabled) {
    border-color: var(--accent-color);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 15px rgba(88, 101, 242, 0.15);
}

.chat-input-area textarea:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.send-btn {
    background: var(--accent-color);
    border: none;
    color: var(--text-primary);
    padding: 0 24px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.send-btn:hover:not(:disabled) {
    background: var(--accent-hover);
    box-shadow: 0 5px 15px rgba(88, 101, 242, 0.4);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--text-muted);
}

.send-icon {
    font-size: 16px;
}

.loading {
    text-align: center;
    color: var(--text-secondary);
    padding: 20px;
    font-size: 14px;
}

/* Stats Dashboard Layout */
.stats-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    width: 100%;
    height: 100%;
}

.stats-card {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
}

.stats-card-header {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: linear-gradient(90deg, #FFFFFF, var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stats-card-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stats-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.01);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.01);
    transition: all 0.2s ease;
}

.stats-list-item:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.04);
}

.stats-item-rank {
    font-size: 16px;
    width: 24px;
    display: flex;
    justify-content: center;
    font-weight: 700;
}

.rank-number {
    font-size: 11px;
    color: var(--text-muted);
}

.stats-item-info {
    flex: 1;
    min-width: 0;
}

.stats-item-name {
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.stats-item-sub {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
}

.stats-item-value {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-color);
    background: rgba(88, 101, 242, 0.08);
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid rgba(88, 101, 242, 0.12);
}

.stats-empty-list {
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    padding: 20px 0;
}

/* Music Button */
.music-btn {
    background: rgba(46, 204, 113, 0.1);
    border: 1px solid rgba(46, 204, 113, 0.2);
    color: #2ECC71;
    padding: 0 16px;
    height: 38px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.music-btn:hover {
    background: rgba(46, 204, 113, 0.2);
    box-shadow: 0 0 15px rgba(46, 204, 113, 0.15);
}

.music-btn.muted {
    background: rgba(231, 76, 60, 0.1);
    border-color: rgba(231, 76, 60, 0.2);
    color: #E74C3C;
}

.music-btn.muted:hover {
    background: rgba(231, 76, 60, 0.2);
    box-shadow: 0 0 15px rgba(231, 76, 60, 0.15);
}
body.auth-pending .app-container { filter: blur(4px); }
.auth-overlay { position:fixed; inset:0; z-index:10000; display:flex; align-items:center; justify-content:center; padding:20px; background:rgba(8,10,16,.92); }
.auth-overlay.hidden { display:none; }
.auth-card { position:relative; width:min(420px,100%); max-height:90vh; overflow:auto; padding:32px; border:1px solid rgba(255,255,255,.12); border-radius:16px; background:#181b22; color:#fff; box-shadow:0 24px 80px rgba(0,0,0,.5); }
.auth-card h1,.auth-card h2,.auth-card h3 { margin:0 0 14px; }
.auth-card p { color:#aeb5c2; }
.auth-logo { font-size:42px; margin-bottom:12px; }
.auth-card input { box-sizing:border-box; width:100%; margin:7px 0; padding:12px; border:1px solid #3a4050; border-radius:8px; background:#222630; color:#fff; }
.auth-card button { width:100%; margin-top:10px; padding:12px; border:0; border-radius:8px; background:#5865f2; color:#fff; cursor:pointer; font-weight:600; }
.auth-error { min-height:20px; margin-top:8px; color:#ff6b6b; }
.auth-message { margin-top:12px; color:#8ee6a4; }
.account-card { width:min(560px,100%); }
.account-card form { padding-top:18px; margin-top:18px; border-top:1px solid rgba(255,255,255,.1); }
.modal-close { position:absolute; top:10px; right:14px; width:auto!important; margin:0!important; padding:5px 10px!important; background:transparent!important; font-size:25px; }
.account-row { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:10px 0; border-bottom:1px solid rgba(255,255,255,.08); }
.account-row button { width:auto; margin:0; padding:7px 10px; background:#d74646; }
