/* Support Chat Widget - MIRAGESTEP SNEAKERS */
:root {
  --hs-primary: #059669;
  --hs-primary-soft: #dcfce7;
  --hs-primary-soft-strong: #bbf7d0;
  --hs-text: #111827;
  --hs-muted: #6b7280;
  --hs-border: #e5e7eb;
  --hs-bg: #f3f4f6;
  --hs-radius-full: 999px;
}

/* Nút tròn mở menu */
.hs-chatbot-toggle {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 56px;
  height: 56px;
  border-radius: var(--hs-radius-full);
  border: none;
  cursor: pointer;
  background: radial-gradient(
    circle at 0 0,
    #bbf7d0,
    #22c55e 35%,
    #16a34a 65%,
    #15803d 100%
  );
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.3);
  transition: transform 0.14s ease, box-shadow 0.14s ease, opacity 0.14s ease;
}

.hs-chatbot-toggle span {
  font-size: 22px;
  color: #ffffff;
}

.hs-chatbot-toggle:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 22px 55px rgba(15, 23, 42, 0.4);
}

.hs-chatbot-toggle:active {
  transform: translateY(0) scale(0.97);
  opacity: 0.9;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.3);
}

/* ===== ACTION MENU (LISTVIEW CÁC KÊNH HỖ TRỢ) ===== */
.hs-chatbot-actions {
  position: fixed;
  right: 18px;
  bottom: 86px;
  display: none;
  z-index: 9998;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

.hs-chatbot-actions-card {
  position: relative;
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.22);
  border: 1px solid var(--hs-border);
  overflow: hidden;
  min-width: 250px;
}

.hs-chatbot-actions-header {
  padding: 10px 16px 8px;
  border-bottom: 1px solid #e5e7eb;
  background: linear-gradient(
    135deg,
    rgba(34, 197, 94, 0.1),
    rgba(59, 130, 246, 0.02)
  );
}

.hs-chatbot-actions-header strong {
  font-size: 0.9rem;
  color: var(--hs-text);
}

.hs-chatbot-actions-header span {
  display: block;
  margin-top: 2px;
  font-size: 0.76rem;
  color: var(--hs-muted);
}

.hs-chatbot-actions-card::after {
  content: "";
  position: absolute;
  bottom: -10px;
  right: 18px;
  width: 18px;
  height: 18px;
  background: #ffffff;
  transform: rotate(45deg);
  border-left: 1px solid var(--hs-border);
  border-bottom: 1px solid var(--hs-border);
  box-shadow: 6px 6px 18px rgba(15, 23, 42, 0.18);
  z-index: -1;
}

.hs-chatbot-actions-list {
  padding: 4px 0;
}

.hs-chatbot-actions-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  font: inherit;
  color: var(--hs-text);
  transition: background 0.12s ease, transform 0.12s ease, box-shadow 0.12s ease;
}

.hs-chatbot-actions-item + .hs-chatbot-actions-item {
  border-top: 1px solid #f3f4f6;
}

.hs-chatbot-actions-item:hover {
  background: #f9fafb;
  transform: translateY(-1px);
  box-shadow: inset 4px 0 0 var(--hs-primary-soft-strong);
}

.hs-chatbot-actions-item.is-primary {
  background: #f0fdf4;
}

.hs-chatbot-actions-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--hs-radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
}

.hs-chatbot-actions-icon.chat {
  background: #dcfce7;
  color: #166534;
}

.hs-chatbot-actions-icon.messenger {
  background: #e0f2fe;
  color: #0369a1;
}

.hs-chatbot-actions-icon.zalo {
  background: #e0ecff;
  color: #1d4ed8;
}

.hs-chatbot-actions-icon.phone {
  background: #fee2e2;
  color: #b91c1c;
}

.hs-chatbot-actions-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hs-chatbot-actions-text .title {
  font-size: 0.88rem;
  font-weight: 600;
}

.hs-chatbot-actions-text .subtitle {
  font-size: 0.76rem;
  color: var(--hs-muted);
}

/* ===== PANEL CHATBOT ===== */
.hs-chatbot-panel {
  position: fixed;
  right: 18px;
  bottom: 88px;
  width: 360px;
  max-height: 520px;
  display: none;
  flex-direction: column;
  border-radius: 18px;
  background: #ffffff;
  border: 1px solid var(--hs-border);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
  overflow: hidden;
  z-index: 9997;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

.hs-chatbot-header {
  padding: 10px 14px 8px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #059669, #16a34a);
  color: #f9fafb;
}

.hs-chatbot-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hs-chatbot-avatar {
  width: 32px;
  height: 32px;
  border-radius: 12px;
  background: #ecfdf5;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #065f46;
  font-weight: 700;
  font-size: 15px;
}

.hs-chatbot-header-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hs-chatbot-header-text strong {
  font-size: 0.92rem;
}

.hs-chatbot-status-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: 0.76rem;
  opacity: 0.95;
}

.hs-chatbot-status-dot {
  width: 7px;
  height: 7px;
  border-radius: var(--hs-radius-full);
  background: #bbf7d0;
  box-shadow: 0 0 0 4px rgba(187, 247, 208, 0.35);
}

.hs-chatbot-close {
  border: none;
  background: rgba(15, 23, 42, 0.1);
  color: #e5e7eb;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--hs-radius-full);
  transition: background 0.12s ease, transform 0.12s ease, opacity 0.12s ease;
}

.hs-chatbot-close:hover {
  background: rgba(15, 23, 42, 0.18);
  transform: scale(1.03);
}

.hs-chatbot-close:active {
  opacity: 0.85;
  transform: scale(0.96);
}

.hs-chatbot-body {
  padding: 10px 10px 8px;
  background: #f9fafb;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
}

.hs-chatbot-body::-webkit-scrollbar {
  width: 6px;
}

.hs-chatbot-body::-webkit-scrollbar-track {
  background: transparent;
}

.hs-chatbot-body::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}

.hs-chatbot-body::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.hs-chatbot-hint {
  font-size: 0.76rem;
  color: var(--hs-muted);
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px dashed #e5e7eb;
  background: #f3f4ff;
}

.hs-chatbot-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 6px 3px 4px 2px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: thin;
}

.hs-chatbot-messages::-webkit-scrollbar {
  width: 6px;
}

.hs-chatbot-messages::-webkit-scrollbar-track {
  background: transparent;
}

.hs-chatbot-messages::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}

.hs-chatbot-msg {
  max-width: 82%;
  padding: 8px 11px;
  border-radius: 14px;
  font-size: 0.86rem;
  line-height: 1.5;
  display: inline-block;
  word-wrap: break-word;
}

.hs-chatbot-msg-text {
  white-space: pre-wrap;
}

.hs-chatbot-msg-meta {
  margin-top: 2px;
  font-size: 0.7rem;
  color: #9ca3af;
}

.hs-chatbot-msg.bot {
  align-self: flex-start;
  background: #f3f4f6;
  color: var(--hs-text);
  border-bottom-left-radius: 4px;
}

.hs-chatbot-msg.bot .hs-chatbot-msg-meta {
  text-align: left;
}

.hs-chatbot-msg.user {
  align-self: flex-end;
  background: #059669;
  color: #ecfdf5;
  border-bottom-right-radius: 4px;
}

.hs-chatbot-msg.user .hs-chatbot-msg-meta {
  text-align: right;
  color: rgba(236, 253, 245, 0.8);
}

.hs-chatbot-msg.admin {
  align-self: flex-start;
  background: #0f172a;
  color: #f9fafb;
  border-bottom-left-radius: 4px;
}

.hs-chatbot-msg.admin .hs-chatbot-msg-meta {
  text-align: left;
  color: rgba(249, 250, 251, 0.7);
}

.hs-chatbot-footer {
  padding: 8px 9px 10px;
  border-top: 1px solid #e5e7eb;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hs-chatbot-suggest {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.hs-chatbot-suggest button {
  border-radius: var(--hs-radius-full);
  border: 1px solid #e5e7eb;
  padding: 4px 9px;
  font-size: 0.76rem;
  background: #ffffff;
  cursor: pointer;
  color: var(--hs-text);
  transition: background 0.12s ease, border-color 0.12s ease,
    transform 0.12s ease;
}

.hs-chatbot-suggest button:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
  transform: translateY(-0.5px);
}

.hs-chatbot-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hs-chatbot-input-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f9fafb;
  border-radius: var(--hs-radius-full);
  border: 1px solid #e5e7eb;
  padding: 3px 10px;
}

.hs-chatbot-input {
  flex: 1;
  border-radius: var(--hs-radius-full);
  border: none;
  padding: 6px 0;
  font-size: 0.85rem;
  outline: none;
  background: transparent;
  color: var(--hs-text);
}

.hs-chatbot-input::placeholder {
  color: #9ca3af;
}

.hs-chatbot-send {
  border-radius: var(--hs-radius-full);
  border: none;
  padding: 7px 13px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--hs-primary);
  color: #ecfdf5;
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease,
    background 0.12s ease;
  box-shadow: 0 8px 22px rgba(5, 150, 105, 0.4);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.hs-chatbot-send span.icon {
  font-size: 13px;
}

.hs-chatbot-send:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(5, 150, 105, 0.6);
  background: #047857;
}

.hs-chatbot-send:active {
  transform: translateY(0) scale(0.97);
  box-shadow: none;
  opacity: 0.95;
}

.hs-chatbot-send:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Link "Chat với nhân viên" */
.hs-agent-link {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #e5e7eb;
}

.hs-agent-link a {
  color: #059669;
  font-size: 0.875rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.2s;
}

.hs-agent-link a:hover {
  color: #047857;
  text-decoration: underline;
}

/* Guest Form Styles */
.hs-chatbot-guest-form {
  padding: 16px;
  background: #ffffff;
  border-radius: 12px;
  margin: 8px 0;
  border: 1px solid var(--hs-border);
  max-height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
}

.hs-guest-form-header {
  margin-bottom: 16px;
}

.hs-guest-form-header strong {
  display: block;
  font-size: 0.95rem;
  color: var(--hs-text);
  margin-bottom: 4px;
  font-weight: 600;
}

.hs-guest-form-header span {
  display: block;
  font-size: 0.78rem;
  color: var(--hs-muted);
  line-height: 1.4;
}

.hs-form-group {
  margin-bottom: 14px;
}

.hs-form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--hs-text);
  margin-bottom: 6px;
}

.hs-form-group .required {
  color: #ef4444;
}

.hs-form-input,
.hs-form-textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--hs-border);
  border-radius: 8px;
  font-size: 0.85rem;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
}

.hs-form-input:focus,
.hs-form-textarea:focus {
  outline: none;
  border-color: #059669;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

.hs-form-textarea {
  resize: vertical;
  min-height: 70px;
  max-height: 120px;
}

.hs-form-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.hs-form-cancel,
.hs-form-submit {
  flex: 1;
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.hs-form-cancel {
  background: #f3f4f6;
  color: var(--hs-text);
}

.hs-form-cancel:hover {
  background: #e5e7eb;
}

.hs-form-submit {
  background: linear-gradient(135deg, #059669, #16a34a);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

.hs-form-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(5, 150, 105, 0.4);
}

.hs-form-submit:active {
  transform: translateY(0);
}

@media (max-width: 480px) {
  .hs-chatbot-panel {
    right: 10px;
    left: 10px;
    bottom: 80px;
    width: auto;
    max-width: calc(100vw - 20px);
    max-height: 70vh;
    border-radius: 16px;
  }

  .hs-chatbot-toggle {
    right: 14px;
    bottom: 14px;
  }

  .hs-chatbot-actions {
    right: 12px;
    bottom: 78px;
    left: 12px;
    max-width: calc(100vw - 24px);
  }
  
  .hs-chatbot-actions-card {
    min-width: auto;
    width: 100%;
    max-width: 100%;
  }
}

/* Ngăn chặn overflow trên màn hình nhỏ hơn */
@media (max-width: 767.98px) {
  .hs-chatbot-panel {
    max-width: calc(100vw - 20px);
  }
  
  .hs-chatbot-actions {
    max-width: calc(100vw - 24px);
  }
}
