/* AI widget — chat bubble (all pages) + AI product description (product pages).
   Prefixed .aiw- to avoid clashing with the mirrored site's own CSS.
   Colors/fonts reuse the site's own palette & typefaces (already loaded by the page). */

:root {
  --aiw-color-primary: #C69244;
  --aiw-color-primary-dark: #A17A41;
  --aiw-color-secondary: #E1BF8C;
  --aiw-color-text: #14120C;
  --aiw-color-text-muted: #6b6558;
  --aiw-color-bg: #ffffff;
  --aiw-color-bg-soft: #FAF6EF;
  --aiw-color-border: #E7DFD1;
  --aiw-color-danger: #c0392b;
  --aiw-font-heading: 'Unbounded', 'Playfair Display', serif;
  --aiw-font-body: 'FuturaLightCTT', Arial, sans-serif;
  --aiw-radius: 16px;
  --aiw-radius-sm: 10px;
  --aiw-shadow: 0 12px 40px rgba(20, 18, 12, 0.18);
  --aiw-z: 2147483000;
}

.aiw-root, .aiw-root * { box-sizing: border-box; font-family: var(--aiw-font-body); }
.aiw-visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Floating action button ---------- */
.aiw-fab {
  position: fixed; right: 20px; bottom: 20px; z-index: var(--aiw-z);
  width: 60px; height: 60px; border-radius: 9999px; border: none; cursor: pointer;
  background: var(--aiw-color-primary); color: #fff; box-shadow: var(--aiw-shadow);
  display: flex; align-items: center; justify-content: center; transition: transform .2s ease, background .2s ease;
}
.aiw-fab:hover, .aiw-fab:focus-visible { background: var(--aiw-color-primary-dark); transform: translateY(-2px); }
.aiw-fab svg { width: 28px; height: 28px; }
.aiw-fab__close-icon { display: none; }
.aiw-fab[aria-expanded="true"] .aiw-fab__chat-icon { display: none; }
.aiw-fab[aria-expanded="true"] .aiw-fab__close-icon { display: block; }

/* ---------- Panel ---------- */
.aiw-panel {
  position: fixed; right: 20px; bottom: 92px; z-index: var(--aiw-z);
  width: 380px; height: 560px; max-height: calc(100vh - 110px);
  background: var(--aiw-color-bg); border-radius: var(--aiw-radius); box-shadow: var(--aiw-shadow);
  display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--aiw-color-border);
}
.aiw-panel[hidden] { display: none; }

.aiw-panel__header {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 14px 16px; background: var(--aiw-color-text); color: #fff;
}
.aiw-panel__title { font-family: var(--aiw-font-heading); font-size: 15px; margin: 0; font-weight: 600; }
.aiw-panel__subtitle { font-size: 12px; color: var(--aiw-color-secondary); margin: 2px 0 0; }
.aiw-panel__close {
  background: transparent; border: none; color: #fff; cursor: pointer; padding: 6px; border-radius: 8px; line-height: 0;
}
.aiw-panel__close:hover, .aiw-panel__close:focus-visible { background: rgba(255,255,255,.12); }
.aiw-panel__close svg, .aiw-send-btn svg { width: 20px; height: 20px; display: block; }

.aiw-messages {
  flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--aiw-color-bg-soft);
}
.aiw-msg { max-width: 86%; padding: 10px 13px; border-radius: var(--aiw-radius-sm); font-size: 14px; line-height: 1.45; white-space: normal; word-wrap: break-word; }
.aiw-msg--bot { align-self: flex-start; background: #fff; border: 1px solid var(--aiw-color-border); color: var(--aiw-color-text); border-bottom-left-radius: 2px; }
.aiw-msg--user { align-self: flex-end; background: var(--aiw-color-primary); color: #fff; border-bottom-right-radius: 2px; }
.aiw-msg--error { border-color: var(--aiw-color-danger); color: var(--aiw-color-danger); }
.aiw-msg p { margin: 0 0 6px; }
.aiw-msg p:last-child { margin-bottom: 0; }
.aiw-msg ul { margin: 6px 0; padding-left: 18px; }
.aiw-msg a { color: var(--aiw-color-primary-dark); }

.aiw-sources { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.aiw-source-chip {
  display: inline-block; font-size: 12px; padding: 4px 10px; border-radius: 9999px;
  background: var(--aiw-color-secondary); color: var(--aiw-color-text); text-decoration: none; border: 1px solid var(--aiw-color-border);
}
.aiw-source-chip:hover { background: var(--aiw-color-primary); color: #fff; }

.aiw-typing { align-self: flex-start; display: flex; gap: 4px; padding: 10px 13px; background: #fff; border: 1px solid var(--aiw-color-border); border-radius: var(--aiw-radius-sm); }
.aiw-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--aiw-color-primary); animation: aiw-blink 1.2s infinite ease-in-out; }
.aiw-typing span:nth-child(2) { animation-delay: .2s; }
.aiw-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes aiw-blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.aiw-quick-replies { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 10px; background: var(--aiw-color-bg-soft); }
.aiw-chip {
  border: 1px solid var(--aiw-color-primary); background: #fff; color: var(--aiw-color-primary-dark);
  font-size: 12.5px; padding: 6px 12px; border-radius: 9999px; cursor: pointer; transition: background .15s, color .15s;
}
.aiw-chip:hover, .aiw-chip:focus-visible { background: var(--aiw-color-primary); color: #fff; }

.aiw-input-row { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--aiw-color-border); background: #fff; }
.aiw-input {
  flex: 1; resize: none; border: 1px solid var(--aiw-color-border); border-radius: var(--aiw-radius-sm);
  padding: 10px 12px; font-size: 14px; font-family: var(--aiw-font-body); color: var(--aiw-color-text); max-height: 90px;
}
.aiw-input:focus-visible { outline: 2px solid var(--aiw-color-primary); outline-offset: 1px; }
.aiw-send-btn {
  border: none; background: var(--aiw-color-primary); color: #fff; border-radius: var(--aiw-radius-sm);
  width: 42px; height: 42px; flex-shrink: 0; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.aiw-send-btn:hover, .aiw-send-btn:focus-visible { background: var(--aiw-color-primary-dark); }
.aiw-send-btn:disabled { opacity: .5; cursor: not-allowed; }

.aiw-panel__footer { padding: 8px 14px; text-align: center; border-top: 1px solid var(--aiw-color-border); background: var(--aiw-color-bg-soft); }
.aiw-lead-link { background: none; border: none; color: var(--aiw-color-primary-dark); font-size: 12.5px; text-decoration: underline; cursor: pointer; padding: 4px; }

/* ---------- Lead form ---------- */
.aiw-lead-form { padding: 14px; display: flex; flex-direction: column; gap: 8px; background: #fff; border-top: 1px solid var(--aiw-color-border); }
.aiw-lead-form__title { font-family: var(--aiw-font-heading); font-size: 14px; margin: 0 0 4px; }
.aiw-field { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; color: var(--aiw-color-text-muted); }
.aiw-field input, .aiw-field textarea {
  border: 1px solid var(--aiw-color-border); border-radius: var(--aiw-radius-sm); padding: 9px 11px; font-size: 14px; font-family: var(--aiw-font-body); color: var(--aiw-color-text);
}
.aiw-field textarea { resize: vertical; min-height: 50px; }
.aiw-lead-actions { display: flex; gap: 8px; margin-top: 4px; }
.aiw-btn { border: none; border-radius: var(--aiw-radius-sm); padding: 10px 16px; font-size: 13.5px; cursor: pointer; font-weight: 600; }
.aiw-btn--primary { background: var(--aiw-color-primary); color: #fff; }
.aiw-btn--primary:hover { background: var(--aiw-color-primary-dark); }
.aiw-btn--ghost { background: transparent; color: var(--aiw-color-text-muted); }

.aiw-toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: calc(var(--aiw-z) + 1);
  background: var(--aiw-color-text); color: #fff; padding: 12px 20px; border-radius: 9999px; font-size: 13.5px;
  box-shadow: var(--aiw-shadow); opacity: 0; transition: opacity .25s ease, transform .25s ease;
}
.aiw-toast--visible { opacity: 1; }

@media (max-width: 480px) {
  .aiw-panel { right: 0; bottom: 0; left: 0; top: 0; width: 100%; height: 100%; max-height: none; border-radius: 0; }
  .aiw-fab { right: 14px; bottom: 14px; }
}

/* ---------- AI product description card (sidebar, next to price/calculator) ----------
   Narrow column (~280-320px at desktop, per .page-product__section_description on the
   live site) — chips wrap via flex-wrap instead of a fixed grid, nothing here uses a
   fixed px width, so the card is fluid down to the ~360px viewport where the mirrored
   layout stacks the sidebar to full width. */
.aiw-product-block {
  --aiw-pb-pro: #5B8567;
  --aiw-pb-pro-bg: #EDF3EC;
  --aiw-pb-pro-border: #D7E5D4;
  --aiw-pb-con: #706A5C;
  --aiw-pb-con-bg: #F1EDE3;
  margin: 0 0 16px;
  padding: 16px;
  border: 1px solid var(--aiw-color-border);
  border-radius: var(--aiw-radius-sm);
  background: var(--aiw-color-bg);
  box-shadow: 0 2px 10px rgba(20, 18, 12, 0.06);
}

.aiw-pb__head { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 10px; }
.aiw-pb__badge {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%; margin-top: 1px;
  background: var(--aiw-color-primary); color: #fff; font-family: var(--aiw-font-heading);
  font-size: 10px; font-weight: 700; letter-spacing: .02em;
  display: flex; align-items: center; justify-content: center;
}
.aiw-pb__head-text { min-width: 0; }
.aiw-pb__title { font-family: var(--aiw-font-heading); font-size: 15px; line-height: 1.3; color: var(--aiw-color-text); margin: 0; font-weight: 600; }
.aiw-pb__subtitle { font-size: 11.5px; line-height: 1.4; color: var(--aiw-color-text-muted); margin: 3px 0 0; }

.aiw-pb__summary {
  font-size: 13px; line-height: 1.5; color: var(--aiw-color-text); margin: 0 0 12px;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}

.aiw-pb__chips { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.aiw-pb__chip {
  display: inline-flex; align-items: center; gap: 5px; max-width: 100%; min-width: 0;
  padding: 5px 11px; border-radius: 9999px; font-size: 12px; line-height: 1.3; border: 1px solid transparent;
}
.aiw-pb__chip--pro { background: var(--aiw-pb-pro-bg); border-color: var(--aiw-pb-pro-border); color: var(--aiw-pb-pro); }
.aiw-pb__chip--con { background: var(--aiw-pb-con-bg); border-color: var(--aiw-color-border); color: var(--aiw-pb-con); }
.aiw-pb__chip-icon { flex-shrink: 0; width: 12px; height: 12px; }
.aiw-pb__chip-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

.aiw-pb__disclaimer { font-size: 10.5px; line-height: 1.4; color: var(--aiw-color-text-muted); margin: 0 0 12px; }

.aiw-pb__toggle {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--aiw-color-bg-soft); border: 1px solid var(--aiw-color-border); border-radius: 8px;
  padding: 9px 12px; font-size: 13px; font-weight: 600; color: var(--aiw-color-primary-dark); cursor: pointer;
  font-family: var(--aiw-font-body); transition: background .15s ease, border-color .15s ease;
}
.aiw-pb__toggle:hover { background: var(--aiw-color-secondary); border-color: var(--aiw-color-primary); }
.aiw-pb__toggle:focus-visible { outline: 2px solid var(--aiw-color-primary); outline-offset: 2px; }
.aiw-pb__toggle-icon { width: 14px; height: 14px; flex-shrink: 0; transition: transform .2s ease; }
.aiw-pb__toggle[aria-expanded="true"] .aiw-pb__toggle-icon { transform: rotate(180deg); }

.aiw-pb__details { height: 0; overflow: hidden; opacity: 0; transition: height .3s ease, opacity .25s ease; }
.aiw-pb__details[hidden] { display: none; }
.aiw-pb__details-inner { padding-top: 14px; }

.aiw-pb__sub { font-size: 13.5px; font-weight: 700; margin: 0 0 8px; color: var(--aiw-color-primary-dark); }
.aiw-class-info { font-size: 13px; line-height: 1.55; color: var(--aiw-color-text); margin: 0 0 16px; }

.aiw-reviews { display: grid; gap: 10px; grid-template-columns: 1fr; margin-bottom: 16px; }
.aiw-review-card { background: var(--aiw-color-bg-soft); border: 1px solid var(--aiw-color-border); border-radius: 8px; padding: 12px; }
.aiw-review-card__author { font-weight: 700; font-size: 12.5px; margin-bottom: 4px; }
.aiw-review-card__stars { color: var(--aiw-color-primary); font-size: 12px; letter-spacing: 1px; margin-bottom: 5px; }
.aiw-review-card__text { font-size: 12.5px; line-height: 1.5; color: var(--aiw-color-text); }

.aiw-cta-btn { width: 100%; margin-top: 0; }

/* ---------- Skeleton (loading), sized like the ready card so the sidebar doesn't jump ---------- */
.aiw-pb__skeleton { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.aiw-pb__skel-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.aiw-pb__skel-line, .aiw-pb__skel-chip {
  border-radius: 6px; background: linear-gradient(90deg, var(--aiw-color-bg-soft) 25%, var(--aiw-color-border) 50%, var(--aiw-color-bg-soft) 75%);
  background-size: 200% 100%; animation: aiw-shimmer 1.4s ease-in-out infinite;
}
.aiw-pb__skel-line { display: block; height: 11px; }
.aiw-pb__skel-line--full { width: 100%; }
.aiw-pb__skel-line--short { width: 65%; }
.aiw-pb__skel-chip { display: inline-block; height: 24px; width: 84px; border-radius: 9999px; }
@keyframes aiw-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
  .aiw-fab, .aiw-typing span, .aiw-toast,
  .aiw-pb__skel-line, .aiw-pb__skel-chip, .aiw-pb__details, .aiw-pb__toggle-icon {
    animation: none !important; transition: none !important;
  }
}
