* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #8B1A2B;
  --primary-light: #A8293B;
  --primary-gradient: linear-gradient(135deg, #8B1A2B, #A8293B);
  --bg: #FAF7F5;
  --card-bg: #FFFFFF;
  --text: #2D2D2D;
  --text-light: #666;
  --text-muted: #999;
  --border: #F0EBE8;
  --shadow: 0 2px 12px rgba(139,26,43,0.08);
  --radius: 16px;
  --radius-sm: 10px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  height: 100vh;
  overflow: hidden;
}

.chat-fullscreen {
  display: flex;
  flex-direction: column;
}

.chat-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--bg);
}

.chat-header {
  background: var(--primary-gradient);
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  box-shadow: 0 2px 12px rgba(139,26,43,0.2);
}

.chat-header-avatar {
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.chat-header-info {
  flex: 1;
}

.chat-header-title {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
}

.chat-header-status {
  font-size: 12px;
  opacity: 0.9;
  display: flex;
  align-items: center;
  gap: 4px;
}

.chat-header-status::before {
  content: '';
  width: 7px;
  height: 7px;
  background: #4ADE80;
  border-radius: 50%;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--bg);
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
  width: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(139,26,43,0.15);
  border-radius: 2px;
}

.chat-msg {
  display: flex;
  gap: 10px;
  max-width: 88%;
  animation: msgFadeIn 0.35s ease;
}

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

.chat-msg.bot {
  align-self: flex-start;
}

.chat-msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-msg-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 2px;
}

.chat-msg.bot .chat-msg-avatar {
  background: var(--primary-gradient);
  color: white;
}

.chat-msg.user .chat-msg-avatar {
  background: linear-gradient(135deg, #60A5FA, #3B82F6);
  color: white;
}

.chat-msg-bubble {
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.7;
  word-break: break-word;
}

.chat-msg.bot .chat-msg-bubble {
  background: white;
  color: var(--text);
  border: 1px solid var(--border);
  border-top-left-radius: 6px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.chat-msg.user .chat-msg-bubble {
  background: var(--primary-gradient);
  color: white;
  border-top-right-radius: 6px;
}

.chat-msg-bubble b {
  font-weight: 600;
}

.chat-msg-bubble .quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
}

.chat-msg-bubble .quick-btn {
  background: linear-gradient(135deg, #FFF5F5, #FEF2F2);
  color: #8B1A2B;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid #FECACA;
  transition: all 0.2s;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.chat-msg-bubble .quick-btn:hover {
  background: linear-gradient(135deg, #8B1A2B, #A8293B);
  color: white;
  border-color: #8B1A2B;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(139,26,43,0.2);
}

.chat-msg-bubble .quick-btn:active {
  transform: translateY(0);
}

.chat-typing {
  display: flex;
  gap: 5px;
  padding: 4px 0;
  align-items: center;
}

.chat-typing span {
  width: 8px;
  height: 8px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typingDot 1.4s infinite;
}

.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingDot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

.chat-input-area {
  padding: 14px 16px;
  background: white;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-shrink: 0;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.04);
}

.chat-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 12px 18px;
  font-size: 15px;
  outline: none;
  resize: none;
  max-height: 100px;
  min-height: 44px;
  line-height: 1.4;
  font-family: inherit;
  color: var(--text);
  background: #FAFAFA;
  transition: border-color 0.2s, background 0.2s;
}

.chat-input:focus {
  border-color: var(--primary-light);
  background: white;
}

.chat-input::placeholder {
  color: var(--text-muted);
}

.chat-send-btn {
  width: 44px;
  height: 44px;
  background: var(--primary-gradient);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.chat-send-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 2px 12px rgba(139,26,43,0.3);
}

.chat-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

@media (max-width: 480px) {
  .chat-header {
    padding: 14px 16px;
    padding-top: calc(14px + env(safe-area-inset-top));
  }
  .chat-input-area {
    padding: 12px 14px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }
  .chat-msg-bubble {
    padding: 10px 14px;
    font-size: 14px;
  }
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.35s cubic-bezier(0.4,0,0.2,1);
  backdrop-filter: blur(4px);
}

.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: white;
  border-radius: 24px;
  padding: 32px 24px;
  width: 90%;
  max-width: 340px;
  text-align: center;
  transform: scale(0.9) translateY(20px);
  transition: all 0.35s cubic-bezier(0.4,0,0.2,1);
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  position: relative;
}

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

.modal-close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  background: #F3F4F6;
  border: none;
  border-radius: 50%;
  font-size: 16px;
  color: #666;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.modal-close-btn:hover {
  background: #E5E7EB;
  color: #333;
}

.modal-icon {
  font-size: 56px;
  margin-bottom: 16px;
  animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.modal-desc {
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 20px;
}

.modal-qr {
  margin-bottom: 16px;
}

.modal-qr-img {
  width: 180px;
  height: auto;
  border-radius: 12px;
  margin: 0 auto;
  display: block;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.modal-qr-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  margin-top: 10px;
}

.modal-tip {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.modal-btn {
  width: 100%;
  height: 48px;
  background: var(--primary-gradient);
  color: white;
  border: none;
  border-radius: 24px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(139,26,43,0.3);
}

@media (max-width: 480px) {
  .modal-content {
    padding: 28px 20px;
    width: 92%;
  }
  .modal-qr-img {
    width: 160px;
  }
}
