/* ── Chat widget ── */
.chat-widget {
  position: fixed;
  right: max(16px, 3vw);
  bottom: 88px;
  z-index: 9000;
  font-family: var(--font-body, Inter, sans-serif);
}

.chat-launcher {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 18px;
  border: none;
  border-radius: 999px;
  background: var(--red, #d71920);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 12px 32px rgba(215, 25, 32, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chat-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 36px rgba(215, 25, 32, 0.4);
}

.chat-launcher-icon { font-size: 18px; line-height: 1; }

.chat-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 12px);
  width: min(390px, calc(100vw - 32px));
  max-height: min(620px, calc(100vh - 120px));
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
  border: 1px solid rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-panel[hidden] { display: none !important; }

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  background: var(--dark, #0f172a);
  color: #fff;
}

.chat-header strong {
  display: block;
  font-family: var(--font-display, inherit);
  font-size: 16px;
}

.chat-header span {
  display: block;
  font-size: 12px;
  color: #b0b8c4;
  margin-top: 2px;
}

.chat-close {
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f8f9fb;
}

.chat-msg {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.chat-msg.bot {
  align-self: flex-start;
  background: #fff;
  color: var(--dark, #0f172a);
  border: 1px solid var(--line, #e5e7eb);
  border-bottom-left-radius: 4px;
}

.chat-msg.user {
  align-self: flex-end;
  background: var(--red, #d71920);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-msg.estimate {
  align-self: stretch;
  max-width: 100%;
  background: #fff;
  border: 2px solid rgba(215, 25, 32, 0.2);
  border-radius: 14px;
  padding: 14px;
}

.chat-estimate-title {
  font-weight: 800;
  font-size: 15px;
  margin-bottom: 8px;
  color: var(--dark);
}

.chat-estimate-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  padding: 4px 0;
  color: #454b55;
}

.chat-estimate-total {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-weight: 800;
  font-size: 16px;
  color: var(--red);
}

.chat-estimate-note {
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted, #6b7280);
  line-height: 1.4;
}

.chat-compose {
  padding: 12px 16px 16px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.chat-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chat-option {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--dark);
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.chat-option:hover,
.chat-option:focus {
  border-color: var(--red);
  background: rgba(215, 25, 32, 0.06);
  outline: none;
}

.chat-form {
  display: grid;
  gap: 8px;
}

.chat-form input,
.chat-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  font-size: 14px;
}

.chat-form input:focus,
.chat-form textarea:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(215, 25, 32, 0.1);
}

.chat-form textarea {
  min-height: 72px;
  resize: vertical;
}

.chat-submit {
  width: 100%;
  margin-top: 4px;
}

.chat-address-wrap { position: relative; }

.chat-suggestions {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 4px);
  margin: 0;
  padding: 6px 0;
  list-style: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.15);
  max-height: 160px;
  overflow-y: auto;
  z-index: 2;
  display: none;
}

.chat-suggestions.is-open { display: block; }

.chat-suggestions li {
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
}

.chat-suggestions li:hover { background: rgba(215, 25, 32, 0.08); }

.chat-loading {
  font-size: 13px;
  color: var(--muted);
  padding: 4px 0;
}

.chat-error {
  font-size: 13px;
  color: #b42318;
  margin-top: 6px;
}

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

  .chat-panel {
    position: fixed;
    inset: 0;
    width: 100%;
    max-height: none;
    border-radius: 0;
    bottom: auto;
  }

  .chat-launcher-text { display: none; }
  .chat-launcher { padding: 14px; }
}
