* { box-sizing: border-box; }
body, html { margin: 0; padding: 0; height: 100%; font-family: 'Segoe UI', Roboto, sans-serif; background: #0f172a; color: #f1f5f9; overflow: hidden; }

.app { display: flex; height: 100%; width: 100%; }

/* SIDEBAR */
.sidebar { width: 280px; background: #1e293b; display: flex; flex-direction: column; border-right: 1px solid #334155; flex-shrink: 0; z-index: 100; }
.sidebar-header { padding: 20px; font-weight: 800; color: #94a3b8; letter-spacing: 1px; text-transform: uppercase; font-size: 13px; }
.contact-sep { padding: 5px 15px; font-size: 10px; color: #64748b; text-transform: uppercase; font-weight: bold; margin-top: 10px; }
.contact-list { overflow-y: auto; flex: 1; padding-bottom: 20px; }

.contact { display: flex; align-items: center; padding: 8px 15px; cursor: pointer; gap: 12px; transition: 0.2s; border-left: 3px solid transparent; }
.contact:hover { background: #334155; }
.contact.active { background: #334155; border-left-color: #3b82f6; }
.avatar { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 18px; background: #334155; flex-shrink: 0; }
.name { font-weight: 500; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar.group { background: linear-gradient(135deg, #3b82f6, #8b5cf6); }

/* CHAT AREA */
.chat-area { flex: 1; display: flex; flex-direction: column; background: #0f172a; position: relative; }
.chat-header { height: 60px; border-bottom: 1px solid #1e293b; display: flex; align-items: center; padding: 0 20px; justify-content: space-between; background: #1e293b; }
.header-info b { display: block; font-size: 15px; color: #f8fafc; }
.header-info span { font-size: 11px; color: #94a3b8; }

.messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 15px; }
.msg { display: flex; gap: 12px; max-width: 85%; }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }

.msg-avatar { width: 34px; height: 34px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 16px; cursor: pointer; flex-shrink: 0; }
.msg-content { display: flex; flex-direction: column; min-width: 0; }
.msg-name { font-size: 12px; margin-bottom: 4px; cursor: pointer; opacity: 0.8; color: #cbd5e1; font-weight: 600; }
.msg-bubble { background: #1e293b; padding: 10px 14px; border-radius: 12px; line-height: 1.5; font-size: 15px; color: #e2e8f0; white-space: pre-wrap; border: 1px solid #334155; }
.msg.user .msg-bubble { background: #2563eb; color: #fff; border-color: #2563eb; border-bottom-right-radius: 2px; }
.msg.bot .msg-bubble { border-top-left-radius: 2px; }
.msg.system { align-self: center; font-size: 12px; color: #64748b; background: #1e293b; padding: 5px 12px; border-radius: 20px; margin: 10px 0; }

.typing-indicator { height: 20px; padding: 0 20px 10px; font-size: 12px; color: #3b82f6; opacity: 0; transition: 0.2s; }
.typing-indicator.show { opacity: 1; }

.input-area { padding: 15px; background: #1e293b; display: flex; gap: 10px; align-items: flex-end; position: relative; border-top: 1px solid #334155; }
textarea { flex: 1; background: #0f172a; border: 1px solid #334155; border-radius: 8px; color: #fff; padding: 12px; resize: none; outline: none; min-height: 44px; max-height: 150px; }
#sendBtn { background: #3b82f6; border: none; width: 44px; height: 44px; border-radius: 8px; color: #fff; cursor: pointer; font-size: 18px; }
.emoji-btn { background: none; border: none; font-size: 20px; cursor: pointer; padding: 10px; color: #94a3b8; }

.emoji-picker { position: absolute; bottom: 70px; left: 10px; background: #1e293b; padding: 10px; border-radius: 8px; display: none; grid-template-columns: repeat(2, 1fr); gap: 5px; border: 1px solid #334155; box-shadow: 0 10px 25px rgba(0,0,0,0.5); }
.emoji-picker.show { display: grid; }
.emoji-picker span { font-size: 20px; cursor: pointer; padding: 5px; text-align: center; }
.emoji-picker span:hover { background: #334155; border-radius: 4px; }

.quote-panel { display: none; align-items: center; background: #1e293b; padding: 8px 12px; border-left: 3px solid #3b82f6; margin: 0 20px; border-radius: 4px; }
.quote-panel.show { display: flex; }
.quote-content { flex: 1; overflow: hidden; }
.quote-author { font-size: 11px; color: #3b82f6; font-weight: bold; }
.quote-text { font-size: 12px; color: #94a3b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quote-close { background: none; border: none; color: #64748b; cursor: pointer; }

@media (max-width: 768px) {
  .sidebar { position: absolute; left: -280px; top: 0; bottom: 0; transition: 0.3s; box-shadow: 10px 0 50px rgba(0,0,0,0.5); }
  .show-sidebar .sidebar { left: 0; }
  .mobile-menu-btn { display: block; border: none; background: none; color: #fff; font-size: 24px; padding: 0; }
}