.yj-chat-widget {
  position: fixed;
  right: 2rem;
  bottom: 2rem;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1.5px solid rgba(30, 58, 138, 0.3);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: #1e3a8a;
  line-height: 0;
  cursor: pointer;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.12);
  z-index: 9998;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease,
    color 180ms ease;
}

.yj-chat-widget:hover {
  transform: translateY(-2px);
  border-color: rgba(14, 116, 144, 0.42);
  background: rgba(255, 255, 255, 0.78);
  color: #0f766e;
  box-shadow: 0 24px 52px rgba(15, 23, 42, 0.16);
}

.yj-chat-widget:focus-visible {
  outline: 0;
  border-color: rgba(14, 116, 144, 0.55);
  box-shadow:
    0 0 0 4px rgba(14, 116, 144, 0.12),
    0 24px 52px rgba(15, 23, 42, 0.16);
}

.yj-chat-widget svg {
  width: 30px;
  height: 30px;
  display: block;
}

.yj-chat-shell {
  position: fixed;
  right: 2rem;
  bottom: 2rem;
  width: min(400px, calc(100vw - 2rem));
  height: min(500px, calc(100vh - 3rem));
  display: none;
  flex-direction: column;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  z-index: 9999;
}

.yj-chat-shell.is-open {
  display: flex;
}

.yj-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  background: #1e3a8a;
  color: #fff;
}

.yj-chat-header strong {
  font-size: 1rem;
  font-weight: 700;
}

.yj-chat-close {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}

.yj-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  background: #fff;
}

.yj-chat-message {
  margin-bottom: 1rem;
}

.yj-chat-message--user {
  text-align: right;
}

.yj-chat-bubble {
  display: inline-block;
  max-width: 78%;
  padding: 0.75rem;
  border-radius: 10px;
  word-break: break-word;
  white-space: pre-wrap;
  text-align: left;
  font-size: 14px;
  line-height: 1.5;
}

.yj-chat-message--assistant .yj-chat-bubble {
  background: #f5f5f5;
  color: #111827;
}

.yj-chat-message--user .yj-chat-bubble {
  background: #e3f2fd;
  color: #111827;
}

.yj-chat-typing .yj-chat-bubble {
  color: #6b7280;
}

.yj-chat-input-row {
  display: flex;
  gap: 0.5rem;
  padding: 1rem;
  border-top: 1px solid #eee;
  background: #fff;
}

.yj-chat-input {
  flex: 1;
  min-width: 0;
  padding: 0.75rem 0.9rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
}

.yj-chat-input:focus {
  border-color: #1e3a8a;
  box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.12);
}

.yj-chat-button {
  border: 0;
  border-radius: 8px;
  padding: 0 1rem;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.yj-chat-button--primary {
  background: #1e3a8a;
  color: #fff;
}

.yj-chat-button--secondary {
  background: #f3f4f6;
  color: #111827;
}

.yj-chat-button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.yj-chat-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(17, 24, 39, 0.45);
  z-index: 10000;
}

.yj-chat-modal.is-open {
  display: flex;
}

.yj-chat-modal-card {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.2);
  padding: 1rem;
}

.yj-chat-modal-card h3 {
  margin: 0 0 1rem;
  font-size: 18px;
  line-height: 1.3;
}

.yj-chat-field {
  margin-bottom: 0.85rem;
}

.yj-chat-field label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 13px;
  color: #374151;
}

.yj-chat-field input {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
}

.yj-chat-field input:focus {
  border-color: #1e3a8a;
  box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.12);
}

.yj-chat-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}

.yj-chat-toast-wrap {
  position: fixed;
  right: 2rem;
  bottom: 6.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 10001;
}

.yj-chat-toast {
  min-width: 240px;
  max-width: min(320px, calc(100vw - 2rem));
  padding: 0.85rem 1rem;
  border-radius: 10px;
  color: #fff;
  font-size: 14px;
  line-height: 1.5;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
}

.yj-chat-toast--success {
  background: #047857;
}

.yj-chat-toast--error {
  background: #b91c1c;
}

.yj-chat-toast--warning {
  background: #b45309;
}

@media (max-width: 640px) {
  .yj-chat-widget,
  .yj-chat-shell {
    right: 1rem;
    bottom: 1rem;
  }

  .yj-chat-shell {
    width: calc(100vw - 2rem);
    height: calc(100vh - 2rem);
  }

  .yj-chat-toast-wrap {
    right: 1rem;
    bottom: 5.5rem;
  }

  .yj-chat-input-row {
    flex-wrap: wrap;
  }

  .yj-chat-button {
    min-height: 42px;
  }
}
