/**
 * 对话弹窗样式
 */

/* 弹窗遮罩 */
.dialogue-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  z-index: 2100; /* 确保在交互弹窗之上 */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.dialogue-modal-overlay.show {
  opacity: 1;
}

/* 弹窗主体 */
.dialogue-modal {
  width: 100%;
  max-width: 500px;
  max-height: 85vh;
  background: linear-gradient(180deg, #1a1a1a 0%, #0d0d0d 100%);
  border: 2px solid var(--color-faded-red-dark);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(0.95) translateY(20px);
  transition: transform 0.3s ease;
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.8),
    0 0 40px rgba(139, 58, 58, 0.1);
}

.dialogue-modal-overlay.show .dialogue-modal {
  transform: scale(1) translateY(0);
}

/* 头部 - NPC信息 */
.dialogue-header {
  padding: 20px;
  background: linear-gradient(180deg, rgba(139, 58, 58, 0.2) 0%, rgba(139, 58, 58, 0.05) 100%);
  border-bottom: 1px solid var(--color-faded-red-dark);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.npc-info {
  display: flex;
  gap: 15px;
  align-items: center;
}

.npc-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(139, 58, 58, 0.2);
  border: 2px solid var(--color-faded-red);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  flex-shrink: 0;
}

.npc-details {
  flex: 1;
}

.npc-name {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--color-faded-red-light);
  margin: 0 0 5px 0;
}

.npc-description {
  font-size: 0.8rem;
  color: var(--color-bone-white-dark);
  margin: 0;
  line-height: 1.5;
}

.close-btn {
  background: none;
  border: none;
  color: var(--color-bone-white-dark);
  font-size: 1.8rem;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.close-btn:hover {
  color: var(--color-bone-white);
  background: rgba(255, 255, 255, 0.1);
}

/* 对话主体 */
.dialogue-body {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* 对话历史 */
.dialogue-history {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  max-height: 50vh;
}

.dialogue-entry {
  margin-bottom: 15px;
  animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dialogue-entry .speaker {
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.dialogue-entry .message {
  padding: 12px 15px;
  border-radius: 8px;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--color-bone-white);
}

/* NPC说的话 */
.dialogue-entry.npc .speaker {
  color: var(--color-npc);
}

.dialogue-entry.npc .message {
  background: rgba(139, 91, 184, 0.1);
  border: 1px solid rgba(139, 91, 184, 0.3);
  border-left: 3px solid var(--color-npc);
}

/* 玩家说的话 */
.dialogue-entry.player .speaker {
  color: var(--color-examine);
  text-align: right;
}

.dialogue-entry.player .message {
  background: rgba(91, 141, 184, 0.1);
  border: 1px solid rgba(91, 141, 184, 0.3);
  border-right: 3px solid var(--color-examine);
  text-align: right;
}

/* 对话选项 */
.dialogue-options {
  padding: 15px 20px 20px;
  border-top: 1px dashed var(--color-faded-red-dark);
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 200px;
  overflow-y: auto;
}

.dialogue-option {
  background: rgba(91, 141, 184, 0.1);
  border: 1px solid rgba(91, 141, 184, 0.3);
  border-left: 3px solid var(--color-examine);
  color: var(--color-bone-white);
  padding: 12px 15px;
  border-radius: 4px;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-body);
  font-size: 0.9rem;
  line-height: 1.5;
  transition: all var(--transition-fast);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dialogue-option:hover {
  background: rgba(91, 141, 184, 0.2);
  border-color: var(--color-examine);
  transform: translateX(5px);
}

.dialogue-option.end-dialogue {
  background: rgba(139, 58, 58, 0.1);
  border-color: rgba(139, 58, 58, 0.3);
  border-left-color: var(--color-faded-red);
  justify-content: center;
}

.dialogue-option.end-dialogue:hover {
  background: rgba(139, 58, 58, 0.2);
}

.option-hint {
  font-size: 0.9rem;
  opacity: 0.7;
}

/* 滚动条样式 */
.dialogue-history::-webkit-scrollbar,
.dialogue-options::-webkit-scrollbar {
  width: 4px;
}

.dialogue-history::-webkit-scrollbar-thumb,
.dialogue-options::-webkit-scrollbar-thumb {
  background: var(--color-faded-red-dark);
  border-radius: 2px;
}

/* 响应式适配 */
@media (max-width: 480px) {
  .dialogue-modal-overlay {
    padding: 10px;
  }
  
  .dialogue-modal {
    max-height: 90vh;
  }
  
  .dialogue-header {
    padding: 15px;
  }
  
  .npc-avatar {
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
  }
  
  .npc-name {
    font-size: 1.1rem;
  }
  
  .npc-description {
    font-size: 0.75rem;
  }
  
  .dialogue-history {
    padding: 15px;
  }
  
  .dialogue-options {
    padding: 10px 15px 15px;
  }
}
