/* ==== Agroshop AI Widget (floating) ==== */

/* ========== Launcher (button) ========== */
.aiw-launcher{
  position: fixed !important;
  right: 16px !important;
  bottom: 50px !important;
  z-index: 6500 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 56px !important;
  height: 56px !important;
  padding: 0 !important;
  border-radius: 50% !important;
  background-color: #4b5563 !important;
  background-image: url("/static/ai_assistant/al.ff889c72795c.png") !important;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  color: #fff !important;
  box-shadow: 0 12px 30px rgba(0,0,0,.18) !important;
  cursor: pointer !important;
  user-select: none !important;
  -webkit-tap-highlight-color: transparent !important;
  overflow: visible !important;
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease !important;
}

.aiw-launcher__text{
  display: none !important;
  line-height: 1 !important;
}

.aiw-launcher::before{
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0.2);
  opacity: 0;
  background: rgba(255,255,255,.95);
  pointer-events: none;
}

.aiw-launcher.aiw-launcher--intro{
  animation:
    aiwPop .42s cubic-bezier(.2, 1.2, .2, 1) both,
    aiwWiggle 1.1s ease-in-out .18s both;
}

.aiw-launcher.aiw-launcher--intro::before{
  opacity: 1;
  animation: aiwDot .40s ease-out both;
}

@keyframes aiwPop{
  0%   { transform: scale(0.12); }
  60%  { transform: scale(1.06); }
  100% { transform: scale(1.00); }
}

@keyframes aiwWiggle{
  0%   { transform: translateX(0) rotate(0deg); }
  15%  { transform: translateX(3px) rotate(3deg); }
  30%  { transform: translateX(-3px) rotate(-3deg); }
  45%  { transform: translateX(2px) rotate(2deg); }
  60%  { transform: translateX(-2px) rotate(-2deg); }
  75%  { transform: translateX(1px) rotate(1deg); }
  100% { transform: translateX(0) rotate(0deg); }
}

@keyframes aiwDot{
  0%   { transform: translate(-50%, -50%) scale(0.2); opacity: 1; }
  70%  { transform: translate(-50%, -50%) scale(2.2); opacity: .35; }
  100% { transform: translate(-50%, -50%) scale(3.0); opacity: 0; }
}

@media (prefers-reduced-motion: reduce){
  .aiw-launcher.aiw-launcher--intro{ animation: none !important; }
  .aiw-launcher.aiw-launcher--intro::before{ animation: none !important; }
}

@media (min-width: 769px){
  .aiw-launcher:hover{
    transform: translateY(-2px) !important;
    box-shadow: 0 18px 44px rgba(0,0,0,.26) !important;
    filter: brightness(1.02) !important;
  }
  .aiw-launcher:active{
    transform: translateY(0) !important;
    box-shadow: 0 12px 30px rgba(0,0,0,.18) !important;
    filter: brightness(0.99) !important;
  }
  .aiw-launcher:focus-visible{
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(28,150,117,.22), 0 18px 44px rgba(0,0,0,.22) !important;
  }
}

/* ========== Panel (chat) ========== */
.aiw{
  position: fixed !important;
  right: 16px !important;
  bottom: 76px !important;
  z-index: 6501 !important;
  width: min(420px, calc(100vw - 32px)) !important;
  height: min(560px, calc(100vh - 140px)) !important;
  display: none !important;
  flex-direction: column !important;
  overflow: hidden !important;

  background: rgba(255,255,255,.97) !important;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(20,35,60,.14) !important;
  border-radius: 18px !important;
  box-shadow: 0 20px 55px rgba(15,23,42,.24) !important;
}

.aiw.aiw--open{
  display: flex !important;
}

.aiw__header{
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 12px !important;
  flex: 0 0 auto !important;
  border-bottom: 1px solid rgba(0,0,0,.06) !important;
  background: linear-gradient(180deg,#ffffff 0%,#f5f8fb 100%) !important;
}

.aiw__title{
  font-family: "GTEestiPro","Arial",sans-serif !important;
  font-size: 13px !important;
  font-weight: 900 !important;
  color: #232323 !important;
}

.aiw__close{
  width: 34px !important;
  height: 34px !important;
  border: 0 !important;
  border-radius: 10px !important;
  background: rgba(0,0,0,.06) !important;
  cursor: pointer !important;
  font-size: 20px !important;
  line-height: 34px !important;
}

/* ===== quick buttons ===== */
.aiw__quick{
  display: grid !important;
  grid-template-columns: repeat(2, 1fr) !important;
  gap: 8px !important;
  padding: 10px 12px !important;
  flex: 0 0 auto !important;
  border-bottom: 1px solid rgba(0,0,0,.06) !important;
  background: #eff0f0 !important;
}

.aiw__chip{
  width: 100% !important;
  white-space: normal !important;
  text-align: center !important;
  padding: 8px 10px !important;
  cursor: pointer !important;

  border: 1px solid rgba(28,150,117,.35) !important;
  background: #fff !important;
  color: #4b5563 !important;
  border-radius: 999px !important;

  font-family: "GTEestiPro","Arial",sans-serif !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  line-height: 1.2 !important;
}

.aiw__meta{
  padding: 8px 12px !important;
  font-size: 12px !important;
  color: #666 !important;
  background: #fff !important;
}

/* ===== log / messages ===== */
.aiw__log{
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow: auto !important;
  padding: 10px 12px !important;
  font-size: 13px !important;
  color: #4b5563 !important;

  background: #ebfff8 !important;
  background-image: url("/static/ai_assistant/chat-pattern.c0ca44179409.svg") !important;
  background-size: 260px !important;
  background-repeat: repeat !important;
}

.aiw__msg{
  max-width: 92% !important;
  margin: 0 0 10px 0 !important;
  padding: 10px 12px !important;
  line-height: 1.35 !important;
  word-break: break-word !important;
  border-radius: 14px !important;
  border: 1px solid rgba(0,0,0,.06) !important;
  box-shadow: 0 6px 18px rgba(0,0,0,.06) !important;
}

.aiw__msg--assistant{
  background: #ffffff !important;
  border: 1px solid rgba(20,35,60,.08) !important;
}

.aiw__msg--user{
  margin-left: auto !important;
  background: #eefaf4 !important;
  border: 1px solid rgba(27,150,117,.16) !important;
}

.aiw__link{
  color: #1c9675 !important;
  font-weight: 800 !important;
  text-decoration: underline !important;
}

/* ===== input ===== */
.aiw__input{
  display: grid !important;
  grid-template-columns: 1fr auto !important;
  gap: 8px !important;
  padding: 10px 12px !important;
  border-top: 1px solid rgba(0,0,0,.06) !important;
  background: #fff !important;
}

.aiw__input input{
  width: 100% !important;
  height: 40px !important;
  padding: 0 12px !important;
  border-radius: 12px !important;
  border: 1px solid rgba(0,0,0,.16) !important;
  font-size: 14px !important;
}

.aiw__input button{
  height: 40px !important;
  padding: 0 12px !important;
  border-radius: 12px !important;
  border: 0 !important;
  background: #4b5563 !important;
  color: #fff !important;
  font-weight: 900 !important;
  cursor: pointer !important;
}

/* === 2026-05-07 mobile AI widget compact fix === */
@media (max-width: 768px) {
  .aiw {
    position: fixed !important;
    left: 10px !important;
    right: 10px !important;
    bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important;
    top: auto !important;
    width: auto !important;
    max-width: none !important;

    height: auto !important;
    max-height: min(62dvh, 560px) !important;

    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    border-radius: 18px !important;
  }

  .aiw[aria-hidden="true"] {
    display: none !important;
  }

  .aiw__header {
    flex: 0 0 auto !important;
    padding: 12px 14px !important;
  }

  .aiw__title {
    font-size: 17px !important;
    line-height: 1.2 !important;
  }

  .aiw__close {
    width: 42px !important;
    height: 42px !important;
    flex: 0 0 42px !important;
  }

  .aiw__quick {
    flex: 0 0 auto !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    padding: 10px 14px !important;
    max-height: 126px !important;
    overflow: hidden !important;
  }

  .aiw__chip {
    min-height: 46px !important;
    padding: 8px 10px !important;
    font-size: 14px !important;
    line-height: 1.15 !important;
    border-radius: 999px !important;
  }

  .aiw__meta {
    flex: 0 0 auto !important;
    padding: 9px 14px !important;
    font-size: 14px !important;
  }

  .aiw__log {
    flex: 1 1 auto !important;
    min-height: 120px !important;
    max-height: 34dvh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 12px 14px !important;
  }

  .aiw__input {
    flex: 0 0 auto !important;
    display: flex !important;
    gap: 8px !important;
    padding: 10px 14px calc(12px + env(safe-area-inset-bottom, 0px)) !important;
    background: #fff !important;
    border-top: 1px solid rgba(0,0,0,.08) !important;
  }

  .aiw__input input {
    min-width: 0 !important;
    height: 44px !important;
    font-size: 16px !important;
    border-radius: 14px !important;
  }

  .aiw__input button {
    height: 44px !important;
    flex: 0 0 112px !important;
    padding: 0 12px !important;
    font-size: 15px !important;
    border-radius: 14px !important;
  }

  .aiw-launcher {
    right: 14px !important;
    bottom: calc(78px + env(safe-area-inset-bottom, 0px)) !important;
    z-index: 1001 !important;
  }
}

@media (max-width: 390px) {
  .aiw {
    left: 8px !important;
    right: 8px !important;
    max-height: min(58dvh, 520px) !important;
  }

  .aiw__quick {
    gap: 7px !important;
    padding: 9px 12px !important;
  }

  .aiw__chip {
    font-size: 13px !important;
    min-height: 44px !important;
  }

  .aiw__input button {
    flex-basis: 96px !important;
    font-size: 14px !important;
  }
}







/* === FINAL AI MOBILE FIX === */
@media (max-width: 768px){
  .aiw-launcher{
    right: 14px !important;
    bottom: 92px !important;
    z-index: 2147483646 !important;
    pointer-events: auto !important;
    touch-action: manipulation !important;
  }

  .aiw{
    left: 8px !important;
    right: 8px !important;
    top: auto !important;
    bottom: 82px !important;
    width: auto !important;
    height: auto !important;
    max-height: calc(100dvh - 110px) !important;
    z-index: 2147483647 !important;
    border-radius: 18px !important;
  }

  .aiw__quick{
    grid-template-columns: 1fr !important;
    gap: 8px !important;
    max-height: 132px !important;
    overflow-y: auto !important;
  }

  .aiw__log{
    flex: 0 1 auto !important;
    min-height: 145px !important;
    max-height: 230px !important;
  }

  .aiw__input input{
    font-size: 16px !important;
  }

  .aiw.aiw--open + .mobile-nav{
    z-index: 4000 !important;
  }
}


/* === FINAL AI MOBILE FIX === */
@media (max-width: 768px){
  .aiw-launcher{
    right: 14px !important;
    bottom: 92px !important;
    z-index: 2147483646 !important;
    pointer-events: auto !important;
    touch-action: manipulation !important;
  }

  .aiw{
    left: 8px !important;
    right: 8px !important;
    top: auto !important;
    bottom: 82px !important;
    width: auto !important;
    height: auto !important;
    max-height: calc(100dvh - 110px) !important;
    z-index: 2147483647 !important;
    border-radius: 18px !important;
  }

  .aiw__quick{
    grid-template-columns: 1fr !important;
    gap: 8px !important;
    max-height: 132px !important;
    overflow-y: auto !important;
  }

  .aiw__log{
    flex: 0 1 auto !important;
    min-height: 145px !important;
    max-height: 230px !important;
  }

  .aiw__input input{
    font-size: 16px !important;
  }

  .aiw.aiw--open + .mobile-nav{
    z-index: 4000 !important;
  }
}

/* === AI MOBILE UX TUNE v23 === */
@media (max-width: 768px){
  .aiw{
    top: clamp(135px, 32dvh, 235px) !important;
    bottom: 74px !important;
    max-height: none !important;
  }

  .aiw__quick{
    gap: 6px !important;
    padding: 8px 12px !important;
    max-height: 118px !important;
  }

  .aiw__chip{
    padding: 7px 9px !important;
    min-height: 36px !important;
    font-size: 12px !important;
    line-height: 1.15 !important;
  }

  .aiw__meta{
    padding: 7px 12px !important;
  }

  .aiw__log{
    min-height: 240px !important;
    max-height: none !important;
    flex: 1 1 auto !important;
  }

  .aiw__input{
    padding: 9px 12px 10px !important;
  }
}

/* === AI MOBILE HEIGHT TUNE v24 === */
@media (max-width: 768px){
  .aiw{
    top: 96px !important;
    bottom: 72px !important;
    height: auto !important;
    max-height: none !important;
  }

  .aiw__log{
    min-height: 330px !important;
    max-height: none !important;
    flex: 1 1 auto !important;
  }

  .aiw__quick{
    max-height: 108px !important;
  }
}
/* === AI MOBILE FINAL VISUAL v25 === */
@media (max-width:768px){
  .aiw{top:56px!important;bottom:72px!important;height:auto!important;max-height:none!important}
  .aiw__header{padding:12px 14px!important}
  .aiw__close{display:flex!important;align-items:center!important;justify-content:center!important;width:44px!important;height:44px!important;font-size:30px!important;color:#111!important;background:#f1f1f1!important;border-radius:14px!important;z-index:2147483647!important}
  .aiw__quick{max-height:132px!important}
  .aiw__chip{min-height:34px!important;padding:6px 10px!important;font-size:12px!important}
  .aiw__log{min-height:360px!important;flex:1 1 auto!important}
}
/* === AI MOBILE HEADER COMPACT v26 === */
@media (max-width:768px){
  .aiw{top:48px!important;bottom:72px!important}
  .aiw__header{min-height:46px!important;padding:5px 10px!important}
  .aiw__title{font-size:17px!important;line-height:1.15!important;margin:0!important}
  .aiw__close{width:34px!important;height:34px!important;min-width:34px!important;font-size:24px!important;line-height:34px!important;border-radius:10px!important;padding:0!important;margin:0!important}
  .aiw__quick{padding-top:7px!important;padding-bottom:7px!important}
}

/* 2026-05-08 — AI mobile adaptive safe fit */
@media (max-width: 768px) {
  .aiw {
    left: 10px !important;
    right: 10px !important;
    top: max(14px, env(safe-area-inset-top)) !important;
    bottom: calc(86px + env(safe-area-inset-bottom)) !important;
    width: auto !important;
    max-width: calc(100vw - 20px) !important;
    height: auto !important;
    max-height: calc(100dvh - 110px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;
    overflow: hidden !important;
  }

  .aiw__quick {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 8px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    padding: 8px 12px !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
  }

  .aiw__quick::-webkit-scrollbar {
    display: none !important;
  }

  .aiw__quick button,
  .aiw__quick .aiw__chip {
    flex: 0 0 auto !important;
    white-space: nowrap !important;
    min-width: 220px !important;
    max-width: 260px !important;
    height: 44px !important;
  }

  .aiw__log {
    min-height: 180px !important;
    max-height: 38dvh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .aiw__input {
    flex: 0 0 auto !important;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom)) !important;
  }

  .aiw__input input {
    min-width: 0 !important;
  }

  .aiw__input button {
    flex: 0 0 auto !important;
    white-space: nowrap !important;
  }
}

/* 2026-05-08 — AI mobile remove empty bottom */
@media (max-width: 768px) {
  .aiw {
    top: auto !important;
    bottom: calc(118px + env(safe-area-inset-bottom)) !important;
    height: auto !important;
    max-height: calc(100dvh - 150px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;
  }

  .aiw__log {
    min-height: 160px !important;
    max-height: 34dvh !important;
  }

  .aiw__input {
    margin-bottom: 0 !important;
    padding-bottom: calc(10px + env(safe-area-inset-bottom)) !important;
  }
}

/* 2026-05-08 — AI mobile fine tune: higher body + slightly higher sheet */
@media (max-width: 768px) {
  .aiw {
    bottom: calc(126px + env(safe-area-inset-bottom)) !important;
    max-height: calc(100dvh - 138px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;
  }

  .aiw__log {
    min-height: 180px !important;
    max-height: calc(34dvh + 20px) !important;
  }
}

/* 2026-05-08 — AI Intercom-style clean quick actions */
.aiw__quick button:nth-child(n+3),
.aiw__quick .aiw__chip:nth-child(n+3) {
  display: none !important;
}

.aiw__quick {
  display: flex !important;
  gap: 10px !important;
  padding: 12px 14px !important;
}

.aiw__quick button,
.aiw__quick .aiw__chip {
  flex: 1 1 0 !important;
  min-width: 0 !important;
  height: 44px !important;
  border-radius: 999px !important;
  font-weight: 700 !important;
}

@media (max-width: 768px) {
  .aiw__quick {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
  }

  .aiw__quick::-webkit-scrollbar {
    display: none !important;
  }

  .aiw__quick button,
  .aiw__quick .aiw__chip {
    flex: 0 0 calc(50% - 6px) !important;
    min-width: 185px !important;
    max-width: 240px !important;
  }

  .aiw__log {
    min-height: 200px !important;
    max-height: calc(36dvh + 20px) !important;
  }
}

/* 2026-05-08 — AI Intercom-style smooth open animation */
@keyframes aiwIntercomOpen {
  0% {
    opacity: 0;
    transform: translate3d(0, 18px, 0) scale(0.965);
  }
  60% {
    opacity: 1;
    transform: translate3d(0, -2px, 0) scale(1.005);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

.aiw {
  transform-origin: right bottom !important;
  animation: aiwIntercomOpen 260ms cubic-bezier(.2, .85, .25, 1) both !important;
  will-change: transform, opacity;
}

@media (max-width: 768px) {
  .aiw {
    transform-origin: center bottom !important;
    animation-duration: 240ms !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .aiw {
    animation: none !important;
    transform: none !important;
  }
}

/* 2026-05-08 — AI single sales quick action */
.aiw__quick button:nth-child(n+2),
.aiw__quick .aiw__chip:nth-child(n+2) {
  display: none !important;
}

.aiw__quick {
  display: flex !important;
  padding: 12px 14px !important;
}

.aiw__quick button:first-child,
.aiw__quick .aiw__chip:first-child {
  flex: 1 1 auto !important;
  width: 100% !important;
  max-width: none !important;
  height: 46px !important;
  border-radius: 999px !important;
  font-weight: 800 !important;
  font-size: 15px !important;
  white-space: nowrap !important;
}

@media (max-width: 768px) {
  .aiw__quick {
    overflow: hidden !important;
  }

  .aiw__quick button:first-child,
  .aiw__quick .aiw__chip:first-child {
    min-width: 0 !important;
    width: 100% !important;
    max-width: none !important;
  }

  .aiw__log {
    min-height: 210px !important;
    max-height: calc(38dvh + 20px) !important;
  }
}


/* === 2026-05-08 AIW final safe position/toggle START === */
.aiw{
  bottom: 96px !important;
}

.aiw-launcher.aiw-launcher--panel-open{
  transform: scale(.62) !important;
  transform-origin: center center !important;
}

@media (min-width: 769px){
  .aiw-launcher.aiw-launcher--panel-open:hover{
    transform: scale(.66) translateY(-1px) !important;
  }
}

@media (max-width: 768px){
  .aiw{
    bottom: 96px !important;
  }

  .aiw-launcher.aiw-launcher--panel-open{
    transform: scale(.62) !important;
  }
}
/* === 2026-05-08 AIW final safe position/toggle END === */


/* === 2026-05-08 AIW window lift/height safe START === */
.aiw {
  bottom: 126px !important; /* было 96px: подняли еще на 30px */
  height: min(610px, calc(100vh - 120px)) !important; /* было около 560px: +50px */
}

@media (max-width: 768px) {
  .aiw {
    bottom: 126px !important;
    height: min(570px, calc(100dvh - 190px)) !important;
    max-height: calc(100dvh - 190px) !important;
  }
}
/* === 2026-05-08 AIW window lift/height safe END === */


/* === 2026-05-08 AIW launcher small-open START === */
.aiw-launcher.aiw-launcher--panel-open {
  transform: scale(.74) !important;
  transform-origin: center center !important;
}

@media (min-width: 769px) {
  .aiw-launcher.aiw-launcher--panel-open:hover {
    transform: scale(.78) translateY(-1px) !important;
  }
}
/* === 2026-05-08 AIW launcher small-open END === */
