/**
 * DECTO floating Astra copilot — glass champagne UI
 */

.dp-owner-nav-stack__btn--referral .dp-owner-nav-stack__icon {
  color: #c5a46d;
}
.dp-owner-nav-stack__btn--referral {
  border-color: rgba(197, 164, 109, 0.45) !important;
}
.dp-owner-nav-stack__btn--copilot {
  background: linear-gradient(135deg, #17382f 0%, #1f4a3d 48%, #c5a46d 160%) !important;
  color: #fffdf8 !important;
  border: 1.5px solid rgba(240, 217, 160, 0.72) !important;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.22) inset,
    0 14px 32px rgba(15, 36, 29, 0.22),
    0 0 0 1px rgba(197, 164, 109, 0.35) !important;
  font-weight: 900 !important;
  letter-spacing: 0.01em;
  transform: translateZ(0);
}

.dp-owner-nav-stack__btn--copilot .dp-owner-nav-stack__label {
  color: #fffdf8 !important;
  font-weight: 900 !important;
  font-size: 0.95rem !important;
}

.dp-owner-nav-stack__btn--copilot .dp-owner-nav-stack__icon {
  background: rgba(255, 255, 255, 0.16) !important;
  color: #f0d9a0 !important;
  border: 1px solid rgba(240, 217, 160, 0.45) !important;
  box-shadow: 0 0 0 1px rgba(23, 56, 47, 0.2) inset;
}

.dp-owner-nav-stack__btn--copilot:hover,
.dp-owner-nav-stack__btn--copilot:focus-visible {
  filter: brightness(1.06);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.28) inset,
    0 18px 40px rgba(15, 36, 29, 0.28),
    0 0 0 1px rgba(240, 217, 160, 0.55) !important;
}

/* ==========================================================================
   Copilot header — neural mesh centered inside the AI button
   ========================================================================== */

body.app-shell .app-header-icon--copilot {
  position: relative !important;
  z-index: 8 !important;
  color: #17382f !important;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.72), rgba(240, 217, 160, 0.32)) !important;
  border: 1px solid rgba(197, 164, 109, 0.5) !important;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 8px 18px rgba(15, 36, 29, 0.1) !important;
  overflow: hidden !important;
  isolation: isolate;
  display: grid !important;
  place-items: center !important;
}

body.app-shell .app-header-icon--copilot:hover,
body.app-shell .app-header-icon--copilot:focus-visible {
  color: #122c26 !important;
  background: linear-gradient(145deg, #f0d9a0, #c5a46d) !important;
}

/* ---- Neural mesh centered INSIDE the AI button (replaces old side icon) ---- */
body.app-shell .bn-copilot-synapse {
  position: absolute !important;
  inset: 0 !important;
  left: 0 !important;
  right: 0 !important;
  top: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  transform: none !important;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
  display: grid !important;
  place-items: center !important;
}

body.app-shell .bn-copilot-synapse svg {
  display: block;
  width: 28px;
  height: 28px;
  overflow: visible;
}

body.app-shell .bn-copilot-synapse .bn-syn-wire {
  fill: none;
  stroke: #17382f;
  stroke-width: 1.35;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 22;
  stroke-dashoffset: 22;
  opacity: 0;
  animation: bnSynWire 3.8s cubic-bezier(0.33, 0.1, 0.2, 1) infinite;
}

body.app-shell .bn-copilot-synapse .bn-syn-wire--1 { animation-delay: 0s; stroke: #c5a46d; stroke-width: 1.5; }
body.app-shell .bn-copilot-synapse .bn-syn-wire--2 { animation-delay: 0.12s; }
body.app-shell .bn-copilot-synapse .bn-syn-wire--3 { animation-delay: 0.24s; stroke: #c5a46d; }
body.app-shell .bn-copilot-synapse .bn-syn-wire--4 { animation-delay: 0.36s; }
body.app-shell .bn-copilot-synapse .bn-syn-wire--5 { animation-delay: 0.48s; stroke: rgba(23, 56, 47, 0.55); }
body.app-shell .bn-copilot-synapse .bn-syn-wire--6 { animation-delay: 0.6s; stroke: #c5a46d; }

body.app-shell .bn-copilot-synapse .bn-syn-dot {
  fill: #17382f;
  stroke: #f0d9a0;
  stroke-width: 0.85;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  animation: bnSynDot 3.8s ease-in-out infinite;
}

body.app-shell .bn-copilot-synapse .bn-syn-dot--core {
  fill: #c5a46d;
  stroke: #17382f;
  stroke-width: 1;
  animation-name: bnSynCore;
  opacity: 1;
}

body.app-shell .bn-copilot-synapse .bn-syn-dot--1 { animation-delay: 0.05s; fill: #c5a46d; }
body.app-shell .bn-copilot-synapse .bn-syn-dot--2 { animation-delay: 0.2s; }
body.app-shell .bn-copilot-synapse .bn-syn-dot--3 { animation-delay: 0.35s; fill: #c5a46d; }
body.app-shell .bn-copilot-synapse .bn-syn-dot--4 { animation-delay: 0.5s; }
body.app-shell .bn-copilot-synapse .bn-syn-dot--5 { animation-delay: 0.65s; fill: #c5a46d; }
body.app-shell .bn-copilot-synapse .bn-syn-dot--6 { animation-delay: 0.8s; }

body.app-shell .bn-copilot-synapse .bn-syn-pulse {
  fill: #f0d9a0;
  opacity: 0;
  filter: drop-shadow(0 0 2px rgba(197, 164, 109, 0.9));
}

@supports (offset-path: path('M0 0 L1 1')) {
  body.app-shell .bn-copilot-synapse .bn-syn-pulse--1 {
    offset-path: path('M20 20 L20 6');
    animation: bnSynPulse 3.8s cubic-bezier(0.4, 0, 0.3, 1) infinite;
    animation-delay: 0.35s;
  }
  body.app-shell .bn-copilot-synapse .bn-syn-pulse--2 {
    offset-path: path('M20 20 L32.1 13');
    animation: bnSynPulse 3.8s cubic-bezier(0.4, 0, 0.3, 1) infinite;
    animation-delay: 0.7s;
  }
  body.app-shell .bn-copilot-synapse .bn-syn-pulse--3 {
    offset-path: path('M20 20 L7.9 27');
    animation: bnSynPulse 3.8s cubic-bezier(0.4, 0, 0.3, 1) infinite;
    animation-delay: 1.05s;
  }
}

@keyframes bnSynWire {
  0%, 6% { stroke-dashoffset: 22; opacity: 0; }
  18% { opacity: 1; }
  48% { stroke-dashoffset: 0; opacity: 1; }
  70% { stroke-dashoffset: 0; opacity: 0.85; }
  90%, 100% { stroke-dashoffset: -8; opacity: 0; }
}

@keyframes bnSynDot {
  0%, 10% { opacity: 0; transform: scale(0.45); }
  28% { opacity: 1; transform: scale(1.18); }
  55% { opacity: 1; transform: scale(1); }
  78% { opacity: 0.75; }
  92%, 100% { opacity: 0; transform: scale(0.5); }
}

@keyframes bnSynCore {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.92; transform: scale(1.12); }
}

@keyframes bnSynPulse {
  0%, 12% { offset-distance: 0%; opacity: 0; }
  22% { opacity: 1; }
  72% { offset-distance: 100%; opacity: 1; }
  86%, 100% { offset-distance: 100%; opacity: 0; }
}

/* JS burst on scroll / navigation — faster replay */
body.app-shell .app-header-icon--copilot.is-burst .bn-syn-wire,
body.app-shell .app-header-icon--copilot.is-burst .bn-syn-dot,
body.app-shell .app-header-icon--copilot.is-burst .bn-syn-pulse,
body.app-shell .bn-copilot-synapse.is-burst .bn-syn-wire,
body.app-shell .bn-copilot-synapse.is-burst .bn-syn-dot,
body.app-shell .bn-copilot-synapse.is-burst .bn-syn-pulse {
  animation-duration: 1.9s !important;
}

@media (prefers-reduced-motion: reduce) {
  body.app-shell .bn-copilot-synapse .bn-syn-wire,
  body.app-shell .bn-copilot-synapse .bn-syn-dot {
    animation: none !important;
    opacity: 0.9 !important;
    stroke-dashoffset: 0 !important;
  }
  body.app-shell .bn-copilot-synapse .bn-syn-pulse {
    display: none !important;
  }
}

.bn-decto-copilot {
  position: fixed;
  inset: auto 14px calc(88px + env(safe-area-inset-bottom, 0px)) auto;
  z-index: 2147483600;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
  font-family: var(--bn-font-body, 'Peyda', 'Vazirmatn', sans-serif);
}

.bn-decto-copilot[hidden] {
  display: none !important;
}

.bn-decto-copilot__fab,
.bn-decto-copilot__panel,
.bn-decto-copilot__voice-float {
  pointer-events: auto;
}

.bn-decto-copilot__voice-float {
  position: fixed;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.75);
  background: linear-gradient(145deg, rgba(255, 252, 247, 0.92), rgba(240, 217, 160, 0.55));
  color: #17382f;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.95) inset,
    0 14px 36px rgba(15, 36, 29, 0.22),
    0 0 0 1px rgba(197, 164, 109, 0.35);
  backdrop-filter: blur(18px) saturate(1.35);
  -webkit-backdrop-filter: blur(18px) saturate(1.35);
  cursor: grab;
  z-index: 2147483646;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  touch-action: none;
  user-select: none;
  /* default above dock, opposite of fab cluster until dragged */
  inset: auto auto calc(160px + env(safe-area-inset-bottom, 0px)) 16px;
}

.bn-decto-copilot__voice-float.is-dragging {
  cursor: grabbing;
  opacity: 0.92;
  transform: scale(1.06);
}

.bn-decto-copilot__icon-btn.is-muted,
.bn-decto-copilot.is-muted #bnDectoCopilotMute {
  color: #9a3b2f;
}
.bn-decto-copilot__trash {
  position: fixed;
  left: 50%;
  bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(12px);
  z-index: 2147483647;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.bn-decto-copilot__trash.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.bn-decto-copilot__trash-ring {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: #fff;
  background: rgba(154, 59, 47, 0.92);
  border: 2px solid rgba(255, 255, 255, 0.75);
  box-shadow: 0 12px 32px rgba(154, 59, 47, 0.35);
}
.bn-decto-copilot__trash.is-hot .bn-decto-copilot__trash-ring {
  transform: scale(1.12);
  background: #c0392b;
}
.bn-decto-copilot__trash small {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(23, 56, 47, 0.85);
  color: #fffdf8;
  font-size: 0.72rem;
  font-weight: 700;
}
.bn-decto-copilot__voice-float.is-over-trash {
  opacity: 0.55;
  transform: scale(0.92);
}
.bn-decto-copilot__voice-float.is-muted::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 2px;
  background: #9a3b2f;
  transform: rotate(-35deg);
}

.bn-decto-copilot__voice-float.is-on {
  background: linear-gradient(145deg, #17382f, #29483d);
  color: #f0d9a0;
  box-shadow:
    0 0 0 3px rgba(197, 164, 109, 0.45),
    0 16px 40px rgba(15, 36, 29, 0.35);
  animation: bn-copilot-voice-pulse 1.6s ease-in-out infinite;
}

@keyframes bn-copilot-voice-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(197, 164, 109, 0.35), 0 16px 40px rgba(15, 36, 29, 0.3); }
  50% { box-shadow: 0 0 0 8px rgba(197, 164, 109, 0.18), 0 18px 44px rgba(15, 36, 29, 0.35); }
}

.bn-decto-copilot__posts-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bn-decto-copilot__post {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(23, 56, 47, 0.08);
  text-decoration: none;
  color: inherit;
}

.bn-decto-copilot__post-thumb {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
  background: rgba(23, 56, 47, 0.08);
}

.bn-decto-copilot__post-thumb--empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #5a6b64;
}

.bn-decto-copilot__post-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bn-decto-copilot__post-body strong {
  font-size: 0.82rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.bn-decto-copilot__post-body small,
.bn-decto-copilot__compare-note {
  color: #5a6b64;
  font-size: 0.72rem;
}

.bn-decto-copilot__compare-pick {
  margin: 0 0 6px;
  font-size: 0.88rem;
}

.bn-decto-copilot__compare-reasons {
  margin: 0 0 8px;
  padding-inline-start: 1.1rem;
  font-size: 0.8rem;
  color: #29483d;
}

.bn-decto-copilot__best {
  display: inline-block;
  margin-inline-end: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #c5a46d;
  color: #17382f;
  font-size: 0.65rem;
  font-weight: 900;
}

.bn-decto-copilot__fab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.42);
  color: #17382f;
  font-weight: 800;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 12px 32px rgba(15, 36, 29, 0.16),
    0 0 0 1px rgba(197, 164, 109, 0.28);
  backdrop-filter: blur(22px) saturate(1.4);
  -webkit-backdrop-filter: blur(22px) saturate(1.4);
  cursor: pointer;
}

.bn-decto-copilot__fab i {
  color: #c5a46d;
}

.bn-decto-copilot.is-open .bn-decto-copilot__fab {
  display: none;
}

.bn-decto-copilot__panel {
  width: min(380px, calc(100vw - 28px));
  max-height: min(70dvh, 620px);
  display: flex;
  flex-direction: column;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: rgba(248, 250, 248, 0.88);
  backdrop-filter: blur(28px) saturate(1.45);
  -webkit-backdrop-filter: blur(28px) saturate(1.45);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.95) inset,
    0 24px 56px rgba(15, 36, 29, 0.18),
    0 0 0 1px rgba(197, 164, 109, 0.2);
  overflow: hidden;
}

.bn-decto-copilot__panel[hidden] {
  display: none !important;
}

.bn-decto-copilot__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(197, 164, 109, 0.28);
}

.bn-decto-copilot__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.bn-decto-copilot__brand strong {
  display: block;
  font-size: 0.92rem;
  color: #17382f;
}

.bn-decto-copilot__brand small {
  display: block;
  color: #5a6b64;
  font-size: 0.72rem;
}

.bn-decto-copilot__orb {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, #f0d9a0, transparent 45%),
    linear-gradient(145deg, #17382f, #29483d);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.55);
  flex-shrink: 0;
}

.bn-decto-copilot__head-actions {
  display: flex;
  gap: 6px;
}

.bn-decto-copilot__icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.65);
  background: rgba(255, 255, 255, 0.45);
  color: #17382f;
  cursor: pointer;
}

.bn-decto-copilot__icon-btn--danger {
  color: #8a3b34;
}

.bn-decto-copilot__messages {
  flex: 1 1 auto;
  min-height: 180px;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  -webkit-overflow-scrolling: touch;
}

.bn-decto-copilot__bubble {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 18px;
  font-size: 0.86rem;
  line-height: 1.65;
}

.bn-decto-copilot__bubble p {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.bn-decto-copilot__bubble--assistant {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.8);
  color: #17382f;
}

.bn-decto-copilot__bubble--user {
  align-self: flex-end;
  background: rgba(23, 56, 47, 0.92);
  border: 1px solid rgba(197, 164, 109, 0.35);
  color: #faf9f5;
}

.bn-decto-copilot__quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 12px 8px;
}

.bn-decto-copilot__quick button {
  border-radius: 999px;
  border: 1px solid rgba(197, 164, 109, 0.35);
  background: rgba(255, 255, 255, 0.55);
  color: #17382f;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 6px 10px;
  cursor: pointer;
}

.bn-decto-copilot__form {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgba(197, 164, 109, 0.22);
}

.bn-decto-copilot__form input {
  min-width: 0;
  height: 42px;
  border-radius: 21px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.7);
  padding: 0 14px;
  color: #17382f;
  font: inherit;
}

.bn-decto-copilot__mic,
.bn-decto-copilot__send {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.bn-decto-copilot__mic {
  background: rgba(255, 255, 255, 0.65);
  color: #17382f;
  border: 1px solid rgba(255, 255, 255, 0.75);
}

.bn-decto-copilot.is-recording .bn-decto-copilot__mic,
.bn-decto-copilot.is-voice .bn-decto-copilot__mic {
  background: #b45a52;
  color: #fff;
  animation: bn-copilot-pulse 1s ease-in-out infinite;
}

.bn-decto-copilot.is-voice .bn-decto-copilot__orb {
  box-shadow: 0 0 0 6px rgba(197, 164, 109, 0.28);
}

.bn-decto-copilot__results {
  max-width: 100% !important;
  padding: 10px !important;
}

.bn-decto-copilot__results-title {
  font-weight: 800;
  margin-bottom: 8px !important;
  color: #17382f;
}

.bn-decto-copilot__results-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bn-decto-copilot__result {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
  padding: 8px 10px;
  border-radius: 14px;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(197, 164, 109, 0.35);
  color: #17382f;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.bn-decto-copilot__result:hover,
.bn-decto-copilot__result:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(15, 36, 29, 0.12);
}

.bn-decto-copilot__result strong {
  grid-column: 1;
  font-size: 0.84rem;
}

.bn-decto-copilot__result small {
  grid-column: 1;
  opacity: 0.75;
  font-size: 0.72rem;
}

.bn-decto-copilot__rating {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  font-size: 0.75rem;
  font-weight: 800;
  color: #9a7b3c;
}

.bn-decto-copilot__send {
  background: #17382f;
  color: #faf9f5;
  box-shadow: 0 8px 18px rgba(15, 36, 29, 0.2);
}

.bn-decto-copilot.is-busy .bn-decto-copilot__send {
  opacity: 0.6;
  pointer-events: none;
}

@keyframes bn-copilot-pulse {
  50% { transform: scale(1.06); }
}

@media (max-width: 520px) {
  .bn-decto-copilot {
    inset-inline: 10px;
    right: 10px;
    left: 10px;
    align-items: stretch;
  }
  .bn-decto-copilot__fab {
    align-self: flex-end;
  }
  .bn-decto-copilot__panel {
    width: 100%;
  }
}
