/* Sizo consultant debug help chat widget */
#debug-help-chat {
  --dhc-primary: #0d6efd;
  --dhc-bg: #ffffff;
  --dhc-muted: #6c757d;
  --dhc-border: #e9ecef;
  --dhc-assistant: #f1f3f5;
  --dhc-user: #0d6efd;
  --dhc-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  z-index: 1055;
}

#debug-help-chat[hidden] {
  display: none !important;
}

.dhc-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1056;
  display: flex;
  align-items: center;
  gap: 8px;
  border: none;
  border-radius: 999px;
  background: var(--dhc-primary);
  color: #fff;
  padding: 12px 18px;
  box-shadow: var(--dhc-shadow);
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
}

.dhc-fab:hover {
  filter: brightness(1.05);
}

.dhc-fab-icon {
  display: inline-flex;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  font-weight: 700;
}

.dhc-panel {
  position: fixed;
  right: 20px;
  bottom: 78px;
  width: min(380px, calc(100vw - 24px));
  height: min(560px, calc(100vh - 100px));
  z-index: 1057;
  background: var(--dhc-bg);
  border-radius: 14px;
  box-shadow: var(--dhc-shadow);
  border: 1px solid var(--dhc-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.dhc-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 12px 14px;
  background: #0b5ed7;
  color: #fff;
}

.dhc-header-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dhc-sub {
  font-size: 12px;
  opacity: 0.9;
}

.dhc-icon-btn {
  border: none;
  background: transparent;
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.dhc-customer-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #eef5ff;
  border-bottom: 1px solid var(--dhc-border);
  font-size: 12px;
  color: #212529;
}

.dhc-customer-strip[hidden] {
  display: none !important;
}

.dhc-link-btn {
  border: none;
  background: none;
  color: var(--dhc-primary);
  cursor: pointer;
  font-size: 12px;
  text-decoration: underline;
  padding: 0;
  white-space: nowrap;
}

.dhc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  background: #f8f9fa;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dhc-msg {
  max-width: 88%;
  padding: 8px 12px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}

.dhc-msg.user {
  align-self: flex-end;
  background: var(--dhc-user);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.dhc-msg.assistant,
.dhc-msg.system {
  align-self: flex-start;
  background: var(--dhc-assistant);
  color: #212529;
  border: 1px solid var(--dhc-border);
  border-bottom-left-radius: 4px;
}

.dhc-msg.agent {
  align-self: flex-start;
  background: #198754;
  color: #fff;
  border-bottom-left-radius: 4px;
}

.dhc-msg.system {
  background: #fff8e6;
  border-color: #ffe8a1;
  color: #212529;
}

.dhc-live-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #d1e7dd;
  border-bottom: 1px solid #badbcc;
  font-size: 12px;
  color: #0f5132;
  font-weight: 600;
}

.dhc-live-banner[hidden] {
  display: none !important;
}

.dhc-footer-actions {
  padding: 8px 10px 0;
  background: #fff;
}

.dhc-footer-actions[hidden] {
  display: none !important;
}

.dhc-contact-agent {
  width: 100%;
  border: 1px solid #0d6efd;
  background: #fff;
  color: #0d6efd;
  border-radius: 8px;
  padding: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.dhc-contact-agent:hover {
  background: #0d6efd;
  color: #fff;
}

.dhc-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 10px 0;
  background: #fff;
}

.dhc-chips[hidden] {
  display: none !important;
}

.dhc-chip {
  border: 1px solid var(--dhc-border);
  background: #fff;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  cursor: pointer;
  color: #343a40;
}

.dhc-chip:hover {
  border-color: var(--dhc-primary);
  color: var(--dhc-primary);
}

.dhc-form {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--dhc-border);
  background: #fff;
  align-items: flex-end;
}

.dhc-compose {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.dhc-input {
  width: 100%;
  border: 1px solid #ced4da;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
}

.dhc-input:focus {
  outline: none;
  border-color: #86b7fe;
  box-shadow: 0 0 0 0.15rem rgba(13, 110, 253, 0.2);
}

.dhc-attach-btn {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border: 1px solid #ced4da;
  border-radius: 8px;
  background: #fff;
  color: #495057;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.dhc-attach-btn:hover:not(:disabled) {
  border-color: var(--dhc-primary);
  color: var(--dhc-primary);
}

.dhc-attach-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.dhc-file-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  background: #e7f1ff;
  color: #0b5ed7;
  border-radius: 6px;
  padding: 3px 8px;
  max-width: 100%;
}

.dhc-file-chip[hidden] {
  display: none !important;
}

.dhc-file-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.dhc-file-chip-clear {
  border: none;
  background: transparent;
  color: inherit;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}

.dhc-msg-body {
  white-space: pre-wrap;
  word-break: break-word;
}

.dhc-msg-attach {
  margin-top: 6px;
}

.dhc-msg-attach img {
  display: block;
  max-width: min(240px, 100%);
  max-height: 180px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  cursor: pointer;
  background: #fff;
}

.dhc-msg.user .dhc-msg-attach img {
  border-color: rgba(255, 255, 255, 0.35);
}

.dhc-msg-file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: rgba(255, 255, 255, 0.9);
  color: #0d6efd;
  max-width: 100%;
}

.dhc-msg.user .dhc-msg-file {
  border-color: rgba(255, 255, 255, 0.4);
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
}

.dhc-msg-file span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dhc-send {
  border: none;
  background: var(--dhc-primary);
  color: #fff;
  border-radius: 8px;
  padding: 8px 12px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  height: 38px;
}

.dhc-send:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.dhc-typing {
  font-size: 12px;
  color: var(--dhc-muted);
  font-style: italic;
}

/* Confirm / notice modal */
.dhc-modal {
  position: fixed;
  inset: 0;
  z-index: 1060;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.dhc-modal[hidden] {
  display: none !important;
}

.dhc-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  animation: dhc-fade-in 0.18s ease;
}

.dhc-modal-card {
  position: relative;
  z-index: 1;
  width: min(360px, 100%);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.22);
  padding: 22px 20px 18px;
  text-align: center;
  animation: dhc-pop-in 0.2s ease;
  border: 1px solid #e9ecef;
}

.dhc-modal-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background: linear-gradient(145deg, #e8f1ff, #f0f7ff);
  border: 1px solid #d6e6ff;
}

.dhc-modal-icon.is-warning {
  background: linear-gradient(145deg, #fff4e5, #fff8ef);
  border-color: #ffe0b2;
}

.dhc-modal-icon.is-danger {
  background: linear-gradient(145deg, #fdecec, #fff5f5);
  border-color: #f5c2c7;
}

.dhc-modal-title {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.3;
}

.dhc-modal-body {
  margin: 0 0 18px;
  font-size: 13px;
  line-height: 1.5;
  color: #64748b;
}

.dhc-modal-actions {
  display: flex;
  gap: 8px;
  justify-content: stretch;
}

.dhc-modal-btn {
  flex: 1;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.dhc-modal-btn-ghost {
  background: #f1f5f9;
  color: #475569;
}

.dhc-modal-btn-ghost:hover {
  background: #e2e8f0;
}

.dhc-modal-btn-primary {
  background: #0d6efd;
  color: #fff;
  box-shadow: 0 4px 12px rgba(13, 110, 253, 0.28);
}

.dhc-modal-btn-primary:hover {
  background: #0b5ed7;
}

.dhc-modal-btn-primary.is-danger {
  background: #dc3545;
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.25);
}

.dhc-modal-btn-primary.is-danger:hover {
  background: #bb2d3b;
}

.dhc-modal.is-alert .dhc-modal-btn-ghost {
  display: none;
}

.dhc-modal.is-alert .dhc-modal-btn-primary {
  flex: 1;
}

@keyframes dhc-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes dhc-pop-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
