/* OmniAgent Chat Widget — standalone embeddable styles */
:root {
  --omni-primary: #1f93ff;
  --omni-primary-dark: #1677cc;
  --omni-bg: #ffffff;
  --omni-text: #1a1a2e;
  --omni-text-secondary: #6b7280;
  --omni-border: #e5e7eb;
  --omni-bubble-agent: #f3f4f6;
  --omni-bubble-user: #1f93ff;
  --omni-shadow: 0 8px 32px rgba(0,0,0,0.12);
  --omni-radius: 16px;
  --omni-transition: 0.25s cubic-bezier(0.4,0,0.2,1);
}

/* ── Floating Button ── */
.omni-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999999;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--omni-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: var(--omni-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--omni-transition), background var(--omni-transition);
  font-size: 28px;
}
.omni-launcher:hover { transform: scale(1.08); background: var(--omni-primary-dark); }
.omni-launcher--active { transform: scale(0.8); opacity: 0; pointer-events: none; }

.omni-launcher__badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  background: #ef4444;
  border-radius: 50%;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  display: none;
}

/* ── Chat Window ── */
.omni-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  z-index: 999998;
  width: 380px;
  height: 560px;
  max-height: calc(100vh - 120px);
  background: var(--omni-bg);
  border-radius: var(--omni-radius);
  box-shadow: var(--omni-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  animation: omniSlideIn 0.3s cubic-bezier(0.4,0,0.2,1);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  font-size: 14px;
  color: var(--omni-text);
}

@keyframes omniSlideIn {
  from { opacity: 0; transform: translateY(16px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes omniShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.omni-window--shake {
  animation: omniShake 0.5s ease-in-out;
}

.omni-red-packet {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
}

.omni-shake-tip {
  color: #6b7280;
  font-style: italic;
}

.omni-news-cap {
  font-size: 11px;
  color: #909399;
  margin-bottom: 6px;
}
.omni-news-card {
  display: flex;
  gap: 8px;
  padding: 8px;
  border: 1px solid #ebeef5;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  margin-bottom: 6px;
  background: #fff;
}
.omni-news-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 6px;
}
.omni-news-title {
  font-weight: 600;
  font-size: 13px;
}
.omni-news-desc {
  font-size: 12px;
  color: #6b7280;
  margin-top: 2px;
}

/* ── Header ── */
.omni-header {
  padding: 16px 20px;
  background: var(--omni-primary);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.omni-header__avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.omni-header__info { flex: 1; min-width: 0; }
.omni-header__title { font-weight: 600; font-size: 15px; }
.omni-header__subtitle { font-size: 12px; opacity: 0.85; }
.omni-header__close {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.15);
  color: #fff;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--omni-transition);
}
.omni-header__close:hover { background: rgba(255,255,255,0.3); }

/* ── Body ── */
.omni-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: #f9fafb;
}

/* ── Pre-chat Form ── */
.omni-prechat {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8px;
}
.omni-prechat__title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--omni-text);
}
.omni-prechat__subtitle {
  font-size: 13px;
  color: var(--omni-text-secondary);
  margin-bottom: 20px;
}
.omni-prechat__field {
  margin-bottom: 14px;
}
.omni-prechat__label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--omni-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.omni-prechat__input,
.omni-prechat__select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--omni-border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  box-sizing: border-box;
  transition: border-color var(--omni-transition);
  background: #fff;
  outline: none;
}
.omni-prechat__input:focus,
.omni-prechat__select:focus {
  border-color: var(--omni-primary);
  box-shadow: 0 0 0 3px rgba(31,147,255,0.1);
}
.omni-prechat__submit {
  width: 100%;
  padding: 12px;
  background: var(--omni-primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  transition: background var(--omni-transition);
}
.omni-prechat__submit:hover { background: var(--omni-primary-dark); }
.omni-prechat__submit:disabled { opacity: 0.6; cursor: not-allowed; }

.omni-prechat__departments {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}
.omni-dept-card {
  padding: 14px 10px;
  border: 2px solid var(--omni-border);
  border-radius: 12px;
  text-align: center;
  cursor: pointer;
  transition: all var(--omni-transition);
  background: #fff;
}
.omni-dept-card:hover { border-color: var(--omni-primary); background: #f0f7ff; }
.omni-dept-card--selected { border-color: var(--omni-primary); background: #e8f4fd; }
.omni-dept-card__icon { font-size: 24px; margin-bottom: 4px; }
.omni-dept-card__name { font-size: 12px; font-weight: 600; color: var(--omni-text); }
.omni-dept-card__desc { font-size: 10px; color: var(--omni-text-secondary); margin-top: 2px; }

/* ── Messages ── */
.omni-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.omni-message {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
}
.omni-message--user { align-items: flex-end; }
.omni-message--agent { align-items: flex-start; }
.omni-message--system { align-items: center; }

.omni-message__bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.5;
  word-break: break-word;
  position: relative;
}
.omni-message--user .omni-message__bubble {
  background: var(--omni-bubble-user);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.omni-message--agent .omni-message__bubble {
  background: var(--omni-bubble-agent);
  color: var(--omni-text);
  border-bottom-left-radius: 4px;
}
.omni-message--system .omni-message__bubble {
  background: transparent;
  color: var(--omni-text-secondary);
  font-size: 12px;
  padding: 4px 8px;
}
.omni-message__time {
  font-size: 10px;
  opacity: 0.6;
  margin-top: 2px;
  padding: 0 4px;
}

.omni-typing {
  display: none;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  margin-bottom: 8px;
}
.omni-typing--visible { display: flex; }
.omni-typing__dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #9ca3af;
  animation: omniBounce 1.4s infinite ease-in-out both;
}
.omni-typing__dot:nth-child(1) { animation-delay: -0.32s; }
.omni-typing__dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes omniBounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* ── Input Area ── */
.omni-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--omni-border);
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
  background: var(--omni-bg);
}
.omni-footer__input {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid var(--omni-border);
  border-radius: 22px;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  resize: none;
  max-height: 100px;
  transition: border-color var(--omni-transition);
  line-height: 1.4;
}
.omni-footer__input:focus { border-color: var(--omni-primary); }
.omni-footer__send {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--omni-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--omni-transition);
}
.omni-footer__send:hover { background: var(--omni-primary-dark); }
.omni-footer__send:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Responsive ── */
@media (max-width: 480px) {
  .omni-window {
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    bottom: 0;
    right: 0;
    border-radius: 0;
  }
  .omni-launcher { bottom: 16px; right: 16px; }
}

/* ── Status / System ── */
.omni-status {
  text-align: center;
  padding: 20px;
  color: var(--omni-text-secondary);
}
.omni-spinner {
  width: 24px; height: 24px;
  border: 3px solid var(--omni-border);
  border-top-color: var(--omni-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }
