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

:root {
  --font-family-base:
    'Inter', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB',
    'Microsoft YaHei', sans-serif;

  --primary-gradient: linear-gradient(135deg, #06d6a0 0%, #118ab2 100%);
  --primary-light: #06d6a0;
  --primary-dark: #118ab2;

  --bg-primary: #f8fffe;
  --bg-secondary: #ffffff;
  --bg-chat: linear-gradient(180deg, #f8fffe 0%, #ffffff 100%);

  --text-primary: #1a1d29;
  --text-secondary: #6b7588;
  --text-light: #9ca3af;
  --border-color: #e2e8f0;
  --border-light: #f1f5f9;

  --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.1);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, 0.1);
  --shadow-lg: 0 8px 24px rgba(16, 24, 40, 0.12);
  --shadow-xl: 0 20px 40px rgba(16, 24, 40, 0.15);
}

* {
  font-family: var(--font-family-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html,
body {
  height: 100%;
  overflow: hidden;
  background: var(--bg-chat);
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
}

/* 主容器 */
.chat-container {
  height: 100vh;
  width: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  position: relative;
  overflow: hidden;
}

/* 桌面端优化 */
@media (min-width: 1024px) {
  .chat-container {
    height: 90vh;
    width: 420px;
    max-height: 800px;
    border-radius: 24px;
    box-shadow: var(--shadow-xl);
    margin: auto;
    border: 1px solid var(--border-light);
  }
}

/* 顶部导航栏 */
.header {
  background: var(--primary-gradient);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  position: relative;
  border-radius: 0;
}

@media (min-width: 1024px) {
  .header {
    border-radius: 24px 24px 0 0;
  }
}

.header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.05) 100%);
  pointer-events: none;
}

.doctor-avatar {
  position: relative;
  z-index: 1;
}

.doctor-avatar img {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  transition: transform 0.3s ease;
}

.doctor-avatar img:hover {
  transform: scale(1.05);
}

.online-status {
  width: 14px;
  height: 14px;
  background: #10b981;
  border: 3px solid white;
  border-radius: 50%;
  position: absolute;
  bottom: 2px;
  right: 2px;
  box-shadow: var(--shadow-sm);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.7;
  }
}

.doctor-info {
  z-index: 1;
}

.doctor-info h1 {
  font-size: 1.125rem;
  font-weight: 600;
  color: white;
  margin: 0 0 4px 0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.doctor-info p {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.85);
  margin: 0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.header-menu-btn {
  z-index: 1;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.header-menu-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px;
  background: var(--bg-primary);
  scroll-behavior: smooth;
  position: relative;
}

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

.messages-container::-webkit-scrollbar-track {
  background: transparent;
}

.messages-container::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 10px;
}

.messages-container::-webkit-scrollbar-thumb:hover {
  background: var(--text-light);
}

.message-bubble {
  max-width: 85%;
  word-wrap: break-word;
  padding: 14px 18px;
  border-radius: 20px;
  line-height: 1.6;
  font-size: 0.95rem;
  position: relative;
  backdrop-filter: blur(10px);
}

.user-message {
  justify-content: flex-end;
}

.user-message .message-bubble {
  background: var(--primary-gradient);
  color: white;
  border-bottom-right-radius: 6px;
  box-shadow: var(--shadow-md);
  margin-left: auto;
  min-width: fit-content !important;
}

.doctor-message .message-bubble {
  background: white;
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  border-bottom-left-radius: 6px;
  box-shadow: var(--shadow-sm);
}

.message-content p {
  margin: 0 0 8px 0;
}

.message-content p:last-child {
  margin-bottom: 0;
}

.message-content ul,
.message-content ol {
  padding-left: 20px;
  margin: 8px 0;
}

.message-content strong {
  font-weight: 600;
  color: var(--primary-dark);
}

.message-time {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 8px;
  padding: 0 8px;
  font-weight: 500;
}

.message-image {
  max-width: 240px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  margin-bottom: 12px;
  background: white;
  border: 1px solid var(--border-light);
}

.message-image img {
  width: 100%;
  height: auto;
  display: block;
}

.fade-in {
  animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.suggestion-container {
  padding: 0 20px 20px;
  background: var(--bg-primary);
}

.suggestion-chip {
  background: white;
  color: var(--primary-dark);
  border: 1px solid var(--border-color);
  padding: 10px 16px;
  border-radius: 16px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  margin: 6px 8px 6px 0;
  display: inline-block;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
}

.suggestion-chip:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  background: var(--primary-light);
  color: white;
  border-color: var(--primary-light);
}

.input-area {
  padding: 20px;
  background: white;
  border-top: 1px solid var(--border-light);
  box-shadow: 0 -4px 12px rgba(16, 24, 40, 0.05);
}

.input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 8px 12px;
  transition: all 0.3s ease;
  position: relative;
}

.input-wrapper:focus-within {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(6, 214, 160, 0.1);
}

.message-textarea {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  resize: none;
  min-height: 24px;
  max-height: 120px;
  padding: 8px 12px;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text-primary);
}

.message-textarea::placeholder {
  color: var(--text-light);
}

.action-button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.action-button.attach {
  background: transparent;
  color: var(--text-secondary);
}

.action-button.attach:hover {
  background: var(--border-light);
  color: var(--primary-dark);
  transform: scale(1.05);
}

.action-button.send {
  background: var(--primary-gradient);
  color: white;
  box-shadow: var(--shadow-md);
}

.action-button.send:disabled {
  background: var(--border-color);
  color: var(--text-light);
  cursor: not-allowed;
  transform: scale(1);
  box-shadow: none;
}

.action-button.send:not(:disabled):hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-lg);
}

.action-button.send:not(:disabled):active {
  transform: scale(0.95);
}

.typing-indicator {
  display: flex;
  align-items: center;
  padding: 16px 0;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background: var(--text-light);
  border-radius: 50%;
  margin: 0 3px;
  animation: typing 1.5s infinite;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.5;
  }

  30% {
    transform: translateY(-10px);
    opacity: 1;
  }
}

.security-indicator.secure {
  background: rgba(16, 185, 129, 0.9);
}

.security-indicator.insecure {
  background: rgba(239, 68, 68, 0.9);
}

@media (max-width: 768px) {
  .header {
    padding: 16px 20px;
  }

  .doctor-avatar img {
    width: 48px;
    height: 48px;
  }

  .doctor-info h1 {
    font-size: 1rem;
  }

  .doctor-info p {
    font-size: 0.8125rem;
  }

  .messages-container {
    padding: 20px 16px;
  }

  .message-bubble {
    max-width: 90%;
    padding: 12px 16px;
    font-size: 0.9rem;
  }

  .input-area {
    padding: 16px;
  }

  .suggestion-container {
    padding: 0 16px 16px;
  }

  .security-indicator {
    top: 5px;
    right: 5px;
    font-size: 0.7rem;
    padding: 3px 6px;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-light: #64748b;
    --border-color: #334155;
    --border-light: #475569;
  }

  .doctor-message .message-bubble {
    background: var(--bg-secondary);
    border-color: var(--border-color);
  }

  .input-wrapper {
    background: var(--bg-secondary);
    border-color: var(--border-color);
  }

  .suggestion-chip {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
  }
}

.custom-scrollbar {
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}

.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: var(--text-light);
}
.modal {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: flex-end;
  z-index: 1000;
  transition: opacity 0.3s ease;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background-color: #fff;
  border-radius: 12px 12px 0 0;
  width: 100%;
  max-width: 600px;
  padding: 16px;
}

.modal-option {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 16px;
  margin-bottom: 8px;
  border: none;
  background-color: #f3f4f6;
  border-radius: 8px;
  font-size: 16px;
  color: #1f2937;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.modal-option:hover {
  background-color: #e5e7eb;
}

.modal-option svg {
  margin-right: 12px;
}

.modal-option.cancel {
  background-color: #fff;
  color: #ef4444;
  border: 1px solid #ef4444;
}

.modal-option.cancel:hover {
  background-color: #fef2f2;
} 
