/* MYPLYN chat widget */
.mypln-chat-root {
  --mypln-green: #00B86B;
  --mypln-green-dark: #009456;
  --mypln-navy: #0A1F44;
  --mypln-line: #E8EDF3;
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9999;
  font-family: Inter, system-ui, sans-serif;
}

.mypln-chat-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border: none;
  border-radius: 999px;
  background: var(--mypln-green);
  color: #fff;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 184, 107, 0.35);
  transition: transform 0.2s ease, background 0.2s ease;
}

.mypln-chat-toggle:hover {
  background: var(--mypln-green-dark);
  transform: translateY(-2px);
}

.mypln-chat-toggle svg {
  width: 20px;
  height: 20px;
}

.mypln-chat-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 12px);
  width: min(380px, calc(100vw - 32px));
  height: min(520px, calc(100vh - 120px));
  background: #fff;
  border: 1px solid var(--mypln-line);
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(10, 31, 68, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.mypln-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #F0FDF4, #fff);
  border-bottom: 1px solid var(--mypln-line);
}

.mypln-chat-header-copy strong {
  display: block;
  color: var(--mypln-navy);
  font-size: 0.95rem;
}

.mypln-chat-header-copy span {
  display: block;
  color: #64748B;
  font-size: 0.75rem;
  margin-top: 2px;
}

.mypln-chat-close {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: #F1F5F9;
  color: var(--mypln-navy);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.mypln-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mypln-chat-msg {
  display: flex;
}

.mypln-chat-msg--user {
  justify-content: flex-end;
}

.mypln-chat-bubble {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 0.84rem;
  line-height: 1.45;
  word-break: break-word;
}

.mypln-chat-msg--bot .mypln-chat-bubble {
  background: #F8FAFC;
  color: var(--mypln-navy);
  border-bottom-left-radius: 4px;
}

.mypln-chat-msg--user .mypln-chat-bubble {
  background: #E8FBF2;
  color: var(--mypln-navy);
  border-bottom-right-radius: 4px;
}

.mypln-chat-bubble--typing::after {
  content: '';
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-left: 2px;
  vertical-align: text-bottom;
  background: var(--mypln-green);
  animation: myplnChatCursor 0.8s step-end infinite;
}

@keyframes myplnChatCursor {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.mypln-chat-link {
  color: var(--mypln-green-dark);
  font-weight: 600;
  text-decoration: underline;
}

.mypln-chat-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  height: 18px;
}

.mypln-chat-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #94A3B8;
  animation: myplnChatDot 1.2s infinite ease-in-out;
}

.mypln-chat-dots span:nth-child(2) { animation-delay: 0.15s; }
.mypln-chat-dots span:nth-child(3) { animation-delay: 0.3s; }

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

.mypln-chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 12px 10px;
}

.mypln-chat-chip {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid #BBF7D0;
  background: #F0FDF4;
  color: var(--mypln-navy);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.mypln-chat-chip:hover {
  background: #DCFCE7;
}

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

.mypln-chat-input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1.5px solid var(--mypln-line);
  border-radius: 12px;
  font: inherit;
  font-size: 0.84rem;
  color: var(--mypln-navy);
}

.mypln-chat-input:focus {
  outline: none;
  border-color: var(--mypln-green);
  box-shadow: 0 0 0 3px rgba(0, 184, 107, 0.15);
}

.mypln-chat-send {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border: none;
  border-radius: 12px;
  background: var(--mypln-green);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.mypln-chat-send:hover {
  background: var(--mypln-green-dark);
}

.mypln-chat-send svg {
  width: 18px;
  height: 18px;
}

.mypln-chat-send:disabled,
.mypln-chat-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

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

  .mypln-chat-panel {
    width: calc(100vw - 24px);
    height: min(70vh, 480px);
  }

  .mypln-chat-toggle span {
    display: none;
  }

  .mypln-chat-toggle {
    width: 52px;
    height: 52px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
  }
}
