/* PawaScript React Components - Chat App Style */

/* ============================================
   ChatList Container
   ============================================ */
.pawa-chat-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  overflow-y: auto;
  height: 100%;
}

/* ============================================
   ChatBubble
   ============================================ */
.pawa-chat-container {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  max-width: 85%;
}

.pawa-chat-container.pawa-left {
  flex-direction: row;
  align-self: flex-start;
}

.pawa-chat-container.pawa-right {
  flex-direction: row-reverse;
  align-self: flex-end;
}

.pawa-chat-avatar-wrapper {
  flex-shrink: 0;
}

.pawa-chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: #e0e0e0;
}

.pawa-chat-avatar-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase;
}

.pawa-chat-bubble-wrapper {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  max-width: 100%;
}

.pawa-left .pawa-chat-bubble-wrapper {
  align-items: flex-start;
}

.pawa-right .pawa-chat-bubble-wrapper {
  align-items: flex-end;
}

.pawa-chat-name-label {
  font-size: 12px;
  font-weight: 500;
  color: #666;
  padding: 0 4px;
}

.pawa-chat-bubble {
  padding: 10px 14px;
  border-radius: 18px;
  line-height: 1.4;
  word-wrap: break-word;
  max-width: 100%;
}

.pawa-left .pawa-chat-bubble {
  background: #f0f0f0;
  color: #1a1a1a;
  border-bottom-left-radius: 4px;
}

.pawa-right .pawa-chat-bubble {
  background: #0084ff;
  color: white;
  border-bottom-right-radius: 4px;
}

.pawa-think .pawa-chat-bubble {
  background: #f5f0ff;
  color: #666;
  font-style: italic;
  border: 1px dashed #d0c0e0;
}

.pawa-right.pawa-think .pawa-chat-bubble {
  background: #e8f4ff;
  color: #666;
  border: 1px dashed #b0d0f0;
}

.pawa-chat-text {
  white-space: pre-wrap;
}

.pawa-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: currentColor;
  margin-left: 1px;
  animation: pawa-blink 0.7s infinite;
  vertical-align: text-bottom;
}

@keyframes pawa-blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* ============================================
   NarrationBox (inline style)
   ============================================ */
.pawa-narration-container {
  align-self: center;
  max-width: 80%;
  padding: 4px 0;
}

.pawa-narration-box {
  padding: 12px 20px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 12px;
  border-left: 3px solid #6c757d;
}

.pawa-narration-text {
  color: #495057;
  font-size: 14px;
  line-height: 1.6;
  font-style: italic;
  white-space: pre-wrap;
}

/* ============================================
   SystemMessage (inline style)
   ============================================ */
.pawa-system-container {
  align-self: center;
  padding: 4px 0;
}

.pawa-system-message {
  padding: 6px 16px;
  background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
  color: #6c5000;
  font-weight: 500;
  font-size: 13px;
  border-radius: 16px;
  text-align: center;
  white-space: nowrap;
}

/* ============================================
   DateChangeDisplay (inline style)
   ============================================ */
.pawa-date-container {
  align-self: center;
  padding: 8px 0;
}

.pawa-date-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.pawa-date-icon {
  width: 20px;
  height: 20px;
  background: #e74c3c;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 10px;
  font-weight: bold;
}

.pawa-date-text {
  color: #333;
  font-size: 13px;
  font-weight: 500;
}

/* ============================================
   TimePassDisplay (inline style)
   ============================================ */
.pawa-timepass-container {
  align-self: center;
  padding: 12px 0;
  width: 100%;
}

.pawa-timepass-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pawa-timepass-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, #ccc, transparent);
}

.pawa-timepass-text {
  color: #888;
  font-size: 13px;
  font-style: italic;
  white-space: nowrap;
}

/* ============================================
   SpeakerIntro (inline style)
   ============================================ */
.pawa-speaker-container {
  align-self: center;
  padding: 8px 0;
}

.pawa-speaker-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.pawa-speaker-icon {
  font-size: 14px;
}

.pawa-speaker-name {
  color: white;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* ============================================
   BackgroundChange (inline notification)
   ============================================ */
.pawa-bg-change-container {
  align-self: center;
  padding: 4px 0;
}

.pawa-bg-change-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #f0f0f0;
  border-radius: 12px;
  font-size: 12px;
  color: #888;
}

/* ============================================
   TransitionOverlay (still fullscreen for effects)
   ============================================ */
.pawa-transition-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  pointer-events: none;
}

.pawa-transition-fade {
  background: black;
  animation: pawa-fade-in-out var(--pawa-duration, 1000ms) ease-in-out;
}

.pawa-transition-flash {
  background: white;
  animation: pawa-flash-effect var(--pawa-duration, 1000ms) ease-out;
}

.pawa-transition-battle_like {
  background: linear-gradient(45deg, transparent 30%, rgba(255, 0, 0, 0.3) 50%, transparent 70%);
  animation: pawa-battle-slash var(--pawa-duration, 1000ms) ease-out;
}

@keyframes pawa-fade-in-out {
  0% { opacity: 0; }
  30% { opacity: 1; }
  70% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes pawa-flash-effect {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes pawa-battle-slash {
  0% { transform: translateX(-100%) rotate(-45deg); opacity: 1; }
  50% { transform: translateX(0) rotate(-45deg); opacity: 1; }
  100% { transform: translateX(100%) rotate(-45deg); opacity: 0; }
}

/* ============================================
   GameScreen (simple container)
   ============================================ */
.pawa-game-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 100vh;
  background: #fff;
}

.pawa-game-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ============================================
   Chat Item Slide-in Animation
   ============================================ */
.pawa-chat-item {
  animation: pawa-slide-in 0.3s ease-out;
}

@keyframes pawa-slide-in {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
