/* ==========================================================================
   DATAMMO CHAT THEME & DESIGN SYSTEM
   Phong cách chuẩn Dark Theme sàn MMO (#020617), tối ưu cho đồ án & Docs
   ========================================================================== */

:root {
  --dm-bg-main: #020617;        /* Nền chính sâu nhất (Slate 950) */
  --dm-bg-surface: #0b1329;     /* Nền component / sidebar (Slate 900 đậm) */
  --dm-bg-card: #0f172a;        /* Nền thẻ / message container */
  --dm-bg-hover: #1e293b;       /* Trạng thái hover / item active */
  --dm-border: #1e293b;         /* Đường viền chuẩn */
  --dm-border-focus: #3b82f6;   /* Đường viền khi focus */

  --dm-primary: #2563eb;        /* Xanh Datammo Primary (Blue 600) */
  --dm-primary-hover: #1d4ed8;  /* Blue 700 */
  --dm-primary-light: #3b82f6;  /* Blue 500 */
  --dm-primary-glow: rgba(37, 99, 235, 0.25);

  --dm-success: #10b981;        /* Xanh lá hoàn thành / Online */
  --dm-warning: #f59e0b;        /* Vàng cảnh báo / Đang chờ */
  --dm-danger: #ef4444;         /* Đỏ lỗi / Khiếu nại */
  --dm-info: #06b6d4;           /* Xanh ngọc thông tin */

  --dm-text-main: #f8fafc;      /* Chữ chính sáng (Slate 50) */
  --dm-text-muted: #94a3b8;     /* Chữ phụ (Slate 400) */
  --dm-text-dim: #64748b;       /* Chữ mờ / timestamp (Slate 500) */
}

/* Base resets & full-screen viewport lock */
html, body {
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box;
}

/* Khóa full màn hình cho ứng dụng chat */
body:not(.scrollable-page), html:not(.scrollable-page) {
  height: 100% !important;
  height: 100vh !important;
  height: 100dvh !important;
  overflow: hidden !important;
}

/* Cho phép trang tài liệu Docs cuộn tự do */
html.scrollable-page, body.scrollable-page {
  height: auto !important;
  min-height: 100vh !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

*, *::before, *::after {
  box-sizing: border-box;
}

#root {
  height: 100% !important;
  height: 100vh !important;
  height: 100dvh !important;
  width: 100% !important;
  max-height: 100vh !important;
  max-height: 100dvh !important;
  display: flex !important;
  overflow: hidden !important;
}

.h-screen {
  height: 100% !important;
  height: 100vh !important;
  height: 100dvh !important;
}

.w-screen {
  width: 100% !important;
  width: 100vw !important;
}

.h-full {
  height: 100% !important;
}

.min-h-0 {
  min-height: 0 !important;
}

.flex-1 {
  flex: 1 1 0% !important;
}

body {
  background-color: var(--dm-bg-main);
  color: var(--dm-text-main);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
}

/* Tùy chỉnh thanh cuộn đẹp mắt */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

/* Glassmorphism & viền sáng tinh tế */
.dm-glass {
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.dm-glow-blue {
  box-shadow: 0 0 20px var(--dm-primary-glow);
}

/* Khung tin nhắn (Chat Bubbles) */
.bubble-incoming {
  background-color: #1e293b;
  color: #f1f5f9;
  border-radius: 18px 18px 18px 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.bubble-outgoing {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  border-radius: 18px 18px 4px 18px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* Hộp thông tin tài khoản MMO (Credentials Box) */
.mmo-credential-card {
  background: #020617;
  border: 1px dashed #334155;
  border-radius: 12px;
  transition: all 0.2s ease;
}
.mmo-credential-card:hover {
  border-color: #3b82f6;
  background: #0b1329;
}

/* Thẻ đơn hàng ghim trong chat (Order Widget) */
.order-banner-card {
  background: linear-gradient(90deg, rgba(30, 41, 59, 0.9) 0%, rgba(15, 23, 42, 0.9) 100%);
  border: 1px solid #334155;
  border-radius: 12px;
}

/* Trạng thái Online / Offline Pulse */
.status-indicator-online {
  width: 10px;
  height: 10px;
  background-color: var(--dm-success);
  border-radius: 50%;
  border: 2px solid var(--dm-bg-main);
  position: relative;
}
.status-indicator-online::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 50%;
  border: 1.5px solid var(--dm-success);
  animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.9); opacity: 1; }
  70% { transform: scale(1.8); opacity: 0; }
  100% { transform: scale(1.8); opacity: 0; }
}

/* Hiệu ứng đang gõ tin nhắn (Typing Indicator) */
.typing-dot {
  width: 6px;
  height: 6px;
  background-color: #94a3b8;
  border-radius: 50%;
  display: inline-block;
  animation: typing-bounce 1.4s infinite ease-in-out both;
}
.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }
.typing-dot:nth-child(3) { animation-delay: 0s; }

@keyframes typing-bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Toast thông báo */
.dm-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  background: #0f172a;
  border: 1px solid #3b82f6;
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 0 15px rgba(59, 130, 246, 0.3);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideInUp 0.3s ease-out;
}

@keyframes slideInUp {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Animation mượt cho tin nhắn mới xuất hiện */
.msg-anim-enter {
  animation: msgFadeIn 0.25s ease-out forwards;
}
@keyframes msgFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
