/* ElderCity AI assistant widget */

.elder-chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999999;
  font-family: "Poppins", "Noto Sans TC", sans-serif;
  pointer-events: none;
}

.elder-chat-widget .elder-chat-launcher,
.elder-chat-widget .elder-chat-panel {
  pointer-events: auto;
}

.elder-chat-launcher {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 0 20px 0 16px;
  border-radius: 28px;
  background: linear-gradient(135deg, #00a99d, #1e5f74);
  color: #fff;
  border: 3px solid #fff;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  font-size: 1rem;
  font-weight: 700;
  transition: transform 0.2s;
}

.elder-chat-launcher-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.elder-chat-launcher-label {
  white-space: nowrap;
}

.elder-chat-launcher:hover,
.elder-chat-launcher:focus {
  transform: scale(1.05);
  outline: 3px solid #ffea00;
  outline-offset: 3px;
}

.elder-chat-panel {
  position: absolute;
  bottom: 76px;
  right: 0;
  width: min(400px, calc(100vw - 48px));
  max-height: min(560px, calc(100vh - 120px));
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.25s, transform 0.25s, visibility 0.25s;
}

.elder-chat-widget.is-open .elder-chat-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.elder-chat-header {
  background: linear-gradient(135deg, #00a99d, #1e5f74);
  color: #fff;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.elder-chat-header h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.elder-chat-header p {
  margin: 4px 0 0;
  font-size: 0.8rem;
  opacity: 0.9;
}

.elder-chat-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.25rem;
}

.elder-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 240px;
  max-height: 360px;
  background: #f8fafb;
}

.elder-chat-msg {
  max-width: 88%;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 0.95rem;
  line-height: 1.5;
}

.elder-chat-msg.bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid #e0e6eb;
  color: #1e2a3a;
}

.elder-chat-msg.user {
  align-self: flex-end;
  background: #00a99d;
  color: #fff;
}

.elder-chat-msg.typing {
  font-style: italic;
  color: #6b7c8f;
}

.elder-chat-quick {
  padding: 8px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-top: 1px solid #e8ecef;
  background: #fff;
}

.elder-chat-quick button {
  font-size: 0.8rem;
  padding: 8px 12px;
  border-radius: 20px;
  border: 1px solid #00a99d;
  background: #fff;
  color: #1e5f74;
  cursor: pointer;
  min-height: 40px;
}

.elder-chat-quick button:hover,
.elder-chat-quick button:focus {
  background: #e6f7f5;
}

.elder-chat-input-row {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid #e8ecef;
  background: #fff;
}

.elder-chat-input-row input {
  flex: 1;
  padding: 12px 14px;
  border: 2px solid #d0d7de;
  border-radius: 10px;
  font-size: 1rem;
  min-height: 48px;
}

.elder-chat-input-row input:focus {
  border-color: #00a99d;
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 169, 157, 0.25);
}

.elder-chat-send {
  min-width: 48px;
  min-height: 48px;
  border: none;
  border-radius: 10px;
  background: #00a99d;
  color: #fff;
  cursor: pointer;
  font-size: 1.1rem;
}

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

@media (max-width: 480px) {
  .elder-chat-widget {
    right: 12px;
    bottom: 12px;
  }
}
