:root {
  --eh-agent-bg: #ffffff;
  --eh-agent-surface: #f7fbff;
  --eh-agent-surface-2: #eef7ff;
  --eh-agent-text: #16324a;
  --eh-agent-muted: #6c86a0;
  --eh-agent-border: #d7e8f7;
  --eh-agent-accent: #62b7ff;
  --eh-agent-accent-2: #33a1ff;
  --eh-agent-accent-3: #0d8bff;
  --eh-agent-accent-soft: #e7f4ff;
  --eh-agent-user: linear-gradient(135deg, #67c1ff 0%, #2ea4ff 100%);
  --eh-agent-shadow: 0 22px 60px rgba(29, 92, 140, 0.18);
  --eh-agent-shadow-soft: 0 12px 30px rgba(29, 92, 140, 0.12);
}

#enghome-agent-root,
#enghome-agent-root * {
  box-sizing: border-box;
}

#enghome-agent-root {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 2147483000;
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.4;
  color: var(--eh-agent-text);
}

.eh-agent-launcher {
  width: 68px;
  height: 68px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #79cbff 0%, #2ea4ff 55%, #0d8bff 100%);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 18px 35px rgba(15, 130, 225, 0.35);
  display: grid;
  place-items: center;
  position: relative;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.eh-agent-launcher:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 22px 42px rgba(15, 130, 225, 0.42);
}

.eh-agent-launcher:focus-visible,
.eh-agent-panel button:focus-visible,
.eh-agent-panel input:focus-visible,
.eh-agent-panel a:focus-visible {
  outline: 3px solid rgba(51, 161, 255, 0.35);
  outline-offset: 2px;
}

.eh-agent-launcher-icon {
  width: 34px;
  height: 34px;
  display: block;
}

.eh-agent-launcher-pulse {
  position: absolute;
  right: 6px;
  top: 6px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #7dffae;
  border: 2px solid #fff;
  box-shadow: 0 0 0 0 rgba(125, 255, 174, 0.65);
  animation: ehAgentPulse 1.9s infinite;
}

@keyframes ehAgentPulse {
  0% { box-shadow: 0 0 0 0 rgba(125, 255, 174, 0.65); }
  70% { box-shadow: 0 0 0 10px rgba(125, 255, 174, 0); }
  100% { box-shadow: 0 0 0 0 rgba(125, 255, 174, 0); }
}

.eh-agent-panel {
  position: absolute;
  right: 0;
  bottom: 82px;
  width: min(410px, calc(100vw - 28px));
  height: min(690px, calc(100vh - 120px));
  min-height: 500px;
  background: var(--eh-agent-bg);
  border: 1px solid var(--eh-agent-border);
  border-radius: 24px;
  box-shadow: var(--eh-agent-shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(14px) scale(0.98);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.eh-agent-panel.eh-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.eh-agent-header {
  background: linear-gradient(135deg, #dff1ff 0%, #8dcfff 45%, #53b2ff 100%);
  color: #0e3558;
  padding: 16px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.4);
}

.eh-agent-logo {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 14px;
  background: rgba(255,255,255,0.72);
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.55);
}

.eh-agent-logo svg {
  width: 24px;
  height: 24px;
  color: #148ef5;
}

.eh-agent-heading {
  min-width: 0;
  flex: 1;
}

.eh-agent-title {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.eh-agent-status {
  margin: 2px 0 0;
  color: #2d628f;
  font-size: 12px;
}

.eh-agent-lang,
.eh-agent-close {
  border: 1px solid rgba(255,255,255,0.45);
  background: rgba(255,255,255,0.55);
  color: #0f4f86;
  cursor: pointer;
  backdrop-filter: blur(4px);
}

.eh-agent-lang {
  min-width: 40px;
  height: 32px;
  border-radius: 11px;
  font-size: 11px;
  font-weight: 800;
}

.eh-agent-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
}

.eh-agent-messages {
  flex: 1;
  overflow-y: auto;
  padding: 15px 13px 18px;
  scroll-behavior: smooth;
  background:
    radial-gradient(circle at top right, rgba(126, 205, 255, 0.18), transparent 25%),
    linear-gradient(180deg, #fbfdff 0%, #f3f9ff 100%);
}

.eh-agent-message {
  display: flex;
  margin: 0 0 11px;
}

.eh-agent-message.eh-user {
  justify-content: flex-end;
}

.eh-agent-bubble {
  max-width: 84%;
  padding: 11px 13px;
  border-radius: 17px;
  font-size: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  box-shadow: var(--eh-agent-shadow-soft);
}

.eh-agent-message.eh-assistant .eh-agent-bubble {
  background: #fff;
  border: 1px solid #dfedf9;
  border-bottom-left-radius: 6px;
  color: var(--eh-agent-text);
}

.eh-agent-message.eh-user .eh-agent-bubble {
  background: var(--eh-agent-user);
  color: #fff;
  border-bottom-right-radius: 6px;
}

.eh-agent-typing .eh-agent-bubble {
  color: var(--eh-agent-muted);
  font-style: italic;
}

.eh-agent-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 6px 0 14px;
}

.eh-agent-chip {
  border: 1px solid #d6eafb;
  border-radius: 999px;
  padding: 8px 11px;
  background: #fff;
  color: #1f5d8d;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 160ms ease;
}

.eh-agent-chip:hover {
  border-color: var(--eh-agent-accent-2);
  background: #edf7ff;
  color: #117adb;
  transform: translateY(-1px);
}

.eh-agent-products {
  display: grid;
  gap: 11px;
  margin: 5px 0 15px;
}

.eh-agent-product {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 11px;
  padding: 10px;
  border: 1px solid #dcecf9;
  border-radius: 16px;
  background: rgba(255,255,255,0.94);
  box-shadow: 0 10px 24px rgba(41, 119, 178, 0.08);
}

.eh-agent-product-image-wrap {
  width: 88px;
  height: 96px;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(180deg, #f4fbff 0%, #e8f5ff 100%);
  display: grid;
  place-items: center;
}

.eh-agent-product-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.eh-agent-image-fallback {
  font-size: 28px;
  color: #1594ff;
}

.eh-agent-product-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.eh-agent-product-name {
  margin: 1px 0 5px;
  font-size: 13px;
  line-height: 1.35;
  font-weight: 800;
  color: #1b3e5b;
}

.eh-agent-product-meta {
  margin: 0 0 6px;
  color: var(--eh-agent-muted);
  font-size: 11px;
}

.eh-agent-price-row {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin: auto 0 9px;
}

.eh-agent-price {
  font-size: 15px;
  font-weight: 900;
  color: #0d7fe2;
}

.eh-agent-old-price {
  color: #8ea2b6;
  font-size: 11px;
  text-decoration: line-through;
}

.eh-agent-actions {
  display: flex;
  gap: 7px;
}

.eh-agent-view,
.eh-agent-cart {
  min-height: 34px;
  border-radius: 11px;
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: all 160ms ease;
}

.eh-agent-view {
  flex: 1;
  border: 1px solid #b9dcf8;
  color: #197fd7;
  background: #f4fbff;
}

.eh-agent-view:hover {
  background: #eaf6ff;
  border-color: #93cbf5;
}

.eh-agent-cart {
  flex: 1.2;
  border: 1px solid #1391fb;
  color: #fff;
  background: linear-gradient(135deg, #58bbff 0%, #1494fd 100%);
}

.eh-agent-cart:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(20, 148, 253, 0.28);
}

.eh-agent-cart[disabled] {
  opacity: 0.6;
  cursor: progress;
}

.eh-agent-form {
  border-top: 1px solid #ddebf7;
  padding: 11px;
  background: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.eh-agent-input {
  min-width: 0;
  flex: 1;
  height: 45px;
  border: 1px solid #d2e6f6;
  border-radius: 14px;
  padding: 0 14px;
  color: #234763;
  background: #fafdff;
  font-size: 14px;
}

.eh-agent-input::placeholder {
  color: #8ea8bd;
}

.eh-agent-send {
  width: 45px;
  height: 45px;
  flex: 0 0 45px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, #61beff 0%, #1391fb 100%);
  color: #fff;
  font-size: 19px;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(20, 148, 253, 0.22);
}

.eh-agent-send[disabled] {
  opacity: 0.55;
  cursor: wait;
}

.eh-agent-note {
  padding: 0 12px 10px;
  margin: 0;
  background: #fff;
  color: #8fa2b3;
  font-size: 10px;
  text-align: center;
}

.eh-agent-toast {
  position: absolute;
  left: 50%;
  bottom: 74px;
  transform: translateX(-50%) translateY(10px);
  width: max-content;
  max-width: calc(100% - 30px);
  padding: 10px 13px;
  border-radius: 12px;
  background: rgba(18, 62, 98, 0.95);
  color: #fff;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.eh-agent-toast.eh-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 600px) {
  #enghome-agent-root {
    right: 12px;
    bottom: 12px;
  }

  .eh-agent-panel {
    position: fixed;
    inset: 8px;
    width: auto;
    height: auto;
    min-height: 0;
    border-radius: 18px;
  }

  .eh-agent-launcher {
    width: 60px;
    height: 60px;
  }

  .eh-agent-launcher-icon {
    width: 30px;
    height: 30px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .eh-agent-panel,
  .eh-agent-launcher,
  .eh-agent-toast,
  .eh-agent-chip,
  .eh-agent-cart,
  .eh-agent-view {
    transition: none;
    animation: none;
  }
}
