.chat-widget {
  position: fixed;
  left: 1.25rem;
  bottom: 1.25rem;
  z-index: 1080;
  font-family: "Tenor Sans", system-ui, sans-serif;
}

.chat-widget-toggle {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #7d6d58 0%, #9d8b72 55%, #c4b49a 100%);
  color: #fff;
  box-shadow:
    0 0 0 0 rgba(157, 139, 114, 0.45),
    0 0.5rem 1.5rem rgba(125, 109, 88, 0.35);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
  animation: chat-widget-glow 2.4s ease-in-out infinite;
}

.chat-widget-toggle-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(196, 180, 154, 0.75);
  pointer-events: none;
  animation: chat-widget-ring 2.4s ease-out infinite;
}

.chat-widget-toggle-ring--delay {
  animation-delay: 1.2s;
}

.chat-widget-toggle i {
  position: relative;
  z-index: 1;
  font-size: 1.35rem;
}

.chat-widget-toggle:hover,
.chat-widget-toggle:focus-visible {
  transform: translateY(-2px) scale(1.04);
  filter: brightness(1.06);
  animation-play-state: paused;
}

.chat-widget-toggle:hover .chat-widget-toggle-ring,
.chat-widget-toggle:focus-visible .chat-widget-toggle-ring {
  animation-play-state: paused;
}

.chat-widget.is-open .chat-widget-toggle {
  animation: none;
  box-shadow: 0 0.5rem 1.25rem rgba(125, 109, 88, 0.32);
}

.chat-widget.is-open .chat-widget-toggle-ring {
  display: none;
}

@keyframes chat-widget-glow {
  0%,
  100% {
    box-shadow:
      0 0 0 0 rgba(157, 139, 114, 0.42),
      0 0.5rem 1.5rem rgba(125, 109, 88, 0.35);
  }

  50% {
    box-shadow:
      0 0 0 0.55rem rgba(157, 139, 114, 0),
      0 0.65rem 1.65rem rgba(125, 109, 88, 0.45);
  }
}

@keyframes chat-widget-ring {
  0% {
    transform: scale(1);
    opacity: 0.85;
  }

  70%,
  100% {
    transform: scale(1.65);
    opacity: 0;
  }
}

.chat-widget-panel {
  position: absolute;
  left: 0;
  bottom: calc(100% + 0.75rem);
  width: min(20rem, calc(100vw - 2.5rem));
  padding: 0.75rem 0.85rem 0.85rem;
  border-radius: 0.85rem;
  background: #fff;
  border: 1px solid rgba(157, 139, 114, 0.18);
  box-shadow: 0 1rem 2.5rem rgba(43, 36, 32, 0.16);
  opacity: 0;
  visibility: hidden;
  transform: translateY(1rem);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
  pointer-events: none;
}

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

.chat-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.chat-widget-title {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.2rem;
  font-weight: 600;
  color: #5c4f3f;
  line-height: 1.2;
}

.chat-widget-close {
  width: 0.85rem;
  height: 0.85rem;
  padding: 0;
  opacity: 0.55;
}

.chat-widget-form {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.chat-widget-field {
  margin: 0;
}

.chat-widget-form .form-label {
  margin-bottom: 0.15rem;
  font-size: 0.6875rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #6b5d53;
}

.chat-widget-form .form-control {
  padding: 0.3rem 0.55rem;
  font-size: 0.8125rem;
  line-height: 1.35;
  border-color: rgba(157, 139, 114, 0.28);
  border-radius: 0.4rem;
}

.chat-widget-form textarea.form-control {
  min-height: 2.65rem;
  resize: none;
}

.chat-widget-form .form-control:focus {
  border-color: rgba(157, 139, 114, 0.55);
  box-shadow: 0 0 0 0.15rem rgba(157, 139, 114, 0.15);
}

.chat-widget-submit {
  margin-top: 0.15rem;
  padding: 0.42rem 0.75rem !important;
  font-size: 0.8125rem !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.chat-widget-submit-spinner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.chat-widget-submit-spinner .bi {
  font-size: 0.95rem;
  animation: chat-widget-spin 0.75s linear infinite;
}

.chat-widget-submit.is-loading .chat-widget-submit-label {
  opacity: 0.88;
}

@keyframes chat-widget-spin {
  to {
    transform: rotate(360deg);
  }
}

.chat-widget-feedback {
  margin-bottom: 0.35rem;
  padding: 0.45rem 0.6rem;
  border-radius: 0.4rem;
  font-size: 0.75rem;
  line-height: 1.35;
}

.chat-widget-feedback.is-success {
  background: rgba(157, 139, 114, 0.12);
  color: #5c4f3f;
}

.chat-widget-feedback.is-error {
  background: #fef2f2;
  color: #991b1b;
}

.chat-widget-form.is-submitting {
  opacity: 0.7;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .chat-widget-toggle,
  .chat-widget-toggle-ring {
    animation: none !important;
  }

  .chat-widget-toggle {
    box-shadow: 0 0.5rem 1.5rem rgba(125, 109, 88, 0.35);
  }

  .chat-widget-submit-spinner .bi {
    animation: none;
  }
}

@media (max-width: 575.98px) {
  .chat-widget {
    left: 1rem;
    bottom: 1rem;
  }

  .chat-widget-panel {
    width: min(18.5rem, calc(100vw - 2rem));
    padding: 0.65rem 0.75rem 0.75rem;
  }

  .chat-widget-form {
    gap: 0.4rem;
  }

  .chat-widget-title {
    font-size: 1.1rem;
  }
}
