/* MK Assistant chatbot */
.chat-widget {
  position: fixed;
  bottom: 100px;
  right: 25px;
  z-index: 9998;
  font-family: inherit;
}

.chat-fab {
  width: 60px;
  height: 60px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: #fff;
  background: linear-gradient(135deg, var(--orange), var(--yellow));
  box-shadow: 0 10px 28px rgba(255, 122, 0, 0.35);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.chat-fab:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 14px 32px rgba(255, 122, 0, 0.45);
}

.chat-fab[aria-expanded="true"] {
  background: var(--green-dark);
}

.chat-panel {
  position: absolute;
  bottom: 76px;
  right: 0;
  width: min(380px, calc(100vw - 32px));
  max-height: min(520px, calc(100vh - 180px));
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(18, 60, 47, 0.22);
  border: 1px solid rgba(18, 60, 47, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.96);
  transition:
    opacity 0.28s ease,
    transform 0.28s ease,
    visibility 0.28s;
  pointer-events: none;
}

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

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: linear-gradient(135deg, var(--green-dark), var(--green));
  color: #fff;
}

.chat-header-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.chat-header-text h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.2;
}

.chat-header-text p {
  font-size: 12px;
  margin: 2px 0 0;
  opacity: 0.85;
}

.chat-close {
  margin-left: auto;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.chat-close:hover {
  background: rgba(255, 255, 255, 0.28);
}

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

.chat-msg {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 88%;
}

.chat-msg--user {
  align-self: flex-end;
  align-items: flex-end;
}

.chat-msg--bot {
  align-self: flex-start;
  align-items: flex-start;
}

.chat-bubble {
  padding: 12px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.55;
}

.chat-msg--user .chat-bubble {
  background: linear-gradient(135deg, var(--green-dark), var(--green));
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-msg--bot .chat-bubble {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  box-shadow: 0 4px 12px rgba(18, 60, 47, 0.06);
}

.chat-action-link {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  color: var(--green-dark);
  padding: 8px 14px;
  background: rgba(30, 93, 70, 0.08);
  border-radius: 999px;
  transition: background 0.2s ease;
}

.chat-action-link:hover {
  background: rgba(30, 93, 70, 0.15);
}

.chat-msg--typing .chat-bubble {
  display: flex;
  gap: 5px;
  padding: 14px 16px;
}

.chat-msg--typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gray);
  animation: chat-typing 1s infinite ease-in-out;
}

.chat-msg--typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.chat-msg--typing span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes chat-typing {
  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-4px);
  }
}

.chat-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 14px 12px;
  background: #f8faf9;
  border-top: 1px solid rgba(18, 60, 47, 0.06);
}

.chat-quick-btn {
  border: 1px solid rgba(18, 60, 47, 0.15);
  background: #fff;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  transition:
    background 0.2s ease,
    border-color 0.2s ease;
}

.chat-quick-btn:hover {
  background: rgba(30, 93, 70, 0.08);
  border-color: var(--green);
}

.chat-form {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  background: #fff;
}

.chat-input {
  flex: 1;
  border: 2px solid #e8e8e8;
  border-radius: 12px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease;
}

.chat-input:focus {
  border-color: var(--green);
}

.chat-send {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--orange), var(--yellow));
  color: #fff;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

.chat-send:hover {
  transform: scale(1.05);
}

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

  .chat-panel {
    width: calc(100vw - 32px);
    right: -9px;
  }
}
