.chat-widget {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 200;
}

.chat-fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(180deg, var(--emerald-500), var(--emerald-600));
  color: #f4fbf7;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.chat-fab:hover { transform: translateY(-2px); box-shadow: 0 20px 40px -14px var(--emerald-glow); }
.chat-fab:active { transform: translateY(0); }

.chat-fab .material-symbols-rounded {
  font-size: 24px;
  position: absolute;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.chat-fab-icon-close { opacity: 0; transform: scale(0.6); }
.chat-fab.open .chat-fab-icon-open { opacity: 0; transform: scale(0.6); }
.chat-fab.open .chat-fab-icon-close { opacity: 1; transform: scale(1); }

.chat-panel {
  position: absolute;
  right: 0;
  bottom: 72px;
  width: 360px;
  max-width: calc(100vw - 48px);
  height: 480px;
  max-height: calc(100vh - 140px);
  background: var(--charcoal-900);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: chatRise 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes chatRise { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }

.chat-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-soft);
  flex-shrink: 0;
}

.chat-panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Jost', sans-serif;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink-100);
}
.chat-panel-title .material-symbols-rounded { color: var(--emerald-300); font-size: 19px; }

.chat-panel-close {
  background: none;
  border: none;
  color: var(--ink-500);
  cursor: pointer;
  display: flex;
  padding: 2px;
}
.chat-panel-close:hover { color: var(--ink-100); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-bubble {
  max-width: 84%;
  padding: 10px 13px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.chat-bubble-assistant {
  align-self: flex-start;
  background: var(--charcoal-800);
  color: var(--ink-300);
  border-bottom-left-radius: 4px;
}

.chat-bubble-user {
  align-self: flex-end;
  background: var(--emerald-700);
  color: #eafff4;
  border-bottom-right-radius: 4px;
}

.chat-bubble-typing { opacity: 0.6; }
.chat-bubble-error { color: var(--danger); background: rgba(217,123,108,0.1); }

.chat-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--border-soft);
  flex-shrink: 0;
}

.chat-input-row input {
  flex: 1;
  background: var(--charcoal-800);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--ink-100);
  font-family: 'Roboto', sans-serif;
  font-size: 13.5px;
  outline: none;
}
.chat-input-row input:focus { border-color: var(--emerald-500); }
.chat-input-row input::placeholder { color: var(--ink-600); }

.chat-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 7px;
  border: none;
  background: var(--emerald-500);
  color: #f4fbf7;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.chat-send-btn:hover { background: var(--emerald-600); }
.chat-send-btn .material-symbols-rounded { font-size: 18px; }

@media (max-width: 480px) {
  .chat-widget { right: 16px; bottom: 16px; }
  .chat-panel { width: calc(100vw - 32px); height: 70vh; }
}
