/* ==========================================================================
   DreamTalk – AI Roleplay Chat Stylesheet
   Palette:
   - Background: #101014
   - Sidebar: #17171D
   - Chat background: #101014
   - Primary: #8B7CFF
   - Secondary: #C3B7FF
   - Text: #F5F5F7
   - Muted text: #92929D
   ========================================================================== */

:root {
  --bg-main: #101014;
  --bg-sidebar: #17171D;
  --bg-surface: #1E1E26;
  --bg-surface-hover: #262631;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --primary: #8B7CFF;
  --primary-hover: #7A68FF;
  --secondary: #C3B7FF;
  --text-main: #F5F5F7;
  --text-muted: #92929D;
  --chat-font-size: 0.95rem;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(146, 146, 157, 0.25);
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(195, 183, 255, 0.45);
}

/* Chat Font Size Preferences */
body[data-font-size="sm"] {
  --chat-font-size: 0.875rem;
}

body[data-font-size="md"] {
  --chat-font-size: 0.95rem;
}

body[data-font-size="lg"] {
  --chat-font-size: 1.05rem;
}

.chat-message-text {
  font-size: var(--chat-font-size);
  line-height: 1.65;
  word-break: break-word;
}

/* Roleplay Action Emphasis (*action*) */
.rp-action {
  color: var(--secondary);
  font-style: italic;
  opacity: 0.94;
}

body[data-highlight-actions="false"] .rp-action {
  color: inherit;
  opacity: 0.85;
}

/* Subtle animations */
@keyframes fadeInSlideUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.msg-animate {
  animation: fadeInSlideUp 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* AI Thinking Dots Animation */
@keyframes pulseDot {
  0%, 80%, 100% {
    transform: scale(0.65);
    opacity: 0.4;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.typing-dot {
  width: 7px;
  height: 7px;
  background-color: var(--secondary);
  border-radius: 9999px;
  display: inline-block;
  animation: pulseDot 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;
}

/* Active Sidebar Item Styling */
.sidebar-item-active {
  background: linear-gradient(90deg, rgba(139, 124, 255, 0.18) 0%, rgba(139, 124, 255, 0.05) 100%);
  border-color: rgba(139, 124, 255, 0.45) !important;
}

/* User & AI Chat Bubbles */
.bubble-user {
  background: linear-gradient(135deg, #8B7CFF 0%, #6E5CE6 100%);
  color: #FFFFFF;
  border-radius: 1.15rem 1.15rem 0.25rem 1.15rem;
  box-shadow: 0 6px 20px -4px rgba(139, 124, 255, 0.35);
}

.bubble-ai {
  background-color: #1A1A23;
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 1.15rem 1.15rem 1.15rem 0.25rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

/* Modal Backdrop */
.modal-backdrop {
  background-color: rgba(8, 8, 12, 0.78);
  backdrop-filter: blur(6px);
}

/* RPG: thanh công cụ & tab cuộn ngang, ẩn thanh cuộn nhưng vẫn vuốt được */
.rpg-scroll {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.rpg-scroll::-webkit-scrollbar {
  display: none;
}
