/* SPM AI Assistant: isolated styles for the floating business assistant. */
.spm-ai {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100;
  font-family: var(--sans, 'Manrope', sans-serif);
}

.spm-ai button,
.spm-ai input,
.spm-ai select,
.spm-ai textarea {
  font: inherit;
}

.spm-ai__launcher {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 18px 0 12px;
  border: 1px solid #009bd4;
  border-radius: 999px;
  background: #009bd4;
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(0, 155, 212, 0.28);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.spm-ai__launcher:hover,
.spm-ai__launcher:focus-visible {
  background: #0088ba;
  box-shadow: 0 15px 34px rgba(0, 155, 212, 0.34);
  transform: translateY(-2px);
}

.spm-ai__launcher:focus-visible,
.spm-ai button:focus-visible,
.spm-ai input:focus-visible,
.spm-ai select:focus-visible,
.spm-ai textarea:focus-visible {
  outline: 3px solid #009bd4;
  outline-offset: 3px;
}

.spm-ai__launcher-icon {
  position: relative;
  display: block;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  overflow: hidden;
  border-radius: 50%;
  background: #ffffff;
}

.spm-ai__launcher-icon img,
.spm-ai__brand-logo img {
  display: block;
  width: 100%;
  height: 100%;
  padding: 3px;
  object-fit: contain;
}

.spm-ai__panel {
  position: absolute;
  right: 0;
  bottom: 66px;
  display: flex;
  width: min(390px, calc(100vw - 32px));
  max-height: min(630px, calc(100vh - 110px));
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(0, 155, 212, 0.2);
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 24px 62px rgba(0, 86, 118, 0.24);
  animation: spm-ai-enter 0.22s ease-out;
}

.spm-ai__panel[hidden] {
  display: none;
}

.spm-ai__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 20px 17px;
  background: #009bd4;
  color: #ffffff;
}

.spm-ai__header h2,
.spm-ai__header p {
  margin: 0;
}

.spm-ai__brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.spm-ai__brand-logo {
  position: relative;
  display: block;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  overflow: hidden;
  border-radius: 50%;
  background: #ffffff;
}

.spm-ai__eyebrow {
  margin-bottom: 5px !important;
  color: #ffffff;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.15em;
}

.spm-ai__header h2 {
  font-family: var(--serif, 'Space Grotesk', sans-serif);
  font-size: 21px;
  letter-spacing: -0.04em;
}

.spm-ai__header h2 + p {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 12px;
}

.spm-ai__close {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  background: transparent;
  color: #ffffff;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.spm-ai__messages {
  display: flex;
  min-height: 175px;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding: 18px 20px;
  background: #f5f5f2;
}

.spm-ai__message {
  max-width: 88%;
  padding: 11px 13px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.55;
}

.spm-ai__message p {
  margin: 0;
}

.spm-ai__message p + p {
  margin-top: 6px;
}

.spm-ai__message--assistant {
  align-self: flex-start;
  border: 1px solid #dfe5df;
  border-top-left-radius: 3px;
  background: #ffffff;
  color: #26312d;
}

.spm-ai__message--user {
  align-self: flex-end;
  border-top-right-radius: 3px;
  background: #009bd4;
  color: #ffffff;
}

.spm-ai__lead-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 4px;
}

.spm-ai__lead-form label {
  color: #43514c;
  font-size: 11px;
  font-weight: 800;
}

.spm-ai__lead-form label:nth-child(5),
.spm-ai__lead-form label:nth-child(6),
.spm-ai__lead-form button,
.spm-ai__lead-form .spm-ai__lead-status {
  grid-column: 1 / -1;
}

.spm-ai__lead-form input,
.spm-ai__lead-form select,
.spm-ai__lead-form textarea {
  width: 100%;
  margin-top: 4px;
  padding: 8px 9px;
  border: 1px solid #ccd5d0;
  border-radius: 7px;
  background: #ffffff;
  color: #182321;
  font-size: 12px;
}

.spm-ai__lead-form textarea {
  min-height: 62px;
  resize: vertical;
}

.spm-ai__lead-form button,
.spm-ai__input button {
  border: 0;
  border-radius: 8px;
  background: #009bd4;
  color: #ffffff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  transition: background 0.2s ease, transform 0.2s ease;
}

.spm-ai__lead-form button {
  min-height: 38px;
}

.spm-ai__lead-form button:hover,
.spm-ai__input button:hover {
  background: #0088ba;
  transform: translateY(-1px);
}

.spm-ai__lead-status {
  margin: 0;
  color: #009bd4;
  font-size: 11px;
  font-weight: 700;
}

.spm-ai__quick-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 7px;
  padding: 12px 20px;
  border-top: 1px solid #e4e8e5;
  background: #ffffff;
}

.spm-ai__quick-actions button {
  padding: 7px 9px;
  border: 1px solid #cbd7d1;
  border-radius: 999px;
  background: #ffffff;
  color: #26312d;
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.spm-ai__quick-actions button:hover {
  border-color: #009bd4;
  background: #009bd4;
  color: #ffffff;
}

.spm-ai__input {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
  padding: 13px 20px 18px;
  border-top: 1px solid #e4e8e5;
  background: #ffffff;
}

.spm-ai__input input {
  min-width: 0;
  flex: 1;
  border: 1px solid #cbd7d1;
  border-radius: 9px;
  padding: 10px 11px;
  color: #182321;
  font-size: 12px;
}

.spm-ai__input button {
  min-width: 58px;
}

.spm-ai__sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

@keyframes spm-ai-enter {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 600px) {
  .spm-ai {
    right: 16px;
    bottom: 16px;
  }

  .spm-ai__panel {
    bottom: 62px;
    width: calc(100vw - 32px);
    max-height: min(650px, calc(100vh - 92px));
  }

  .spm-ai__messages {
    min-height: 145px;
  }
}

@media (max-width: 390px) {
  .spm-ai__lead-form {
    grid-template-columns: 1fr;
  }

  .spm-ai__lead-form label,
  .spm-ai__lead-form label:nth-child(5),
  .spm-ai__lead-form label:nth-child(6) {
    grid-column: 1;
  }
}
