@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&display=swap');

/* Base & Utilities */
body {
  font-family: 'Inter', sans-serif;
  /* Background handled by Tailwind classes in HTML */
}

.glass {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.custom-scrollbar::-webkit-scrollbar {
  width: 4px;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
}

/* =========================================
   Dynamic Chat Elements (Generated by JS)
   ========================================= */

/* Message Container */
.msg {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem; /* space-x-3 */
  margin-bottom: 1.5rem; /* space-y-6 equivalent */
  max-width: 100%;
}

.msg.me {
  flex-direction: row-reverse;
}

/* Avatar Wrapper */
.avatar-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  width: 3.5rem; /* w-14 */
}

.avatar {
  width: 3rem; /* w-12 */
  height: 3rem; /* h-12 */
  border-radius: 9999px; /* rounded-full */
  object-fit: cover;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.msg.me .avatar {
  /* User avatar specific style if needed */
  border: 2px solid rgba(255,255,255,0.1);
}

/* Message Bubble */
.bubble {
  max-width: 100%;
  padding: 1rem;
  border-radius: 1rem; /* rounded-2xl */
  font-size: 0.95rem;
  line-height: 1.625;
  word-wrap: break-word;
  white-space: pre-wrap;
  position: relative;
}

/* AI Bubble Style (Glass) */
.msg.ai .bubble {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1); /* purple-500/20 approx */
  border-bottom-left-radius: 0;
  color: #e2e8f0; /* slate-200 */
}

/* User Bubble Style (Solid Blue/Gradient) */
.msg.me .bubble {
  background: #2563eb; /* blue-600 */
  color: white;
  border-bottom-right-radius: 0;
  box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.2);
}

.msg-body {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-width: 85%;
}
@media (min-width: 768px) {
  .msg-body {
    max-width: 28rem; /* max-w-md */
  }
}

.msg.me .msg-body {
  align-items: flex-end;
}

/* Timestamps */
.ts {
  font-size: 0.75rem; /* text-xs */
  color: rgba(255, 255, 255, 0.4);
  margin-top: 0.25rem;
}

/* Images in chat */
.bubble img.img {
  max-width: 100%;
  border-radius: 0.5rem;
  margin-top: 0.5rem;
}

/* =========================================
   Status / Hearts / NSFW (Legacy Support)
   ========================================= */
.status-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  margin-top: 0.25rem;
}

.status-row {
  font-size: 0.75rem;
  line-height: 1.2;
  white-space: nowrap;
  text-align: center;
  color: #94a3b8; /* slate-400 */
}

.status-row.stage {
  color: #f87171; /* red-400 */
  font-size: 0.65rem;
  letter-spacing: -1px;
}

.status-row.nsfw {
  font-size: 0.75rem;
  margin-top: 1px;
}
/* Dark mode default for this theme */
.nsfw-bar.light-mode { display: none; }
.nsfw-bar.dark-mode { display: inline; color: #cbd5e1; }

.avatar-badge {
  position: absolute;
  top: -2px;
  right: 0px;
  font-size: 1rem;
  z-index: 10;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5));
}
.avatar-badge.hidden { display: none; }


/* =========================================
   Drawers & Panels (Transitions)
   ========================================= */
/* Role Drawer Transition */
#roleDrawer {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
/* Mobile: Hidden by default (translate-x-full or -full depending on side) */
/* We'll handle this with Tailwind classes in HTML, but .open class override needed */
@media (max-width: 768px) {
  #roleDrawer.open {
    transform: translateX(0) !important;
  }
}

/* Settings Drawer */
.settings-drawer {
  /* Tailwind handles base styles */
  transform: translateX(100%);
  transition: transform 0.3s ease-in-out;
}
.settings-drawer.open {
  transform: translateX(0);
}

/* Group/Private Panels */
.group-panel, .private-panel {
  /* Tailwind glass style */
  background: rgba(15, 23, 42, 0.95); /* slate-900 */
  backdrop-filter: blur(10px);
}

/* Voice/Image Toggle Switches (Custom) */
.proactive-toggle, .image-toggle, .voice-toggle {
  display: flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
}
.proactive-track, .image-track, .voice-track {
  width: 2.75rem;
  height: 1.5rem;
  background-color: rgba(255,255,255,0.2);
  border-radius: 9999px;
  position: relative;
  transition: background-color 0.3s;
  margin-right: 0.75rem;
}
input:checked + .proactive-track,
input:checked + .image-track,
input:checked + .voice-track {
  background-color: #2563eb; /* blue-600 */
}
.proactive-track::after, .image-track::after, .voice-track::after {
  content: '';
  position: absolute;
  top: 0.125rem;
  left: 0.125rem;
  width: 1.25rem;
  height: 1.25rem;
  background-color: white;
  border-radius: 50%;
  transition: transform 0.3s;
}
input:checked + .proactive-track::after,
input:checked + .image-track::after,
input:checked + .voice-track::after {
  transform: translateX(1.25rem);
}

/* Audio Player Bubble */
.voice-bubble {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.1);
  border-radius: 1rem;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  margin-top: 0.25rem;
  min-width: 60px;
}
.voice-bubble.playing {
  background: rgba(37, 99, 235, 0.4);
}
.voice-icon {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
  margin-right: 8px;
}
.voice-bar {
  width: 2px;
  background: #fff;
  animation: none;
}
.voice-bubble.playing .voice-bar {
  animation: voice-wave 0.8s infinite ease-in-out;
}
.voice-bar:nth-child(1) { height: 6px; }
.voice-bar:nth-child(2) { height: 12px; }
.voice-bar:nth-child(3) { height: 8px; }
@keyframes voice-wave {
  0%, 100% { height: 4px; }
  50% { height: 12px; }
}
.voice-duration {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.8);
}
