:root {
  --bg: #0b1220;
  --panel: #0f172a;
  --sidebar: #0b1220;
  --panel-card: rgba(255, 255, 255, 0.035);
  --line: rgba(148, 163, 184, 0.12);
  --line-strong: rgba(56, 189, 248, 0.3);
  --text: #f8fafc;
  --muted: #64748b;
  --accent: #38bdf8;
  --danger: #ef4444;
  --success: #10b981;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  --chat-bg: #0b1220;
  --bubble-mine: #1e293b;
  --bubble-other: #1e293b;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, sans-serif;
  overflow: hidden;
}

.app-shell {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* Sidebar Styling */
.sidebar {
  width: 320px;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  font-weight: 700;
  font-size: 1.2rem;
}

.search-container {
  padding: 0 1rem 1rem;
}

.search-input-wrapper {
  position: relative;
  background: rgba(255,255,255,0.05);
  border-radius: 12px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-input-wrapper input {
  background: transparent;
  border: none;
  color: var(--text);
  width: 100%;
  outline: none;
  font-size: 0.9rem;
}

.conversation-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

.conv-item {
  padding: 12px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  gap: 12px;
  align-items: center;
  transition: background 0.2s;
}

.conv-item:hover {
  background: rgba(255,255,255,0.03);
}

.conv-item.active {
  background: rgba(56, 189, 248, 0.1);
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #334155;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  flex-shrink: 0;
}

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

.conv-name-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.conv-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.conv-time {
  font-size: 0.75rem;
  color: var(--muted);
}

.conv-last-msg {
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Chat Main View */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--chat-bg);
  position: relative;
}

.chat-header {
  height: 64px;
  border-bottom: 1px solid var(--line);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-indicator {
  font-size: 0.75rem;
  color: var(--success);
}

.header-actions {
  display: flex;
  gap: 1rem;
}

.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.message-row {
  display: flex;
  gap: 12px;
  max-width: 70%;
}

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

.message-bubble {
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 0.95rem;
  line-height: 1.5;
  position: relative;
}

.message-row.mine .message-bubble {
  background: #0ea5e9;
  border-bottom-right-radius: 4px;
}

.message-row.other .message-bubble {
  background: #1e293b;
  border-bottom-left-radius: 4px;
}

.message-time {
  font-size: 0.7rem;
  margin-top: 4px;
  opacity: 0.7;
  display: block;
  text-align: right;
}

.chat-input-area {
  padding: 1.5rem;
  background: var(--chat-bg);
}

.input-wrapper {
  background: #1e293b;
  border-radius: 16px;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.input-wrapper textarea {
  background: transparent;
  border: none;
  color: var(--text);
  flex: 1;
  resize: none;
  outline: none;
  padding: 8px 0;
  max-height: 100px;
}

.send-btn {
  background: #0ea5e9;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
}

/* Info Panel (Right Sidebar) */
.info-panel {
  width: 320px;
  background: var(--sidebar);
  border-left: 1px solid var(--line);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.info-card {
  background: rgba(255,255,255,0.03);
  border-radius: 16px;
  padding: 1.2rem;
  border: 1px solid var(--line);
}

.info-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}

/* Admin Dashboard Styling */
.admin-view {
  flex: 1;
  padding: 2rem;
  background: var(--bg);
  overflow-y: auto;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: #1e293b;
  padding: 1.5rem;
  border-radius: 20px;
  border: 1px solid var(--line);
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.stat-label {
  color: var(--muted);
  font-size: 0.85rem;
}

.admin-nav {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
}

.nav-item {
  padding: 10px 20px;
  border-radius: 12px;
  cursor: pointer;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  transition: all 0.2s;
}

.nav-item.active {
  background: rgba(56, 189, 248, 0.1);
  border-color: var(--accent);
}

.hidden { display: none !important; }

/* Admin Users Table */
.admin-table-container {
  background: #1e293b;
  border-radius: 20px;
  border: 1px solid var(--line);
  overflow: hidden;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th {
  text-align: left;
  padding: 1rem;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
}

.admin-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--line);
}

/* Buttons */
.btn-primary { background: #0ea5e9; color: white; border: none; padding: 10px 20px; border-radius: 10px; cursor: pointer; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--line); padding: 10px 20px; border-radius: 10px; cursor: pointer; }
.btn-danger { background: rgba(239, 68, 68, 0.1); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.2); padding: 8px 16px; border-radius: 10px; cursor: pointer; }

