/* Floating customer support, intentionally isolated from the video consultant. */
.support-quick-links {
  position: fixed;
  right: 150px;
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 9599;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.support-quick-link {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid #c9e2f4;
  border-radius: 50%;
  background: #fff;
  color: #0b67a3;
  box-shadow: 0 12px 26px rgba(15, 74, 110, .18), 0 0 0 3px rgba(255, 255, 255, .78);
  text-decoration: none;
  font-size: 17px;
  font-weight: 950;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.support-quick-link:hover,
.support-quick-link:focus-visible {
  transform: translateY(-2px);
  border-color: #80c8f0;
  box-shadow: 0 16px 32px rgba(15, 74, 110, .22), 0 0 0 3px rgba(255, 255, 255, .9), 0 0 20px rgba(32, 199, 216, .18);
}

.support-quick-link:focus-visible { outline: 3px solid rgba(14, 165, 233, .35); outline-offset: 3px; }
.support-quick-zalo { color: #0068ff; }
.support-quick-facebook { color: #1877f2; font-family: Arial, sans-serif; font-size: 22px; }
.support-quick-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.support-widget {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 9600;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

.support-widget-panel[hidden],
.support-widget-auth[hidden],
.support-widget-chat[hidden],
.support-widget-typing[hidden],
.support-widget-unread[hidden] { display: none !important; }

.support-widget-launcher {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-width: 112px;
  height: 48px;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: 8px;
  background: #0b172a;
  color: #fff;
  box-shadow: 0 14px 34px rgba(15, 23, 42, .22);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
}

.support-widget-launcher:hover { background: #10213a; }
.support-widget-launcher:focus-visible,
.support-widget-close:focus-visible,
.support-widget-form button:focus-visible,
.support-widget-tab:focus-visible,
.support-widget-attach:focus-visible,
.support-widget-report-attach:focus-visible,
.support-widget-report-actions button:focus-visible { outline: 3px solid rgba(14, 165, 233, .35); outline-offset: 2px; }
.support-widget-launcher-icon { display: flex; align-items: center; gap: 2px; width: 22px; height: 20px; padding: 5px 4px; border: 2px solid currentColor; border-radius: 6px; }
.support-widget-launcher-icon i { display: block; width: 3px; height: 3px; border-radius: 50%; background: currentColor; }
.support-widget-launcher-label { white-space: nowrap; }
.support-widget-unread { position: absolute; top: -8px; right: -7px; display: grid; place-items: center; min-width: 22px; height: 22px; padding: 0 5px; border: 2px solid #fff; border-radius: 999px; background: #dc2626; color: #fff; font-size: 11px; font-weight: 900; }

.support-widget-panel {
  position: absolute;
  right: 0;
  bottom: 60px;
  display: flex;
  flex-direction: column;
  width: min(390px, calc(100vw - 32px));
  height: min(620px, calc(100vh - 110px));
  min-height: 440px;
  overflow: hidden;
  border: 1px solid #dce5ee;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  color: #172033;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .24);
}

.support-widget-head { display: grid; grid-template-columns: 42px minmax(0, 1fr) 34px; align-items: center; gap: 10px; flex: 0 0 auto; min-height: 70px; padding: 12px 13px; border-bottom: 1px solid rgba(255,255,255,.12); background: radial-gradient(circle at 15% 0%, #164e63 0%, transparent 42%), linear-gradient(135deg, #07172e, #0e3b52); color: #fff; }
.support-widget-avatar { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid rgba(255,255,255,.35); border-radius: 13px; background: linear-gradient(135deg, #22d3ee, #0e7490); color: #fff; font-size: 13px; font-weight: 900; box-shadow: 0 8px 20px rgba(8,145,178,.3); }
.support-widget-head strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.support-widget-agent { display: flex; align-items: center; gap: 6px; margin-top: 3px; color: #cbd5e1; font-size: 12px; }
.support-widget-agent::before { content: ""; width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: #22c55e; }
.support-widget-agent[data-mode="human"]::before { background: #f59e0b; }
.support-widget-agent[data-mode="closed"]::before { background: #94a3b8; }
.support-widget-close { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: #cbd5e1; cursor: pointer; font: 400 24px/1 Inter, sans-serif; }
.support-widget-close:hover { background: rgba(255, 255, 255, .1); color: #fff; }

.support-widget-auth { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 0; padding: 28px; text-align: center; }
.support-widget-auth-icon { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 14px; border-radius: 8px; background: #e0f2fe; color: #0369a1; font-size: 22px; font-weight: 900; }
.support-widget-auth strong { font-size: 16px; }
.support-widget-auth p { max-width: 280px; margin: 8px 0 16px; color: #64748b; font-size: 13px; line-height: 1.5; }
.support-widget-auth .primary-btn { min-height: 42px; }

.support-widget-chat { flex: 1; min-height: 0; display: flex; flex-direction: column; background: #f7f9fc; }
.support-widget-tabs { display: flex; gap: 4px; flex: 0 0 auto; padding: 8px 10px 0; border-bottom: 1px solid #dbe4ee; background: #fff; }
.support-widget-tab { position: relative; flex: 1; min-height: 36px; border: 0; border-radius: 9px 9px 0 0; background: transparent; color: #64748b; cursor: pointer; font: 800 12px/1 Inter, sans-serif; transition: color .18s ease, background .18s ease; }
.support-widget-tab:hover { background: #f0f9ff; color: #0369a1; }
.support-widget-tab.is-active { background: #ecfeff; color: #0e7490; }
.support-widget-tab.is-active::after { content: ""; position: absolute; right: 14px; bottom: -1px; left: 14px; height: 3px; border-radius: 999px 999px 0 0; background: linear-gradient(90deg, #06b6d4, #2563eb); }
.support-widget-warning-icon { display: inline-grid; place-items: center; width: 16px; height: 16px; margin-right: 3px; border-radius: 50%; background: #f97316; color: #fff; font: 900 10px/1 Inter, sans-serif; vertical-align: -1px; }
.support-widget-tab-pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.support-widget-tab-pane[hidden] { display: none !important; }
.support-widget-messages { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 15px 13px; scrollbar-width: thin; }
.support-widget-welcome { margin: 0 auto 14px; padding: 8px 10px; color: #64748b; font-size: 12px; line-height: 1.45; text-align: center; }
.support-widget-message { width: fit-content; max-width: 84%; margin: 0 0 11px; }
.support-widget-message.user { margin-left: auto; }
.support-widget-message.ai,
.support-widget-message.admin { margin-right: auto; }
.support-widget-message.system { max-width: 92%; margin: 8px auto; text-align: center; }
.support-widget-message-label { margin: 0 3px 4px; color: #64748b; font-size: 10px; font-weight: 800; }
.support-widget-message.user .support-widget-message-label { text-align: right; }
.support-widget-message-bubble { padding: 10px 12px; border: 1px solid #dbe4ee; border-radius: 14px 14px 14px 5px; background: #fff; color: #1e293b; font-size: 13px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; box-shadow: 0 4px 12px rgba(15,23,42,.04); }
.support-widget-message.user .support-widget-message-bubble { border-color: #0891b2; border-radius: 14px 14px 5px 14px; background: linear-gradient(135deg, #0e7490, #0c4a6e); color: #fff; box-shadow: 0 6px 16px rgba(14,116,144,.2); }
.support-widget-message.admin .support-widget-message-bubble { border-color: #86efac; background: #ecfdf5; }
.support-widget-message.system .support-widget-message-bubble { display: inline-block; border-color: #e2e8f0; background: #eef2f7; color: #475569; font-size: 11px; }
.support-widget-message-time { display: block; margin-top: 4px; color: #94a3b8; font-size: 9px; }
.support-widget-message.user .support-widget-message-time { text-align: right; }

.support-widget-typing { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; padding: 5px 14px 8px; color: #64748b; font-size: 11px; }
.support-widget-typing span { width: 5px; height: 5px; border-radius: 50%; background: #0891b2; animation: support-widget-dot 1.1s infinite ease-in-out; }
.support-widget-typing span:nth-child(2) { animation-delay: .16s; }
.support-widget-typing span:nth-child(3) { animation-delay: .32s; }
.support-widget-typing small { margin-left: 4px; }
@keyframes support-widget-dot { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-4px); opacity: 1; } }

.support-widget-notice { min-height: 0; margin: 0; padding: 0 13px; color: #b91c1c; font-size: 11px; }
.support-widget-notice:not(:empty) { padding-bottom: 8px; }
.support-widget-form { flex: 0 0 auto; padding: 9px 10px 6px; border-top: 1px solid #dbe4ee; background: #fff; }
.support-widget-composer-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) 42px; align-items: end; gap: 7px; }
.support-widget-form textarea { width: 100%; min-height: 42px; max-height: 112px; resize: none; overflow: auto; padding: 10px 11px; border: 1px solid #cbd5e1; border-radius: 12px; background: #fff; color: #172033; font: 400 13px/1.45 Inter, sans-serif; letter-spacing: 0; }
.support-widget-form textarea:focus { outline: 2px solid rgba(8, 145, 178, .18); border-color: #0891b2; }
.support-widget-form button { display: grid; place-items: center; width: 42px; height: 42px; padding: 0; border: 0; border-radius: 12px; background: linear-gradient(135deg, #0891b2, #2563eb); color: #fff; cursor: pointer; font: 700 17px/1 Inter, sans-serif; box-shadow: 0 7px 15px rgba(37,99,235,.2); }
.support-widget-form button:hover { background: #155e75; }
.support-widget-form button:disabled,
.support-widget-form textarea:disabled { opacity: .55; cursor: not-allowed; }
.support-widget-footnote { flex: 0 0 auto; display: block; padding: 0 12px 8px; background: #fff; color: #94a3b8; font-size: 10px; text-align: center; }
.support-widget-file-input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }
.support-widget-attach { display: grid; place-items: center; width: 34px; height: 42px; border: 1px solid #cbd5e1; border-radius: 12px; background: #f8fafc; color: #0e7490; cursor: pointer; font-size: 16px; transition: border-color .18s ease, background .18s ease, transform .18s ease; }
.support-widget-attach:hover, .support-widget-report-attach:hover { border-color: #06b6d4; background: #ecfeff; transform: translateY(-1px); }
.support-widget-paperclip { position: relative; display: inline-block; width: 9px; height: 17px; border: 2px solid currentColor; border-radius: 7px; transform: rotate(42deg); }
.support-widget-paperclip::after { content: ""; position: absolute; top: 2px; left: 2px; width: 3px; height: 9px; border: 1.5px solid currentColor; border-radius: 4px; border-top-color: transparent; }
.support-widget-composer-hint { display: block; margin: 5px 42px 0; color: #94a3b8; font-size: 9px; }
.support-widget-attachment-list { display: flex; flex-wrap: wrap; gap: 6px; max-height: 86px; overflow: auto; margin: 0 0 7px; }
.support-widget-attachment-chip { display: inline-flex; align-items: center; gap: 5px; min-width: 0; max-width: 100%; padding: 4px 6px; border: 1px solid #bae6fd; border-radius: 9px; background: #f0f9ff; color: #0f3b54; font-size: 10px; }
.support-widget-attachment-chip img { width: 26px; height: 26px; object-fit: cover; border-radius: 5px; }
.support-widget-file-chip-icon { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 5px; background: #dbeafe; color: #1d4ed8; font-size: 12px; }
.support-widget-attachment-chip-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.support-widget-attachment-chip-name small { display: block; color: #64748b; font-size: 9px; }
.support-widget-attachment-remove { width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #64748b; cursor: pointer; font-size: 16px; line-height: 1; }
.support-widget-attachment-remove:hover { background: #fee2e2; color: #b91c1c; }
.support-widget-message-attachments { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-top: 8px; }
.support-widget-media { position: relative; min-height: 58px; overflow: hidden; border: 1px solid rgba(148,163,184,.35); border-radius: 9px; background: #eef2f7; }
.support-widget-media img, .support-widget-media video { display: block; width: 100%; max-height: 180px; object-fit: cover; }
.support-widget-media video { background: #0f172a; }
.support-widget-media-loading, .support-widget-media-error { display: grid; min-height: 58px; place-items: center; padding: 8px; color: #64748b; font-size: 10px; text-align: center; }
.support-widget-media-error { color: #b91c1c; }
.support-widget-media-label { display: block; overflow: hidden; padding: 4px 6px; color: #64748b; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.support-widget-message.user .support-widget-media-label { color: #dbeafe; }
.support-widget-report-pane { overflow: auto; padding: 14px 13px 16px; background: linear-gradient(180deg, #f8fbff, #fff); }
.support-widget-report-intro { display: grid; gap: 4px; margin-bottom: 12px; padding: 11px 12px; border: 1px solid #bae6fd; border-radius: 12px; background: linear-gradient(135deg, #ecfeff, #eff6ff); color: #0f3b54; }
.support-widget-report-intro strong { font-size: 13px; }
.support-widget-report-intro span { color: #64748b; font-size: 11px; line-height: 1.45; }
.support-widget-report-form { display: grid; gap: 10px; }
.support-widget-report-form label { display: grid; gap: 5px; color: #334155; font-size: 11px; font-weight: 800; }
.support-widget-report-form input, .support-widget-report-form select, .support-widget-report-form textarea { width: 100%; border: 1px solid #cbd5e1; border-radius: 10px; background: #fff; color: #172033; padding: 9px 10px; font: 400 12px/1.45 Inter, sans-serif; }
.support-widget-report-form textarea { min-height: 102px; resize: vertical; }
.support-widget-report-form input:focus, .support-widget-report-form select:focus, .support-widget-report-form textarea:focus { outline: 2px solid rgba(8,145,178,.18); border-color: #0891b2; }
.support-widget-report-actions { display: flex; align-items: center; gap: 8px; }
.support-widget-report-attach { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 0 10px; border: 1px solid #cbd5e1; border-radius: 10px; background: #f8fafc; color: #0e7490; cursor: pointer; font-size: 11px; font-weight: 800; }
.support-widget-report-actions button { flex: 1; min-height: 38px; border: 0; border-radius: 10px; background: linear-gradient(135deg, #f97316, #dc2626); color: #fff; cursor: pointer; font: 800 11px/1 Inter, sans-serif; box-shadow: 0 7px 15px rgba(220,38,38,.18); }
.support-widget-report-actions button:disabled { opacity: .55; cursor: not-allowed; }
.support-widget-report-status { min-height: 16px; margin: 0; color: #0f766e; font-size: 11px; line-height: 1.4; }
.support-widget-report-status[data-state="error"] { color: #b91c1c; }
.support-widget-report-privacy { color: #94a3b8; font-size: 9px; line-height: 1.4; }

@media (max-width: 640px) {
  .support-quick-links { right: max(68px, calc(env(safe-area-inset-right) + 58px)); bottom: max(10px, env(safe-area-inset-bottom)); gap: 6px; }
  .support-quick-link { width: 42px; height: 42px; }
  .support-widget { right: max(10px, env(safe-area-inset-right)); bottom: max(10px, env(safe-area-inset-bottom)); }
  .support-widget-launcher { min-width: 48px; width: 48px; padding: 0; }
  .support-widget-launcher-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .support-widget-panel { position: fixed; inset: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(68px, calc(env(safe-area-inset-bottom) + 60px)) max(10px, env(safe-area-inset-left)); width: auto; height: auto; min-height: 0; }
  .support-widget-head { min-height: 64px; }
}

@media (prefers-reduced-motion: reduce) {
  .support-widget-typing span { animation: none; }
}
