* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f1f5f9;
  overflow-x: hidden;
  color: #0f172a;
}

/* Sidebar */
.sidebar {
  width: 280px;
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
  border-right: 1px solid rgba(255,255,255,0.05);
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.05);
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 4px;
}

.sidebar-header {
  padding: 32px 24px;
  text-align: center;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-header .logo {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.sidebar-header h2 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.5px;
}

.sidebar-subtitle {
  font-size: 12px;
  opacity: 0.5;
  margin-top: 4px;
}

.nav {
  flex: 1;
  padding: 24px 16px;
}

.nav-btn {
  width: 100%;
  padding: 12px 16px;
  margin-bottom: 8px;
  background: transparent;
  border: none;
  border-radius: 12px;
  color: rgba(255,255,255,0.7);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.nav-icon {
  font-size: 20px;
  width: 24px;
}

.nav-text {
  flex: 1;
}

.nav-btn:hover {
  background: rgba(255,255,255,0.08);
  color: white;
}

.nav-btn.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(102,126,234,0.3);
}

.badge {
  background: rgba(255,255,255,0.2);
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge.danger {
  background: #ef4444;
}

.sidebar-footer {
  padding: 20px 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.admin-info {
  margin-bottom: 12px;
  padding: 12px;
  background: rgba(255,255,255,0.05);
  border-radius: 12px;
  font-size: 13px;
  text-align: center;
}

.logout-btn {
  width: 100%;
  padding: 10px;
  background: rgba(255,255,255,0.05);
  border: none;
  border-radius: 10px;
  color: white;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
}

.logout-btn:hover {
  background: rgba(239,68,68,0.2);
  color: #fca5a5;
}

/* Menu toggle */
.menu-toggle {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  width: 44px;
  height: 44px;
  background: #0f172a;
  color: white;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  z-index: 1001;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  align-items: center;
  justify-content: center;
}

/* Main content */
.main-content {
  flex: 1;
  margin-left: 280px;
  padding: 32px;
  min-height: 100vh;
}

.page-header {
  margin-bottom: 32px;
}

.page-header h1 {
  font-size: 28px;
  font-weight: 700;
  background: linear-gradient(135deg, #0f172a 0%, #334155 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-header p {
  color: #64748b;
  font-size: 14px;
  margin-top: 4px;
}

.page {
  display: none;
  animation: fadeIn 0.4s ease;
}

.page.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
}

.stat-card {
  background: white;
  border-radius: 24px;
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  transition: all 0.3s ease;
  border: 1px solid rgba(0,0,0,0.05);
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 25px -12px rgba(0,0,0,0.1);
}

.stat-icon {
  font-size: 48px;
}

.stat-info h3 {
  font-size: 32px;
  font-weight: 700;
  color: #0f172a;
}

.stat-info p {
  color: #64748b;
  font-size: 14px;
  margin-top: 4px;
}

/* Chats container */
.chats-container {
  display: flex;
  gap: 24px;
  height: calc(100vh - 140px);
  background: white;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  border: 1px solid rgba(0,0,0,0.05);
}

.chats-list {
  width: 340px;
  border-right: 1px solid #e2e8f0;
  overflow-y: auto;
  background: #fafcff;
}

.chat-item {
  padding: 16px 20px;
  border-bottom: 1px solid #f0f2f5;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chat-item:hover {
  background: #f8fafc;
}

.chat-item.active {
  background: linear-gradient(135deg, #667eea08 0%, #764ba208 100%);
  border-left: 3px solid #667eea;
}

.chat-item-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.chat-item-header h4 {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
}

.chat-time {
  font-size: 11px;
  color: #94a3b8;
}

.chat-preview {
  font-size: 13px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-preview-sender {
  font-weight: 500;
  color: #667eea;
}

/* Chat messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
}

.message {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
}

.message.incoming {
  align-items: flex-start;
}

.message.outgoing {
  align-items: flex-end;
}

.message-sender {
  font-size: 11px;
  color: #94a3b8;
  margin-bottom: 4px;
  padding: 0 12px;
}

.message-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  max-width: 100%;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.message.incoming .message-bubble {
  background: white;
  color: #1e293b;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  border: 1px solid #e2e8f0;
}

.message.outgoing .message-bubble {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.message-meta {
  font-size: 10px;
  color: #94a3b8;
  margin-top: 4px;
  padding: 0 12px;
}

.empty-chat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #94a3b8;
  text-align: center;
}

.empty-chat-icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-chat p {
  font-size: 16px;
  margin-bottom: 4px;
}

.empty-chat span {
  font-size: 13px;
}

/* Loading spinner */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px;
  color: #94a3b8;
  gap: 12px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e2e8f0;
  border-top-color: #667eea;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Users table */
.users-table-container {
  background: white;
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  border: 1px solid rgba(0,0,0,0.05);
}

.search-wrapper {
  position: relative;
  margin-bottom: 24px;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
}

.search-input {
  width: 100%;
  padding: 14px 16px 14px 48px;
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  font-size: 14px;
  transition: all 0.2s;
}

.search-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
}

.users-list {
  overflow-x: auto;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
}

.users-table th,
.users-table td {
  padding: 14px 12px;
  text-align: left;
  border-bottom: 1px solid #f0f2f5;
}

.users-table th {
  background: #f8fafc;
  font-weight: 600;
  color: #475569;
  font-size: 13px;
}

.user-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.user-status.active {
  background: #dcfce7;
  color: #166534;
}

.user-status.blocked {
  background: #fee2e2;
  color: #991b1b;
}

.block-btn, .unblock-btn {
  padding: 6px 14px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.2s;
}

.block-btn {
  background: #fee2e2;
  color: #dc2626;
}

.block-btn:hover {
  background: #fecaca;
}

.unblock-btn {
  background: #dcfce7;
  color: #16a34a;
}

.unblock-btn:hover {
  background: #bbf7d0;
}

/* Reports */
.reports-list {
  background: white;
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  border: 1px solid rgba(0,0,0,0.05);
}

.report-card {
  border: 1px solid #f0f2f5;
  border-radius: 20px;
  padding: 20px;
  margin-bottom: 16px;
  transition: all 0.2s;
}

.report-card:hover {
  border-color: #e2e8f0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.report-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.report-reason {
  background: #fee2e2;
  color: #dc2626;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.resolve-btn {
  background: #dcfce7;
  color: #16a34a;
  padding: 6px 14px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.2s;
}

.resolve-btn:hover {
  background: #bbf7d0;
}

/* Admins */
.add-admin {
  background: white;
  border-radius: 24px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  border: 1px solid rgba(0,0,0,0.05);
}

.add-admin h3 {
  font-size: 18px;
  margin-bottom: 16px;
}

.add-admin-form {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.add-admin-form input,
.add-admin-form select {
  flex: 1;
  min-width: 150px;
  padding: 12px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 14px;
  transition: all 0.2s;
}

.add-admin-form input:focus,
.add-admin-form select:focus {
  outline: none;
  border-color: #667eea;
}

.add-admin-form button {
  padding: 12px 28px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
}

.add-admin-form button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102,126,234,0.4);
}

.info-text {
  display: block;
  margin-top: 12px;
  font-size: 12px;
  color: #64748b;
}

.admins-list {
  background: white;
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  border: 1px solid rgba(0,0,0,0.05);
}

.admin-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid #f0f2f5;
}

.admin-card:last-child {
  border-bottom: none;
}

.admin-card-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-card-info .avatar {
  width: 44px;
  height: 44px;
}

.super-admin-badge {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
  color: white;
  margin-left: 8px;
}

.admin-badge {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
  color: white;
  margin-left: 8px;
}

.remove-admin {
  background: #fee2e2;
  color: #dc2626;
  padding: 6px 14px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.2s;
}

.remove-admin:hover {
  background: #fecaca;
}

/* Avatar styles */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
  transition: transform 0.2s ease;
  cursor: pointer;
}

.avatar:hover {
  transform: scale(1.05);
}

.avatar-initials {
  font-size: 14px;
  font-weight: 600;
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.avatar-online {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  background: #22c55e;
  border-radius: 50%;
  border: 2px solid white;
}

/* Chat list avatars */
.chat-avatars {
  display: flex;
  align-items: center;
  gap: -8px;
  margin-right: 12px;
}

.chat-avatars .avatar {
  width: 32px;
  height: 32px;
}

.chat-avatars .avatar:first-child {
  z-index: 2;
}

.chat-avatars .avatar:last-child {
  margin-left: -8px;
  z-index: 1;
}

.chat-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
}

.chat-item-content {
  flex: 1;
  min-width: 0;
}

/* Message wrapper with avatar */
.message-wrapper {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  animation: messageSlideIn 0.3s ease;
}

@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message-wrapper.incoming {
  justify-content: flex-start;
}

.message-wrapper.outgoing {
  justify-content: flex-end;
}

.message-avatar {
  flex-shrink: 0;
}

.message-wrapper.outgoing .message-avatar {
  order: 2;
}

.message-content {
  max-width: 60%;
}

.message-sender {
  font-size: 11px;
  font-weight: 500;
  color: #64748b;
  margin-bottom: 4px;
  padding: 0 4px;
}

.message-wrapper.outgoing .message-sender {
  text-align: right;
}

.message-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.message-item {
  display: flex;
  flex-direction: column;
}

.message-bubble {
  padding: 8px 12px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.4;
  word-wrap: break-word;
}

.message-wrapper.incoming .message-bubble {
  background: white;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  border-top-left-radius: 4px;
}

.message-wrapper.outgoing .message-bubble {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-top-right-radius: 4px;
}

.message-time {
  font-size: 10px;
  color: #94a3b8;
  margin-top: 2px;
  padding: 0 4px;
}

.message-wrapper.outgoing .message-time {
  text-align: right;
}

/* User modal */
.user-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fadeIn 0.2s ease;
}

.user-modal-content {
  background: white;
  border-radius: 28px;
  max-width: 400px;
  width: 90%;
  overflow: hidden;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.user-modal-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  position: relative;
}

.user-modal-header .avatar {
  width: 56px;
  height: 56px;
  border: 3px solid rgba(255,255,255,0.3);
}

.user-modal-header .avatar-initials {
  font-size: 20px;
}

.user-modal-header h3 {
  font-size: 18px;
  margin-bottom: 4px;
}

.user-modal-header p {
  font-size: 13px;
  opacity: 0.8;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255,255,255,0.2);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: white;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.modal-close:hover {
  background: rgba(255,255,255,0.3);
  transform: scale(1.1);
}

.user-modal-body {
  padding: 20px;
}

.user-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #f0f2f5;
}

.user-info-row:last-child {
  border-bottom: none;
}

.user-info-label {
  font-size: 13px;
  color: #64748b;
  font-weight: 500;
}

.user-info-value {
  font-size: 13px;
  color: #1e293b;
  font-weight: 500;
}

.active-text {
  color: #16a34a;
}

.blocked-text {
  color: #dc2626;
}

.user-modal-footer {
  padding: 16px 20px 20px;
  border-top: 1px solid #f0f2f5;
}

.block-user-btn, .unblock-user-btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.block-user-btn {
  background: #fee2e2;
  color: #dc2626;
}

.block-user-btn:hover {
  background: #fecaca;
}

.unblock-user-btn {
  background: #dcfce7;
  color: #16a34a;
}

.unblock-user-btn:hover {
  background: #bbf7d0;
}

/* User avatar in table */
.user-avatar-cell {
  width: 50px;
  padding: 8px !important;
}

.user-avatar-cell .avatar {
  width: 36px;
  height: 36px;
}

.user-avatar-cell .avatar-initials {
  font-size: 12px;
}

/* Report users */
.report-users {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.report-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #f0f2f5;
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .menu-toggle {
    display: flex;
  }
  
  .main-content {
    margin-left: 0;
    padding: 20px;
    padding-top: 70px;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .chats-container {
    flex-direction: column;
    height: auto;
  }
  
  .chats-list {
    width: 100%;
    max-height: 300px;
  }
  
  .chat-messages {
    min-height: 400px;
  }
  
  .users-table {
    font-size: 12px;
  }
  
  .users-table th,
  .users-table td {
    padding: 10px 8px;
  }
  
  .add-admin-form {
    flex-direction: column;
  }
  
  .add-admin-form input,
  .add-admin-form select {
    width: 100%;
  }
  
  .report-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .message-content {
    max-width: 85%;
  }
  
  .report-footer {
    flex-direction: column;
    align-items: flex-start;
  }
}