/* ============================================
   chat-widget.css — 学生端聊天浮窗样式
   ============================================ */

/* ---- 聊天气泡按钮 ---- */
.chat-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 9998;
  transition: transform 0.2s, box-shadow 0.2s;
  user-select: none;
}
.chat-bubble:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(102, 126, 234, 0.55);
}
.chat-bubble:active {
  transform: scale(0.95);
}
.chat-bubble-icon {
  font-size: 26px;
  line-height: 1;
}

/* ---- 未读 badge ---- */
.chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  background: #ff4757;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  box-shadow: 0 2px 6px rgba(255, 71, 87, 0.4);
}

/* ---- 聊天面板 ---- */
.chat-panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 360px;
  height: 480px;
  max-height: calc(100vh - 60px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  z-index: 9999;
  overflow: hidden;
  animation: chatSlideUp 0.25s ease-out;
}
@keyframes chatSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- 面板头部 ---- */
.chat-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  flex-shrink: 0;
}
.chat-close-btn {
  background: rgba(255,255,255,0.2);
  border: none;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.chat-close-btn:hover {
  background: rgba(255,255,255,0.35);
}

/* ---- 消息列表 ---- */
.chat-message-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f7f8fc;
}
.chat-message-list::-webkit-scrollbar {
  width: 4px;
}
.chat-message-list::-webkit-scrollbar-thumb {
  background: #d0d5dd;
  border-radius: 2px;
}

.chat-empty-hint {
  text-align: center;
  color: #9ca3af;
  font-size: 13px;
  margin-top: 60px;
}

/* ---- 单条消息 ---- */
.chat-message {
  display: flex;
  flex-direction: column;
  max-width: 85%;
}
.chat-message-mine {
  align-self: flex-end;
  align-items: flex-end;
}
.chat-message-theirs {
  align-self: flex-start;
  align-items: flex-start;
}
.chat-message-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-wrap;
}
.chat-message-mine .chat-message-bubble {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-message-theirs .chat-message-bubble {
  background: #fff;
  color: #333;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.chat-message-time {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 3px;
  padding: 0 4px;
}

/* ---- 输入区域 ---- */
.chat-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid #e5e7eb;
  background: #fff;
  flex-shrink: 0;
}
.chat-input {
  flex: 1;
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  padding: 9px 16px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  background: #f9fafb;
}
.chat-input:focus {
  border-color: #667eea;
  background: #fff;
}
.chat-send-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.chat-send-btn:hover {
  opacity: 0.9;
}
.chat-send-btn:active {
  transform: scale(0.96);
}

/* ---- 移动端适配 ---- */
@media (max-width: 480px) {
  .chat-panel {
    width: calc(100vw - 16px);
    height: 60vh;
    bottom: 8px;
    right: 8px;
    border-radius: 12px;
  }
  .chat-bubble {
    bottom: 16px;
    right: 16px;
    width: 50px;
    height: 50px;
  }
}
