/* Premium Luxury Minimalist Admin Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-bg: #ffffff;
  --secondary-bg: #f9f9f9;
  --border-color: #e5e5ea;
  --text-primary: #1d1d1f;
  --text-secondary: #86868b;
  --accent-color: #000000;
  --bubble-me-bg: #000000;
  --bubble-me-text: #ffffff;
  --bubble-other-bg: #f2f2f7;
  --bubble-other-text: #1d1d1f;
  --sidebar-width: 320px;
  --font-main: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

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

.container {
  display: flex;
  height: 100vh;
  max-width: 100%;
  margin: 0 auto;
  background: var(--primary-bg);
}

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

.sidebar-header {
  padding: 24px;
  background: var(--secondary-bg);
  /* border-bottom: 1px solid rgba(0,0,0,0.03); */
}

.sidebar-header h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.sidebar-header p {
  font-size: 13px;
  color: var(--text-secondary);
}

.search-box {
  padding: 0 24px 16px;
}

.search-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 14px;
  background: #e5e5ea;
  transition: all 0.2s;
  color: var(--text-primary);
}

.search-input:focus {
  outline: none;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.customer-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
}

.customer-item {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.2s;
  border-radius: 12px;
  margin-bottom: 4px;
}

.customer-item:hover {
  background-color: rgba(0,0,0,0.03);
}

.customer-item.active {
  background-color: #ffffff;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}

.customer-avatar {
  position: relative;
  margin-right: 14px;
}

.avatar-img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  background: #e0e0e0;
}

.status-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #ffffff;
}

.status-dot.online { background: #34c759; }
.status-dot.away { background: #ffcc00; }
.status-dot.offline { background: #c7c7cc; }

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

.customer-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.customer-message {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.customer-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.message-time {
  font-size: 11px;
  color: #c7c7cc;
}

.unread-badge {
  background: var(--accent-color);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

/* Chat Area */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--primary-bg);
}

.chat-header {
  padding: 16px 32px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-customer-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.chat-customer-details h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.chat-customer-details p {
  font-size: 12px;
  color: var(--text-secondary);
}

.chat-actions {
  display: flex;
  gap: 8px;
}

.action-btn {
  padding: 8px 16px;
  border: 1px solid var(--border-color);
  background: white;
  border-radius: 16px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-primary);
  transition: all 0.2s;
  font-weight: 500;
}

.action-btn:hover {
  background: #f5f5f7;
  border-color: #d1d1d6;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: #ffffff;
}

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

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

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

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.message-bubble {
  padding: 12px 18px;
  border-radius: 20px;
  font-size: 15px;
  line-height: 1.5;
  position: relative;
  word-wrap: break-word;
}

/* Admin View: Customer is 'other' (Left, White), Agent is 'me' (Right, Black) */
.message.customer .message-bubble {
  background: var(--bubble-other-bg);
  color: var(--bubble-other-text);
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  border: 1px solid #f0f0f0;
}

.message.agent .message-bubble {
  background: var(--bubble-me-bg);
  color: var(--bubble-me-text);
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.message-timestamp {
  font-size: 11px;
  color: #d1d1d6;
  margin-top: 6px;
  padding: 0 4px;
}

.chat-input-area {
  padding: 24px 32px 32px;
  background: white;
  border-top: 1px solid var(--border-color);
}

.input-container {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.message-input {
  flex: 1;
  padding: 14px 18px;
  border: 1px solid var(--border-color);
  border-radius: 24px;
  font-size: 15px;
  font-family: inherit;
  resize: none;
  min-height: 48px;
  max-height: 120px;
  background: #fbfbfb;
  transition: all 0.2s;
}

.message-input:focus {
  outline: none;
  background: #ffffff;
  border-color: #d1d1d6;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.send-btn {
  padding: 0 24px;
  height: 48px;
  background: var(--accent-color);
  color: white;
  border: none;
  border-radius: 24px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s;
}

.send-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.send-btn:active {
  transform: translateY(0);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #e5e5ea; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #d1d1d6; }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { width: 100%; position: absolute; height: 100%; z-index: 10; }
  .sidebar.hidden { display: none; }
  .chat-area { width: 100%; }
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-secondary);
}
.empty-state-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.1; }
.empty-state h3 { font-size: 18px; font-weight: 600; margin-bottom: 8px; color: var(--text-primary); }
