/* Agent Help — floating chat widget */

.ah-root {
  --ah-bg: #f7f4ef;
  --ah-panel: #ffffff;
  --ah-ink: #1f2a24;
  --ah-muted: #5c6b63;
  --ah-accent: #2f6b4f;
  --ah-accent-soft: #e5f0ea;
  --ah-border: #d8e0db;
  --ah-shadow: 0 12px 40px rgba(31, 42, 36, 0.18);
  --ah-radius: 16px;
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 99999;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ah-ink);
}

.ah-root *,
.ah-root *::before,
.ah-root *::after {
  box-sizing: border-box;
}

.ah-launcher {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  cursor: pointer;
  background: var(--ah-accent);
  color: #fff;
  padding: 12px 16px;
  border-radius: 999px;
  box-shadow: var(--ah-shadow);
  font-weight: 600;
  transition: transform 0.18s ease, background 0.18s ease;
}

.ah-launcher:hover,
.ah-launcher:focus-visible {
  background: #255a41;
  transform: translateY(-1px);
  outline: none;
}

.ah-launcher__icon {
  display: flex;
}

.ah-panel {
  position: absolute;
  right: 0;
  bottom: 64px;
  width: min(380px, calc(100vw - 24px));
  height: min(560px, calc(100vh - 100px));
  background: var(--ah-panel);
  border: 1px solid var(--ah-border);
  border-radius: var(--ah-radius);
  box-shadow: var(--ah-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: ah-rise 0.22s ease;
}

.ah-panel[hidden] {
  display: none !important;
}

@keyframes ah-rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ah-panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(160deg, #edf5f0 0%, var(--ah-bg) 100%);
  border-bottom: 1px solid var(--ah-border);
}

.ah-panel__title {
  display: block;
  font-size: 15px;
}

.ah-panel__subtitle {
  display: block;
  color: var(--ah-muted);
  font-size: 12px;
  margin-top: 2px;
}

.ah-panel__controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.ah-panel__clear {
  border: 0;
  background: transparent;
  color: var(--ah-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
}

.ah-panel__clear:hover,
.ah-panel__clear:focus-visible {
  color: var(--ah-accent);
  background: rgba(47, 107, 79, 0.08);
  outline: none;
}

.ah-panel__close {
  border: 0;
  background: transparent;
  color: var(--ah-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.ah-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 8px;
  background: linear-gradient(180deg, #fbfaf8 0%, #fff 40%);
}

.ah-msg {
  max-width: 92%;
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  word-wrap: break-word;
}

.ah-msg p {
  margin: 0 0 0.5em;
}

.ah-msg p:last-child {
  margin-bottom: 0;
}

.ah-msg--bot {
  background: var(--ah-accent-soft);
  color: var(--ah-ink);
  border-bottom-left-radius: 4px;
}

.ah-msg--bot a {
  color: var(--ah-accent);
  text-decoration: underline;
  word-break: break-all;
}

.ah-msg--bot a:hover,
.ah-msg--bot a:focus-visible {
  color: #255a41;
}

.ah-msg--user {
  margin-left: auto;
  background: var(--ah-accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.ah-msg--system {
  background: transparent;
  color: var(--ah-muted);
  font-size: 12px;
  padding: 4px 0;
  text-align: center;
  max-width: 100%;
}

.ah-msg--thinking {
  opacity: 0.75;
  font-style: italic;
}

.ah-products {
  display: grid;
  gap: 8px;
  margin: 8px 0 4px;
}

.ah-card {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--ah-border);
  border-radius: 12px;
  background: #fff;
}

.ah-card__img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--ah-bg);
}

.ah-card__img--empty {
  display: block;
}

.ah-card__name {
  font-weight: 600;
  font-size: 13px;
  margin: 0 0 2px;
}

.ah-card__price {
  color: var(--ah-muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.ah-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ah-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ah-border);
  background: #fff;
  color: var(--ah-ink);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  line-height: 1.2;
}

.ah-btn:hover,
.ah-btn:focus-visible {
  border-color: var(--ah-accent);
  color: var(--ah-accent);
  outline: none;
}

.ah-btn--primary,
.ah-btn--checkout {
  background: var(--ah-accent);
  border-color: var(--ah-accent);
  color: #fff;
}

.ah-btn--primary:hover,
.ah-btn--checkout:hover,
.ah-btn--primary:focus-visible,
.ah-btn--checkout:focus-visible {
  background: #255a41;
  color: #fff;
}

.ah-btn--coupon {
  background: var(--ah-accent-soft);
  border-color: transparent;
  color: var(--ah-accent);
}

.ah-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 12px 10px;
}

.ah-chip {
  border: 1px solid var(--ah-border);
  background: #fff;
  color: var(--ah-muted);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}

.ah-chip:hover,
.ah-chip:focus-visible {
  border-color: var(--ah-accent);
  color: var(--ah-accent);
  outline: none;
}

.ah-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 12px 10px;
}

.ah-actions[hidden] {
  display: none !important;
}

.ah-composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--ah-border);
  background: #fff;
}

.ah-composer__input {
  width: 100%;
  resize: none;
  min-height: 40px;
  max-height: 96px;
  border: 1px solid var(--ah-border);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  color: var(--ah-ink);
  background: var(--ah-bg);
}

.ah-composer__input:focus {
  outline: 2px solid rgba(47, 107, 79, 0.25);
  border-color: var(--ah-accent);
}

.ah-composer__send {
  border: 0;
  border-radius: 12px;
  background: var(--ah-accent);
  color: #fff;
  font-weight: 600;
  padding: 0 14px;
  cursor: pointer;
}

.ah-composer__send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ah-root .screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 480px) {
  .ah-root {
    right: 12px;
    bottom: 12px;
  }

  .ah-panel {
    width: calc(100vw - 24px);
    height: min(70vh, 560px);
  }

  .ah-launcher__label {
    display: none;
  }
}
