/* Stackinova AI Chat — complete replacement stylesheet, v1.7
   Replace voice-widget.css entirely. Do not append earlier icon patches. */

.si-voice {
  --si-blue: #1847e8;
  --si-text: #182840;
  --si-line: #e7ecf5;
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 99999;
  color: var(--si-text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  text-align: left;
  -webkit-font-smoothing: antialiased;
}

.si-voice, .si-voice * { box-sizing: border-box; }
.si-voice button, .si-voice input, .si-voice select, .si-voice textarea { font: inherit; }
.si-voice button { cursor: pointer; }
.si-voice [hidden] { display: none !important; }

/* The floating launcher is circular, with its existing SVG truly centered. */
.si-voice .si-launcher {
  position: relative;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  min-width: 58px;
  min-height: 58px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(145deg, #3976ff, #1243e8);
  color: #fff;
  line-height: 0;
  text-align: center;
  box-shadow: 0 8px 22px rgba(24, 71, 232, 0.28);
  -webkit-appearance: none;
  appearance: none;
  isolation: isolate;
}
.si-voice .si-launcher-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: none;
  margin: 0;
  padding: 0;
  line-height: 0;
}
.si-voice .si-launcher svg,
.si-voice .si-launcher-icon svg {
  display: block;
  width: 34px;
  height: 34px;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  opacity: 1;
  transform: none;
  flex: none;
}
/* Explicitly remove the pseudo-element icon from the previous patch. */
.si-voice .si-launcher::before,
.si-voice .si-launcher::after,
.si-voice .si-avatar::before,
.si-voice .si-avatar::after {
  content: none !important;
  display: none !important;
}

/* Main panel */
.si-voice .si-panel {
  display: flex;
  flex-direction: column;
  width: min(410px, calc(100vw - 28px));
  height: min(680px, calc(100dvh - 30px));
  min-height: 280px;
  overflow: hidden;
  border: 1px solid var(--si-line);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 14px 46px rgba(18, 39, 83, 0.2);
}

/* Header and aligned action icons */
.si-voice .si-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 70px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--si-line);
  background: #fff;
  flex-shrink: 0;
}
.si-voice .si-brand { display: flex; align-items: center; gap: 11px; min-width: 0; flex: 1; }
.si-voice .si-avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
  margin: 0;
  padding: 0;
  flex: none;
  overflow: hidden;
  border-radius: 50%;
  background: linear-gradient(145deg, #3976ff, #1243e8);
  color: #fff;
  line-height: 1;
  text-align: center;
  font-size: 0;
}
.si-voice .si-avatar svg {
  display: block;
  width: 42px;
  height: 42px;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  opacity: 1;
  transform: none;
}
.si-voice .si-heading { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.si-voice .si-heading strong { color: #152440; font-size: 15px; line-height: 1.2; font-weight: 750; }
.si-voice .si-heading span { color: #738198; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.si-voice .si-head-actions { display: flex; align-items: center; justify-content: flex-end; gap: 4px; flex: none; }
.si-voice .si-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #58677e;
  line-height: 1;
  text-align: center;
  font-size: 19px;
  -webkit-appearance: none;
  appearance: none;
}
.si-voice .si-icon:hover { background: #f0f4ff; }

/* Compact optional settings */
.si-voice .si-settings { padding: 12px 14px; border-bottom: 1px solid var(--si-line); display: flex; flex-wrap: wrap; align-items: center; gap: 12px; background: #f9fbff; }
.si-voice .si-settings label { font-size: 12px; color: #485a76; }
.si-voice .si-settings select { margin-left: 6px; padding: 7px 9px; border: 1px solid #ccd7e7; border-radius: 9px; background: #fff; max-width: 150px; }
.si-voice .si-toggle { display: inline-flex; align-items: center; gap: 7px; }

/* Conversation */
.si-voice .si-messages { display: flex; flex: 1; flex-direction: column; gap: 12px; min-height: 0; overflow-y: auto; padding: 16px 14px; overscroll-behavior: contain; background: #fff; }
.si-voice .si-bubble { max-width: 90%; padding: 11px 13px; border-radius: 16px; overflow-wrap: anywhere; white-space: pre-wrap; font-size: 14px; line-height: 1.5; }
.si-voice .si-user { align-self: flex-end; border-bottom-right-radius: 5px; color: #fff; background: var(--si-blue); }
.si-voice .si-assistant { align-self: flex-start; border-bottom-left-radius: 5px; color: #1c2c49; background: #f2f5fa; }

/* Compact shopping results */
.si-voice .si-products { display: flex; flex-direction: column; align-self: stretch; gap: 9px; }
.si-voice .si-product { display: flex; align-items: flex-start; gap: 10px; padding: 11px; border: 1px solid #e6ebf4; border-radius: 14px; background: #fff; }
.si-voice .si-product img { display: block; flex: none; width: 60px; height: 60px; object-fit: contain; }
.si-voice .si-product-body { min-width: 0; flex: 1; }
.si-voice .si-product-name { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; color: #1643df; font-size: 13px; font-weight: 700; text-decoration: none; overflow-wrap: anywhere; }
.si-voice .si-product-price { margin: 5px 0 2px; color: #172641; font-size: 15px; font-weight: 800; }
.si-voice .si-product-meta { display: block; margin: 3px 0; color: #70819b; font-size: 11px; line-height: 1.4; }
.si-voice .si-add { margin-top: 5px; padding: 7px 13px; border: 0; border-radius: 9px; color: #fff; background: var(--si-blue); font-weight: 700; }
.si-voice .si-add:disabled { background: #a6b0c1; }

/* Address review only appears when requested */
.si-voice .si-address { max-height: 280px; overflow-y: auto; padding: 12px 14px; border-top: 1px solid var(--si-line); background: #fbfcff; }
.si-voice .si-address p { margin: 4px 0 8px; color: #697991; font-size: 12px; }
.si-voice .si-address form { display: grid; gap: 7px; }
.si-voice .si-address input, .si-voice .si-address textarea { width: 100%; padding: 10px; border: 1px solid #cbd6e8; border-radius: 9px; color: #192b47; background: #fff; }
.si-voice .si-address textarea { min-height: 65px; resize: vertical; }
.si-voice .si-address-grid { display: flex; gap: 8px; }
.si-voice .si-primary { padding: 10px 13px; border: 0; border-radius: 10px; background: var(--si-blue); color: #fff; font-weight: 700; }

/* Bottom input area: three controls in one centered row */
.si-voice .si-compose {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  align-items: end;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  margin: 0;
  border-top: 1px solid var(--si-line);
  background: #fff;
  flex-shrink: 0;
}
.si-voice .si-compose .si-mic,
.si-voice .si-compose .si-send {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
  margin: 0;
  padding: 0;
  border-radius: 50%;
  line-height: 0;
  flex: none;
  align-self: end;
}
.si-voice .si-compose .si-mic { color: #1847e8; background: #edf2ff; }
.si-voice .si-mic-icon { display: grid; place-items: center; width: 22px; height: 22px; padding: 0; margin: 0; line-height: 0; }
.si-voice .si-mic-icon svg { display: block; width: 21px; height: 21px; margin: 0; padding: 0; }
.si-voice .si-mic[aria-pressed="true"] { color: #0c3bdc; background: #dce8ff; box-shadow: inset 0 0 0 1px #b4c7ff; }
.si-voice .si-compose textarea { width: 100%; min-width: 0; min-height: 42px; max-height: 120px; margin: 0; padding: 11px 13px; resize: none; border: 1px solid #d7dfec; border-radius: 20px; outline: none; background: #fff; color: #16263d; line-height: 1.4; font-size: 14px; }
.si-voice .si-compose textarea::placeholder { color: #8492a6; }
.si-voice .si-compose textarea:focus { border-color: #7196fa; box-shadow: 0 0 0 2px rgba(56, 113, 255, 0.1); }
.si-voice .si-compose .si-send { border: 0; color: #fff; background: var(--si-blue); }
.si-voice .si-send svg { display: block; width: 19px; height: 19px; margin: 0; padding: 0; }
.si-voice .si-send:disabled { opacity: 0.55; cursor: not-allowed; }
.si-voice .si-status { min-height: 18px; padding: 0 14px 7px; background: #fff; color: #77859a; font-size: 11px; }

.si-voice button:focus-visible, .si-voice a:focus-visible, .si-voice textarea:focus-visible, .si-voice input:focus-visible, .si-voice select:focus-visible { outline: 3px solid #e9ab2f; outline-offset: 2px; }

@media (max-width: 600px) {
  .si-voice { right: max(10px, env(safe-area-inset-right)); bottom: max(10px, env(safe-area-inset-bottom)); }
  .si-voice .si-panel { width: calc(100vw - 20px); height: min(88dvh, 760px); border-radius: 22px; }
  .si-voice .si-head { min-height: 68px; padding: 11px 13px; }
  .si-voice .si-heading span { max-width: 195px; }
  .si-voice .si-messages { padding: 14px 12px; }
  .si-voice .si-compose { gap: 7px; padding: 9px 10px calc(9px + env(safe-area-inset-bottom)); }
  .si-voice .si-product img { width: 54px; height: 54px; }
}
@media (prefers-reduced-motion: reduce) {
  .si-voice * { scroll-behavior: auto !important; }
}
