.chat-widget {
  position: fixed;
  left: auto;
  right: 18px;
  bottom: 18px;
  z-index: 80;
  display: grid;
  justify-items: end;
  gap: 10px;
  font-family: "Inter", Arial, sans-serif;
}

.chat-toggle,
.chat-reply-form button,
.chat-start-form button {
  border: 1px solid rgba(255, 247, 236, 0.74);
  border-radius: 999px;
  color: var(--button-ink, #201916);
  background:
    linear-gradient(135deg, rgba(255, 250, 242, 0.98), rgba(245, 234, 216, 0.94));
  box-shadow: 0 16px 42px rgba(26, 18, 14, 0.18);
  cursor: pointer;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chat-toggle {
  min-height: 48px;
  padding: 0 22px;
  color: #fffdfa;
  border-color: rgba(122, 38, 45, 0.26);
  background: linear-gradient(135deg, #a84f57, #7f343b);
  box-shadow: 0 16px 42px rgba(112, 39, 46, 0.24);
  font-size: 0.74rem;
  touch-action: none;
}

.chat-toggle:not(.is-open) {
  animation: chatAttention 1.05s ease-in-out infinite;
}

@keyframes chatAttention {
  0%, 100% {
    background: linear-gradient(135deg, #a84f57, #7f343b);
    box-shadow: 0 16px 42px rgba(112, 39, 46, 0.24), 0 0 0 0 rgba(178, 56, 67, 0);
  }
  50% {
    background: linear-gradient(135deg, #cc626c, #a2414a);
    box-shadow: 0 18px 48px rgba(145, 38, 49, 0.34), 0 0 0 9px rgba(190, 58, 70, 0.16);
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-toggle:not(.is-open) {
    animation: none;
  }
}

.chat-panel {
  width: min(360px, calc(100vw - 28px));
  overflow: hidden;
  border: 1px solid rgba(25, 21, 19, 0.1);
  border-radius: 22px;
  background: rgba(255, 253, 250, 0.96);
  box-shadow: 0 28px 80px rgba(30, 22, 18, 0.2);
}

.chat-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 16px 18px;
  background: rgba(245, 234, 216, 0.72);
}

.chat-head strong,
.chat-head span {
  display: block;
}

.chat-head span {
  margin-top: 2px;
  color: var(--muted, #6f6460);
  font-size: 0.78rem;
  font-weight: 750;
}

.chat-head button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(25, 21, 19, 0.08);
  border-radius: 50%;
  background: rgba(255, 253, 250, 0.72);
  cursor: pointer;
  font-size: 1.25rem;
}

.chat-head-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
  align-items: center;
}

.chat-head .chat-clear {
  width: auto;
  min-width: 54px;
  padding: 0 11px;
  border-radius: 999px;
  color: #5f3435;
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0;
}

.chat-head .chat-clear:disabled {
  cursor: wait;
  opacity: 0.5;
}

.chat-start-form,
.chat-reply-form,
.chat-step-form {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.chat-start-form label,
.chat-step-form label {
  display: grid;
  gap: 6px;
  color: var(--muted, #6f6460);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chat-start-form label span {
  color: #8e2e34;
}

.chat-start-form input,
.chat-reply-form input,
.chat-step-form input {
  min-height: 42px;
  border: 1px solid rgba(25, 21, 19, 0.12);
  border-radius: 14px;
  padding: 0 12px;
  color: var(--ink, #191513);
  background: rgba(255, 253, 250, 0.94);
  font: inherit;
  outline: none;
}

.chat-start-form input:focus,
.chat-reply-form input:focus,
.chat-step-form input:focus {
  border-color: rgba(109, 52, 56, 0.42);
  box-shadow: 0 0 0 4px rgba(201, 132, 124, 0.12);
}

.chat-start-form button,
.chat-reply-form button,
.chat-step-form button,
.chat-choice-panel button {
  min-height: 40px;
  padding: 0 16px;
  font-size: 0.66rem;
}

.chat-reply-form {
  grid-template-columns: minmax(0, 1fr) auto;
  border-top: 1px solid rgba(25, 21, 19, 0.08);
}

.chat-messages {
  display: grid;
  gap: 8px;
  max-height: 310px;
  overflow: auto;
  padding: 16px;
}

.chat-message {
  max-width: 82%;
  border-radius: 16px;
  padding: 10px 12px;
  background: rgba(245, 234, 216, 0.86);
}

.chat-message.is-customer {
  justify-self: end;
  color: #fffdfa;
  background: var(--wine, #6d3438);
}

.chat-message p,
.chat-empty,
.chat-error {
  margin: 0;
  line-height: 1.45;
}

.chat-typing {
  display: flex;
  width: fit-content;
  gap: 4px;
  border-radius: 14px;
  padding: 11px 13px;
  background: rgba(245, 234, 216, 0.86);
}

.chat-typing i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #6d3438;
  animation: chatTyping 1s ease-in-out infinite;
}

.chat-typing i:nth-child(2) {
  animation-delay: 0.14s;
}

.chat-typing i:nth-child(3) {
  animation-delay: 0.28s;
}

@keyframes chatTyping {
  0%, 60%, 100% { opacity: 0.35; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

.chat-slot-panel,
.chat-booking-confirm {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid rgba(25, 21, 19, 0.08);
  background: rgba(255, 253, 250, 0.86);
}

.chat-slot-panel > strong,
.chat-booking-confirm > strong {
  color: var(--ink, #191513);
  font-size: 0.82rem;
}

.chat-slot-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  max-height: 150px;
  overflow: auto;
}

.chat-slot-grid button,
.chat-booking-confirm button {
  min-height: 38px;
  border: 1px solid rgba(109, 52, 56, 0.16);
  border-radius: 12px;
  color: #201916;
  background: rgba(245, 234, 216, 0.72);
  cursor: pointer;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 800;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.chat-slot-grid button:hover,
.chat-booking-confirm button:hover {
  transform: translateY(-1px);
  border-color: rgba(109, 52, 56, 0.42);
  box-shadow: 0 8px 20px rgba(60, 38, 31, 0.1);
}

.chat-loader {
  color: var(--muted, #6f6460);
  font-size: 0.78rem;
}

.chat-booking-confirm dl {
  display: grid;
  gap: 6px;
  margin: 0;
}

.chat-booking-confirm dl div {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 8px;
  font-size: 0.74rem;
}

.chat-booking-confirm dt {
  color: var(--muted, #6f6460);
}

.chat-booking-confirm dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--ink, #191513);
  font-weight: 750;
}

.chat-booking-confirm button {
  border-radius: 999px;
  color: #fffdfa;
  background: #6d3438;
}

.chat-booking-confirm button:disabled,
.chat-reply-form button:disabled,
.chat-reply-form input:disabled {
  cursor: wait;
  opacity: 0.6;
}

.chat-empty {
  color: var(--muted, #6f6460);
  font-size: 0.9rem;
}

.chat-choice-panel {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-top: 1px solid rgba(25, 21, 19, 0.08);
}

.chat-choice-panel p,
.chat-guide {
  margin: 0;
  color: var(--muted, #6f6460);
  line-height: 1.45;
}

.chat-guide {
  padding: 0 16px 14px;
  font-size: 0.9rem;
}

.chat-choice-panel div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chat-choice-panel button {
  width: auto;
}

.chat-message.has-choices {
  display: grid;
  width: 100%;
  max-width: 100%;
  gap: 8px;
  padding: 0;
  background: transparent;
}

.chat-message.has-choices > p {
  width: fit-content;
  max-width: 82%;
  border-radius: 16px;
  padding: 10px 12px;
  background: rgba(245, 234, 216, 0.86);
}

.chat-message-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  width: 100%;
}

.chat-message-choices button {
  min-height: 36px;
  padding: 8px 13px;
  border: 1px solid rgba(109, 52, 56, 0.18);
  border-radius: 999px;
  color: #332421;
  background: rgba(245, 234, 216, 0.78);
  box-shadow: 0 5px 14px rgba(60, 38, 31, 0.07);
  font-size: 0.75rem;
  font-weight: 750;
  line-height: 1.25;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.chat-message-choices button:hover,
.chat-message-choices button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(109, 52, 56, 0.42);
  box-shadow: 0 8px 18px rgba(60, 38, 31, 0.11);
}

.chat-calendar {
  box-sizing: border-box;
  display: grid;
  justify-self: stretch;
  gap: 8px;
  width: 100%;
  border: 1px solid rgba(109, 52, 56, 0.14);
  border-radius: 14px;
  padding: 11px;
  background: rgba(255, 253, 250, 0.94);
  box-shadow: 0 8px 22px rgba(60, 38, 31, 0.07);
}

.chat-calendar-head {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 30px;
  gap: 8px;
  align-items: center;
}

.chat-calendar-head strong {
  text-align: center;
  color: #2d211e;
  font-size: 0.8rem;
}

.chat-calendar-head button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(109, 52, 56, 0.16);
  border-radius: 50%;
  color: #4d3030;
  background: rgba(245, 234, 216, 0.68);
  cursor: pointer;
  font-size: 1.05rem;
}

.chat-calendar-weekdays,
.chat-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.chat-calendar-weekdays span {
  text-align: center;
  color: #786b66;
  font-size: 0.58rem;
  font-weight: 750;
}

.chat-calendar-grid button,
.chat-calendar-empty {
  aspect-ratio: 1;
  min-width: 0;
}

.chat-calendar-grid button {
  border: 1px solid rgba(25, 21, 19, 0.09);
  border-radius: 8px;
  color: #2d211e;
  background: #fffdfa;
  cursor: pointer;
  font: inherit;
  font-size: 0.68rem;
  font-weight: 750;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.chat-calendar-grid button:hover:not(:disabled),
.chat-calendar-grid button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(109, 52, 56, 0.42);
  background: rgba(245, 234, 216, 0.75);
}

.chat-calendar-grid button:disabled,
.chat-calendar-head button:disabled {
  cursor: not-allowed;
  opacity: 0.32;
}

.chat-calendar-grid button.is-unavailable {
  text-decoration: line-through;
}

.chat-error {
  padding: 0 16px 14px;
  color: #8e2e34;
  font-size: 0.78rem;
  font-weight: 800;
}

@media (max-width: 560px) {
  .chat-widget {
    right: 12px !important;
    bottom: 12px !important;
    left: auto !important;
    top: auto !important;
    max-width: calc(100vw - 24px);
  }

  .chat-panel {
    width: min(360px, calc(100vw - 48px));
    max-height: min(620px, calc(100vh - 96px));
    overflow: auto;
    border-radius: 18px;
  }

  .chat-toggle {
    min-height: 42px;
    padding-inline: 16px;
    font-size: 0.66rem;
  }

  .chat-messages {
    max-height: 240px;
  }

  .chat-slot-grid {
    max-height: 126px;
  }
}
