/* ===== Consult Page Styles ===== */

.consult-main {
  min-height: calc(100vh - 200px);
  background: var(--soft);
  padding: 0 0 120px;
}

.consult-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 20px 0;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 200px);
}

/* Welcome Section */
.welcome-section {
  text-align: center;
  padding: 48px 20px 32px;
  transition: opacity 0.3s ease, max-height 0.4s ease;
}

.welcome-section.is-hidden {
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  padding: 0;
  pointer-events: none;
}

.welcome-icon {
  margin-bottom: 20px;
}

.welcome-title {
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 760;
  color: var(--ink);
  margin: 0 0 12px;
}

.welcome-desc {
  font-size: 16px;
  color: var(--muted);
  margin: 0 0 28px;
}

/* Quick Topics */
.quick-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  max-width: 600px;
  margin: 0 auto;
}

.quick-topic {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.quick-topic:hover {
  border-color: var(--blue);
  color: var(--blue);
  background: #f0f4ff;
  transform: translateY(-1px);
}

.quick-topic-icon {
  font-size: 16px;
}

/* Chat Messages */
.chat-messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 8px 0;
}

.chat-message {
  display: flex;
  gap: 12px;
  max-width: 85%;
  animation: msgIn 0.3s ease;
}

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

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

.chat-message.assistant {
  align-self: flex-start;
}

.chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 600;
}

.chat-message.user .chat-avatar {
  background: var(--blue);
  color: #fff;
}

.chat-message.assistant .chat-avatar {
  background: #e7edff;
  color: var(--blue);
}

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

.chat-message.user .chat-bubble {
  background: var(--blue);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-message.assistant .chat-bubble {
  background: #fff;
  color: var(--ink);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.chat-bubble p {
  margin: 0 0 8px;
}

.chat-bubble p:last-child {
  margin-bottom: 0;
}

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

.chat-bubble li {
  margin-bottom: 4px;
}

.chat-bubble code {
  background: rgba(0,0,0,0.06);
  padding: 2px 5px;
  border-radius: 3px;
  font-size: 13px;
}

/* Images in chat bubbles */
.chat-bubble-image {
  max-width: 280px;
  max-height: 280px;
  border-radius: 10px;
  margin-top: 8px;
  display: block;
  cursor: pointer;
  object-fit: cover;
  transition: opacity 0.2s ease;
}

.chat-bubble-image:hover {
  opacity: 0.85;
}

.chat-message.user .chat-bubble-image {
  border: 2px solid rgba(255,255,255,0.3);
}

.chat-message.assistant .chat-bubble-image {
  border: 1px solid var(--line);
}

/* Image lightbox */
.chat-image-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  animation: lightboxIn 0.2s ease;
}

@keyframes lightboxIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.chat-image-lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 4px 0;
}

.typing-indicator span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  animation: typing 1.2s infinite;
}

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

@keyframes typing {
  0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
  30% { opacity: 1; transform: scale(1); }
}

/* Chat Input Area */
.chat-input-area {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 16px 20px;
  z-index: 100;
}

/* Image preview above input */
.chat-image-preview {
  max-width: 800px;
  margin: 0 auto 8px;
  animation: msgIn 0.2s ease;
}

.chat-image-preview-inner {
  position: relative;
  display: inline-block;
}

.chat-image-preview-inner img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 10px;
  border: 2px solid var(--line);
  display: block;
}

.chat-image-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: #ef4444;
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: background 0.2s ease;
}

.chat-image-remove:hover {
  background: #dc2626;
}

.chat-input-wrapper {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 8px 8px 8px;
  transition: border-color 0.2s ease;
}

.chat-input-wrapper:focus-within {
  border-color: var(--blue);
}

/* Upload button */
.chat-upload-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.chat-upload-btn:hover {
  background: #e7edff;
  color: var(--blue);
}

.chat-upload-btn.has-image {
  color: var(--blue);
  background: #e7edff;
}

.chat-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 15px;
  font-family: var(--font);
  color: var(--ink);
  resize: none;
  outline: none;
  min-height: 24px;
  max-height: 120px;
  line-height: 1.5;
  padding: 4px 0;
}

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

.chat-send {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s ease, opacity 0.2s ease;
}

.chat-send:hover:not(:disabled) {
  background: #0c46ce;
}

.chat-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.chat-disclaimer {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin: 8px auto 0;
  max-width: 800px;
}

/* Error State */
.chat-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--red);
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  text-align: center;
}

/* Responsive */
@media (max-width: 680px) {
  .consult-container {
    padding: 16px 12px 0;
  }

  .welcome-section {
    padding: 32px 12px 24px;
  }

  .quick-topics {
    gap: 8px;
  }

  .quick-topic {
    padding: 8px 14px;
    font-size: 13px;
  }

  .chat-message {
    max-width: 92%;
  }

  .chat-bubble {
    padding: 12px 14px;
    font-size: 14px;
  }

  .chat-bubble-image {
    max-width: 200px;
    max-height: 200px;
  }

  .chat-input-area {
    padding: 12px 12px;
  }

  .chat-image-preview-inner img {
    width: 64px;
    height: 64px;
  }
}
