/* ==========================================================================
   KOTHA REAL-TIME CHAT CLIENT - STYLESHEET
   Aesthetics: Deep Obsidian Theme with Sendbird-Inspired Messaging Cards
   ========================================================================== */

:root {
  --bg-primary: #0b0e14;
  --bg-secondary: #121722;
  --bg-chat-bubble-me: #6210cc;
  --bg-chat-bubble-other: #1c2333;
  --border-color: rgba(255, 255, 255, 0.08);

  --accent-purple: #6210cc;
  --accent-purple-light: #742ddd;
  
  --text-primary: #f0f3f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --font-main: 'Inter', sans-serif;
  --font-heading: 'Outfit', sans-serif;
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-main);
  height: 100vh;
  overflow: hidden;
}

.chat-app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* TOP HEADER NAVBAR */
.chat-header {
  height: 60px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

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

.brand-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-purple-light));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
}

.brand-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.5px;
}

.brand-tag {
  font-size: 9px;
  font-weight: 700;
  color: var(--accent-purple-light);
  background: rgba(116, 45, 221, 0.15);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 8px;
}

.user-switcher-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.3);
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  font-size: 13px;
}

.user-switcher-bar select {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

.user-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.btn-inspector-link {
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-purple-light));
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 15px rgba(116, 45, 221, 0.3);
  transition: transform 0.2s;
}

.btn-inspector-link:hover {
  transform: translateY(-1px);
}

/* CHAT BODY LAYOUT */
.chat-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* SIDEBAR */
.chat-sidebar {
  width: 280px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 16px 20px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
}

.channel-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.channel-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

.channel-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.channel-item.active {
  background: rgba(116, 45, 221, 0.2);
  border-left: 3px solid var(--accent-purple-light);
}

.channel-info {
  display: flex;
  flex-direction: column;
}

.channel-name {
  font-weight: 600;
  font-size: 13px;
}

.channel-preview {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.2);
}

.monitor-tip {
  font-size: 11px;
  color: var(--text-secondary);
  display: flex;
  gap: 8px;
  line-height: 1.4;
}

.monitor-tip i {
  color: #fbbf24;
  font-size: 14px;
}

/* MAIN CHAT WINDOW */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
}

.main-header {
  padding: 14px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(18, 23, 34, 0.6);
}

.active-channel-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.active-channel-info h2 {
  font-family: var(--font-heading);
  font-size: 18px;
}

.channel-badge {
  background: rgba(255, 255, 255, 0.08);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  color: var(--text-secondary);
}

.call-controls {
  display: flex;
  gap: 10px;
}

.btn-call {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-call:hover {
  background: rgba(116, 45, 221, 0.2);
  border-color: var(--accent-purple-light);
}

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

.system-notice {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: 20px;
  align-self: center;
  display: flex;
  align-items: center;
  gap: 6px;
}

.msg-row {
  display: flex;
  gap: 12px;
  max-width: 75%;
}

.msg-row.me {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-purple);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

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

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

.msg-sender {
  font-weight: 700;
  color: var(--text-primary);
}

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

.msg-bubble {
  background: var(--bg-chat-bubble-other);
  border: 1px solid var(--border-color);
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.4;
  word-break: break-word;
}

.msg-row.me .msg-bubble {
  background: var(--bg-chat-bubble-me);
  border-color: var(--accent-purple-light);
}

.msg-reactions {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

.reaction-pill {
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 12px;
  font-size: 11px;
  cursor: pointer;
}

/* TYPING INDICATOR */
.typing-indicator {
  padding: 6px 24px;
  font-size: 11px;
  color: var(--accent-purple-light);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* INPUT FORM */
.input-area {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.input-quick-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.btn-emoji, .btn-attachment {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 4px;
  border-radius: 4px;
  color: var(--text-secondary);
  transition: background 0.15s;
}

.btn-emoji:hover, .btn-attachment:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.quick-sep {
  width: 1px;
  height: 14px;
  background: var(--border-color);
  margin: 0 4px;
}

#messageForm {
  display: flex;
  gap: 12px;
}

#messageInput {
  flex: 1;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 16px;
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 13px;
  outline: none;
}

#messageInput:focus {
  border-color: var(--accent-purple-light);
}

.btn-send {
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-purple-light));
  color: #fff;
  border: none;
  padding: 0 20px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* CALL MODAL */
.call-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.call-card {
  padding: 32px;
  text-align: center;
  max-width: 380px;
  width: 100%;
}

.call-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent-purple);
  margin: 0 auto 16px auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.call-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 24px;
}

.hidden { display: none !important; }
