/* ===========================
   DEMO PAGE — demo.css
   OpsBox dark theme (#0a0a0f bg, #0CEFFF accent)
   22-module interactive demo
   =========================== */

/* Override body bg for demo page */
body.demo-page {
  background: var(--bg, #0a0a0f);
  min-height: 100vh;
}

/* ===========================
   DEMO HERO
   =========================== */
.demo-hero {
  padding: 100px 0 40px;
  text-align: center;
}

.demo-hero-badge {
  display: inline-block;
  background: rgba(12, 239, 255, 0.1);
  color: #0CEFFF;
  border: 1px solid rgba(12, 239, 255, 0.25);
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 18px;
}

.demo-hero-title {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  color: #e8e8ed;
  margin: 0 0 14px;
  line-height: 1.1;
}

.demo-hero-sub {
  font-size: 1.1rem;
  color: #8a8a9a;
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.6;
}

/* Stats row */
.demo-stats {
  display: flex;
  justify-content: center;
  gap: 48px;
  margin-top: 28px;
}

.demo-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.demo-stat-num {
  font-size: 1.6rem;
  font-weight: 800;
  color: #0CEFFF;
  line-height: 1;
}

.demo-stat-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8a8a9a;
}

/* ===========================
   DEMO LAYOUT
   =========================== */
.demo-section {
  padding: 0 0 80px;
}

.demo-container {
  max-width: 1220px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

/* ===========================
   SIDEBAR — MODULE SELECTOR
   =========================== */
.demo-sidebar {
  width: 280px;
  flex-shrink: 0;
  position: sticky;
  top: 90px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
  padding-right: 4px;
}

.demo-sidebar::-webkit-scrollbar {
  width: 4px;
}
.demo-sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.demo-sidebar::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
}

/* Department groups */
.dept-group {
  margin-bottom: 18px;
}

.dept-group:last-child {
  margin-bottom: 0;
}

.dept-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8a8a9a;
  margin-bottom: 8px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.dept-icon {
  font-size: 0.85rem;
  line-height: 1;
}

.module-cards {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.module-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #12121a;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px;
  padding: 9px 11px;
  cursor: pointer;
  text-align: left;
  transition: background 0.18s, border-color 0.18s, transform 0.12s;
  width: 100%;
  font-family: inherit;
}

.module-card:hover {
  background: #16161f;
  border-color: rgba(12, 239, 255, 0.25);
  transform: translateX(2px);
}

.module-card.active {
  background: rgba(12, 239, 255, 0.07);
  border-color: #0CEFFF;
}

.module-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
  line-height: 1;
}

.module-info {
  min-width: 0;
}

.module-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: #e8e8ed;
  line-height: 1.2;
  margin-bottom: 1px;
}

.module-card.active .module-title {
  color: #0CEFFF;
}

.module-desc {
  font-size: 0.7rem;
  color: #8a8a9a;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===========================
   CHAT WINDOW
   =========================== */
.demo-chat {
  flex: 1;
  min-width: 0;
  background: #12121a;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: calc(100vh - 220px);
  min-height: 560px;
  max-height: 820px;
}

/* Chat Header */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  background: #16161f;
  flex-shrink: 0;
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
  color: #0a0a0f;
}

.atlas-avatar {
  background: linear-gradient(135deg, #0CEFFF 0%, #09b8c7 100%);
  box-shadow: 0 0 12px rgba(12, 239, 255, 0.35);
}

.user-avatar {
  background: #2a2a3a;
  color: #8a8a9a;
  font-size: 0.75rem;
  border: 1px solid rgba(255,255,255,0.1);
}

.chat-header-info {
  min-width: 0;
}

.chat-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #e8e8ed;
  display: flex;
  align-items: center;
  gap: 7px;
}

.chat-title-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: #8a8a9a;
}

.online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #23d160;
  display: inline-block;
  box-shadow: 0 0 6px rgba(35, 209, 96, 0.6);
  flex-shrink: 0;
}

.chat-subtitle {
  font-size: 0.75rem;
  color: #8a8a9a;
  margin-top: 1px;
}

/* Header right area */
.chat-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Scenario badge */
.scenario-badge {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 10px;
  border-radius: 12px;
  background: rgba(12, 239, 255, 0.1);
  color: #0CEFFF;
  border: 1px solid rgba(12, 239, 255, 0.2);
}

/* Replay Button */
.replay-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: #8a8a9a;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 6px 12px;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}

.replay-btn:hover {
  background: rgba(12, 239, 255, 0.1);
  border-color: rgba(12, 239, 255, 0.3);
  color: #0CEFFF;
}

/* Messages Area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
  width: 4px;
}
.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}
.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
}

/* Message Groups */
.msg-group {
  display: flex;
  gap: 10px;
  opacity: 0;
  transform: translateY(8px);
  animation: msgAppear 0.3s ease forwards;
}

.msg-group.user-group {
  flex-direction: row-reverse;
}

@keyframes msgAppear {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.7rem;
  flex-shrink: 0;
  margin-top: 2px;
  color: #0a0a0f;
}

.msg-avatar.atlas {
  background: linear-gradient(135deg, #0CEFFF 0%, #09b8c7 100%);
  box-shadow: 0 0 8px rgba(12, 239, 255, 0.25);
  color: #0a0a0f;
}

.msg-avatar.user {
  background: #2a2a3a;
  color: #8a8a9a;
  border: 1px solid rgba(255,255,255,0.1);
}

.msg-content {
  flex: 1;
  min-width: 0;
  max-width: calc(100% - 42px);
}

.user-group .msg-content {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.msg-meta {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-bottom: 5px;
}

.user-group .msg-meta {
  flex-direction: row-reverse;
}

.msg-sender {
  font-size: 0.8rem;
  font-weight: 600;
  color: #e8e8ed;
}

.msg-time {
  font-size: 0.7rem;
  color: #8a8a9a;
}

.msg-bubble {
  background: #16161f;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 12px 15px;
  font-size: 0.875rem;
  line-height: 1.6;
  color: #e8e8ed;
  max-width: 100%;
  word-wrap: break-word;
}

.user-group .msg-bubble {
  background: #1e1e2e;
  border-color: rgba(255,255,255,0.08);
  text-align: left;
}

/* Atlas message rich formatting */
.msg-bubble strong {
  color: #e8e8ed;
  font-weight: 600;
}

.msg-bubble .msg-section-header {
  font-weight: 700;
  color: #e8e8ed;
  margin: 10px 0 4px;
  display: block;
}

.msg-bubble .msg-section-header:first-child {
  margin-top: 0;
}

.msg-bubble .msg-bullet {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  margin: 2px 0;
  padding-left: 4px;
}

.msg-bubble .msg-bullet::before {
  content: '•';
  color: #0CEFFF;
  flex-shrink: 0;
  font-size: 0.8rem;
  margin-top: 1px;
}

/* Numbered list */
.msg-bullet-num {
  display: flex;
  gap: 7px;
  align-items: flex-start;
  margin: 3px 0;
  padding-left: 4px;
}

.msg-bullet-num .num-label {
  color: #0CEFFF;
  font-weight: 600;
  flex-shrink: 0;
  min-width: 16px;
  font-size: 0.82rem;
}

/* Blockquote */
.msg-quote {
  border-left: 3px solid #0CEFFF;
  margin: 8px 0;
  padding: 6px 10px;
  background: rgba(12, 239, 255, 0.06);
  border-radius: 0 6px 6px 0;
  color: #c0c0d0;
  font-style: italic;
  font-size: 0.855rem;
}

/* Inline table rendered as cards */
.msg-table {
  margin: 8px 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.08);
  font-size: 0.82rem;
}

.msg-table-row {
  display: grid;
  padding: 7px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  gap: 8px;
}

.msg-table-row:last-child {
  border-bottom: none;
}

.msg-table-row.header-row {
  background: rgba(12, 239, 255, 0.08);
  font-weight: 600;
  color: #0CEFFF;
  font-size: 0.77rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.msg-table-row.data-row {
  background: rgba(255,255,255,0.02);
  color: #e8e8ed;
}

.msg-table-row.data-row:hover {
  background: rgba(255,255,255,0.04);
}

.msg-table-cell {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Divider */
.msg-divider {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.08);
  margin: 8px 0;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  gap: 10px;
  align-items: center;
  opacity: 0;
  animation: msgAppear 0.25s ease forwards;
}

.typing-bubble {
  background: #16161f;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #0CEFFF;
  opacity: 0.4;
  animation: typingBounce 1.2s ease-in-out infinite;
}

.typing-dot:nth-child(1) { animation-delay: 0s; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* Date separator */
.chat-date-sep {
  text-align: center;
  font-size: 0.72rem;
  color: #8a8a9a;
  font-weight: 500;
  letter-spacing: 0.04em;
  position: relative;
}

.chat-date-sep::before,
.chat-date-sep::after {
  content: '';
  position: absolute;
  top: 50%;
  width: calc(50% - 60px);
  height: 1px;
  background: rgba(255,255,255,0.07);
}

.chat-date-sep::before { left: 0; }
.chat-date-sep::after { right: 0; }

/* ===========================
   CTA BAR
   =========================== */
.chat-cta {
  flex-shrink: 0;
  border-top: 1px solid rgba(255,255,255,0.08);
  background: linear-gradient(135deg, rgba(12,239,255,0.04) 0%, rgba(12,239,255,0.01) 100%);
  padding: 14px 20px;
  animation: msgAppear 0.4s ease forwards;
}

.chat-cta-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.chat-cta-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-cta-text strong {
  font-size: 0.9rem;
  font-weight: 700;
  color: #e8e8ed;
}

.chat-cta-text span {
  font-size: 0.8rem;
  color: #8a8a9a;
}

.chat-cta .btn-primary {
  white-space: nowrap;
  font-size: 0.85rem;
  padding: 10px 20px;
}

/* ===========================
   RESPONSIVE — MOBILE
   =========================== */
@media (max-width: 900px) {
  .demo-hero {
    padding: 80px 0 28px;
  }

  .demo-hero-title {
    font-size: 1.8rem;
  }

  .demo-hero-sub {
    font-size: 0.95rem;
    padding: 0 8px;
  }

  .demo-stats {
    gap: 32px;
    margin-top: 20px;
  }

  .demo-stat-num {
    font-size: 1.3rem;
  }

  .demo-container {
    flex-direction: column;
    padding: 0 12px;
    gap: 16px;
  }

  /* Sidebar becomes horizontal scroll */
  .demo-sidebar {
    width: 100%;
    position: static;
    max-height: none;
    overflow-y: visible;
    padding-right: 0;
  }

  .dept-group {
    margin-bottom: 12px;
  }

  .dept-label {
    font-size: 0.65rem;
    margin-bottom: 6px;
  }

  .module-cards {
    flex-direction: row;
    overflow-x: auto;
    gap: 6px;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .module-cards::-webkit-scrollbar {
    display: none;
  }

  .module-card {
    flex-shrink: 0;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 8px 10px;
    width: 100px;
    min-width: 100px;
    gap: 4px;
  }

  .module-card:hover {
    transform: none;
  }

  .module-icon {
    font-size: 1.3rem;
    width: auto;
  }

  .module-desc {
    display: none;
  }

  .module-title {
    font-size: 0.7rem;
    white-space: normal;
    text-align: center;
    line-height: 1.2;
  }

  .demo-chat {
    height: 520px;
    min-height: 480px;
    border-radius: 12px;
  }

  .chat-messages {
    padding: 14px;
    gap: 16px;
  }

  .msg-bubble {
    font-size: 0.82rem;
    padding: 10px 12px;
  }

  .chat-cta-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .chat-cta .btn-primary {
    width: 100%;
    text-align: center;
  }

  .msg-table-row {
    font-size: 0.76rem;
    padding: 6px 8px;
  }
}

@media (max-width: 480px) {
  .chat-title-label {
    display: none;
  }

  .scenario-badge {
    display: none;
  }

  .chat-subtitle {
    font-size: 0.7rem;
  }

  .msg-sender {
    font-size: 0.75rem;
  }

  .demo-chat {
    height: 480px;
  }

  .module-card {
    width: 88px;
    min-width: 88px;
    padding: 7px 8px;
  }

  .module-title {
    font-size: 0.65rem;
  }
}
