
/* Real AI assistant */
.ai-fab{
  position:fixed;
  left:18px;
  bottom:92px;
  z-index:9996;
  width:58px;
  height:58px;
  border-radius:999px;
  border:0;
  background:linear-gradient(135deg,var(--gold,#c9a961),#9f7b31);
  color:#fff;
  box-shadow:0 14px 34px rgba(80,50,10,.28);
  font-size:1.25rem;
  cursor:pointer;
}
.ai-box{
  position:fixed;
  left:18px;
  bottom:160px;
  width:min(410px,calc(100vw - 36px));
  height:min(640px,calc(100vh - 190px));
  max-height:calc(100vh - 120px);
  background:var(--surface,#fff);
  color:var(--text-primary,#1d1a16);
  border:1px solid rgba(201,169,97,.22);
  border-radius:24px;
  box-shadow:0 26px 80px rgba(0,0,0,.30);
  z-index:9997;
  display:none;
  overflow:hidden;
  flex-direction:column;
  isolation:isolate;
}
.ai-box.open{display:flex}
.ai-head{
  flex:0 0 auto;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:.75rem;
  padding:.95rem 1rem;
  border-bottom:1px solid rgba(201,169,97,.16);
  background:linear-gradient(135deg,rgba(201,169,97,.18),rgba(201,169,97,.04));
}
.ai-head strong{display:block;font-size:1rem;font-weight:900}
.ai-head small{display:block;font-size:.72rem;color:var(--text-secondary,#7b6f61);margin-top:.12rem}
.ai-status-line::before{
  content:'';
  display:inline-block;
  width:7px;
  height:7px;
  border-radius:50%;
  background:#d6a84f;
  margin-inline-end:.35rem;
  vertical-align:middle;
}
.ai-ready .ai-status-line::before{background:#22c55e}
.ai-catalog-mode .ai-status-line::before{background:#f59e0b}
.ai-head-actions{display:flex;align-items:center;gap:.35rem;flex-shrink:0}
.ai-head-actions button{
  width:38px;
  height:38px;
  border-radius:12px;
  border:1px solid rgba(201,169,97,.22);
  background:rgba(255,255,255,.65);
  color:inherit;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  font-size:.95rem;
}
.ai-head-actions .ai-close{
  position:static!important;
  inset:auto!important;
  transform:none!important;
}
.ai-messages{
  flex:1 1 auto;
  min-height:0;
  padding:1rem;
  display:flex;
  flex-direction:column;
  gap:.65rem;
  overflow:auto;
  overscroll-behavior:contain;
}
.ai-concierge{
  flex:0 0 auto;
  margin:.65rem .85rem 0;
  padding:.75rem;
  border:1px solid rgba(201,169,97,.18);
  border-radius:18px;
  background:linear-gradient(135deg,rgba(201,169,97,.12),rgba(255,255,255,.04));
}
.ai-concierge-title{
  display:flex;
  align-items:center;
  gap:.45rem;
  font-size:.82rem;
  font-weight:900;
  color:var(--gold,#c9a961);
  margin-bottom:.55rem;
}
.ai-catalog-mode .ai-concierge{
  background:linear-gradient(135deg,rgba(245,158,11,.10),rgba(201,169,97,.08));
  border-color:rgba(245,158,11,.22);
}
.ai-concierge-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:.45rem;
}
.ai-concierge select,
.ai-concierge input{
  min-width:0;
  height:38px;
  border:1px solid rgba(201,169,97,.22);
  border-radius:12px;
  background:var(--surface,#fff);
  color:inherit;
  padding:0 .55rem;
  font-family:inherit;
  font-weight:700;
  outline:0;
}
.ai-concierge .ai-recommend{
  height:38px;
  border:0;
  border-radius:12px;
  background:var(--gold,#c9a961);
  color:#fff;
  font-family:inherit;
  font-weight:900;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:.35rem;
}
.ai-msg{
  max-width:86%;
  padding:.75rem .85rem;
  border-radius:16px;
  font-size:.9rem;
  line-height:1.75;
  word-break:break-word;
}
.ai-bot{background:rgba(201,169,97,.12);align-self:flex-start}
.ai-user{background:var(--gold,#c9a961);color:#fff;align-self:flex-end}
.ai-msg.typing{opacity:.78}
.ai-msg.typing::after{content:' ✨';animation:aiPulse 1s infinite alternate}
@keyframes aiPulse{from{opacity:.25}to{opacity:1}}
.ai-suggestions{
  flex:0 0 auto;
  display:flex;
  gap:.45rem;
  overflow-x:auto;
  padding:.65rem .85rem 0;
  scrollbar-width:none;
}
.ai-suggestions::-webkit-scrollbar{display:none}
.ai-suggestions button{
  flex:0 0 auto;
  border:1px solid rgba(201,169,97,.22);
  background:rgba(201,169,97,.08);
  color:inherit;
  border-radius:999px;
  padding:.42rem .7rem;
  font-family:inherit;
  font-weight:800;
  font-size:.78rem;
  cursor:pointer;
}
.ai-form{
  flex:0 0 auto;
  display:flex;
  gap:.5rem;
  padding:.85rem;
  border-top:1px solid rgba(201,169,97,.16);
  background:color-mix(in srgb,var(--surface,#fff) 92%,var(--gold,#c9a961) 8%);
}
.ai-form input{
  flex:1;
  min-width:0;
  height:46px;
  border:1px solid rgba(201,169,97,.24);
  border-radius:16px;
  padding:0 .85rem;
  background:var(--surface,#fff);
  color:inherit;
  font-family:inherit;
  outline:0;
}
.ai-form input:focus{border-color:var(--gold,#c9a961);box-shadow:0 0 0 4px rgba(201,169,97,.14)}
.ai-form button{
  height:46px;
  border:0;
  border-radius:16px;
  padding:0 .95rem;
  background:var(--gold,#c9a961);
  color:white;
  font-weight:900;
  font-family:inherit;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:.4rem;
  cursor:pointer;
}
.ai-products{
  display:grid;
  gap:.45rem;
  width:100%;
  align-self:stretch;
}
.ai-product{
  display:grid;
  grid-template-columns:42px 1fr auto;
  align-items:center;
  gap:.65rem;
  text-decoration:none;
  color:inherit;
  border:1px solid rgba(201,169,97,.18);
  border-radius:14px;
  padding:.55rem .65rem;
  font-size:.84rem;
  background:rgba(255,255,255,.48);
}
.ai-product img{
  width:42px;
  height:42px;
  object-fit:cover;
  border-radius:10px;
  background:#eee6d9;
}
.ai-product span{min-width:0;font-weight:800}
.ai-product small{display:block;font-weight:600;color:var(--text-secondary,#7b6f61);font-size:.7rem;margin-top:.08rem}
.ai-product b{color:var(--gold,#c9a961);white-space:nowrap}

@media(max-width:720px){
  .ai-fab{
    left:14px;
    bottom:86px;
    width:54px;
    height:54px;
  }
  .ai-box{
    left:10px;
    right:10px;
    bottom:calc(84px + env(safe-area-inset-bottom,0px));
    width:auto;
    height:min(560px,calc(100vh - 120px));
    max-height:calc(100vh - 110px);
    border-radius:22px;
  }
  .ai-head{padding:.85rem}
  .ai-head-actions button{width:40px;height:40px}
  .ai-msg{max-width:92%;font-size:.88rem}
  .ai-form button span{display:none}
  .ai-form button{width:48px;padding:0}
}

/* AI assistant v3: product-first shopping UI */
.ai-fab{
  display:inline-flex;
  align-items:center;
  justify-content:center;
}
.ai-fab span{
  position:absolute;
  width:10px;
  height:10px;
  border-radius:50%;
  background:#22c55e;
  inset-inline-end:7px;
  top:8px;
  border:2px solid #fff;
}
.ai-head{
  gap:.7rem;
  justify-content:flex-start;
}
.ai-avatar{
  width:42px;
  height:42px;
  flex:0 0 42px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius:15px;
  background:linear-gradient(135deg,var(--gold,#c9a961),#8d6b2a);
  color:#fff;
  box-shadow:0 12px 24px rgba(201,169,97,.25);
}
.ai-head-copy{min-width:0;flex:1}
.ai-head-copy strong,
.ai-head-copy small{
  overflow:hidden;
  text-overflow:ellipsis;
}
.ai-planner{
  flex:0 0 auto;
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:.45rem;
  padding:.72rem .85rem .2rem;
}
.ai-planner button{
  min-width:0;
  min-height:54px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:.28rem;
  border:1px solid rgba(201,169,97,.2);
  border-radius:14px;
  background:rgba(201,169,97,.08);
  color:inherit;
  font-family:inherit;
  font-weight:900;
  cursor:pointer;
}
.ai-planner i{color:var(--gold,#c9a961)}
.ai-planner span{
  max-width:100%;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-size:.72rem;
}
.ai-send:disabled,
.ai-recommend:disabled{
  opacity:.68;
  cursor:wait;
}
.ai-product{
  grid-template-columns:48px minmax(0,1fr) auto;
  padding:.58rem;
}
.ai-product-media{
  width:48px;
  height:48px;
  display:block;
  border-radius:13px;
  overflow:hidden;
  background:rgba(201,169,97,.12);
}
.ai-product-media img,
.ai-product-fallback{
  width:100%;
  height:100%;
  display:flex;
  align-items:center;
  justify-content:center;
  object-fit:cover;
  color:var(--gold,#c9a961);
}
.ai-product-copy{
  min-width:0;
  color:inherit;
  text-decoration:none;
}
.ai-product-copy b{
  display:block;
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  color:inherit;
}
.ai-product-action{
  display:grid;
  justify-items:end;
  gap:.35rem;
}
.ai-product-action strong{
  color:var(--gold,#c9a961);
  white-space:nowrap;
}
.ai-product-action button{
  width:34px;
  height:34px;
  border:0;
  border-radius:12px;
  background:var(--gold,#c9a961);
  color:#fff;
  cursor:pointer;
}
.ai-product-buttons{
  display:flex;
  align-items:center;
  gap:.3rem;
}
.ai-product-buttons button:first-child{
  background:#17864b;
}
.ai-product-buttons button.added{
  background:#13703f;
}
.ai-match-reason{
  color:#17864b!important;
  white-space:normal!important;
  line-height:1.35;
}
.ai-followups,
.ai-actions{
  display:flex;
  flex-wrap:wrap;
  gap:.4rem;
  width:100%;
}
.ai-followups button,
.ai-actions button,
.ai-actions a{
  min-height:36px;
  border:1px solid rgba(201,169,97,.24);
  border-radius:999px;
  padding:.42rem .72rem;
  background:rgba(201,169,97,.09);
  color:inherit;
  font-family:inherit;
  font-size:.75rem;
  font-weight:850;
  text-decoration:none;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:.35rem;
}
.ai-actions button,
.ai-actions a{
  border-radius:12px;
  background:var(--gold,#c9a961);
  color:#fff;
}
@media(max-width:720px){
  .ai-planner{
    grid-template-columns:repeat(4,minmax(62px,1fr));
    gap:.35rem;
    padding:.6rem .65rem .1rem;
  }
  .ai-planner button{
    min-height:50px;
    border-radius:13px;
  }
  .ai-concierge-grid{
    grid-template-columns:1fr 1fr!important;
  }
  .ai-product{
    grid-template-columns:44px minmax(0,1fr) auto;
  }
  .ai-product-media{width:44px;height:44px}
}

/* Mobile assistant: behave like a real app screen, not a cramped floating card. */
@media(max-width:720px){
  body.ai-assistant-open{
    overflow:hidden!important;
  }
  body.ai-assistant-open .mobile-bottom-nav{
    opacity:0!important;
    pointer-events:none!important;
    transform:translateY(120%)!important;
  }
  body.ai-assistant-open .ai-fab{
    opacity:0!important;
    pointer-events:none!important;
    transform:scale(.86)!important;
  }
  .ai-box.open{
    inset:calc(env(safe-area-inset-top,0px) + 8px) 8px calc(env(safe-area-inset-bottom,0px) + 8px) 8px!important;
    width:auto!important;
    height:auto!important;
    max-height:none!important;
    border-radius:22px!important;
    box-shadow:0 24px 80px rgba(0,0,0,.32)!important;
  }
  .ai-head{
    min-height:62px!important;
    padding:.62rem .68rem!important;
    gap:.55rem!important;
  }
  .ai-avatar{
    width:38px!important;
    height:38px!important;
    flex-basis:38px!important;
    border-radius:14px!important;
  }
  .ai-head-copy strong{
    font-size:.94rem!important;
    line-height:1.25!important;
    white-space:nowrap!important;
  }
  .ai-head-copy small{
    max-width:100%!important;
    font-size:.66rem!important;
    line-height:1.45!important;
    display:block!important;
    white-space:nowrap!important;
  }
  .ai-head-actions button{
    width:36px!important;
    height:36px!important;
    border-radius:13px!important;
  }
  .ai-planner{
    grid-template-columns:repeat(4,minmax(0,1fr))!important;
    padding:.55rem .62rem .12rem!important;
    gap:.32rem!important;
  }
  .ai-planner button{
    min-height:46px!important;
    border-radius:13px!important;
    padding:.28rem!important;
  }
  .ai-planner i{
    font-size:.9rem!important;
  }
  .ai-planner span{
    font-size:.66rem!important;
  }
  .ai-messages{
    padding:.62rem!important;
    gap:.5rem!important;
  }
  .ai-msg{
    max-width:94%!important;
    padding:.62rem .72rem!important;
    border-radius:15px!important;
    font-size:.84rem!important;
    line-height:1.65!important;
  }
  .ai-concierge{
    margin:.2rem .62rem 0!important;
    padding:.58rem!important;
    border-radius:16px!important;
  }
  .ai-concierge-title{
    margin-bottom:.42rem!important;
    font-size:.76rem!important;
  }
  .ai-concierge-grid{
    grid-template-columns:1fr 1fr!important;
    gap:.38rem!important;
  }
  .ai-concierge select,
  .ai-concierge input,
  .ai-concierge .ai-recommend{
    height:38px!important;
    min-width:0!important;
    border-radius:13px!important;
    font-size:.8rem!important;
  }
  .ai-concierge .ai-recommend{
    padding:0 .5rem!important;
  }
  .ai-suggestions{
    display:none!important;
  }
  .ai-form{
    padding:.62rem!important;
    gap:.45rem!important;
  }
  .ai-form input{
    height:44px!important;
    border-radius:15px!important;
    font-size:.88rem!important;
  }
  .ai-form button{
    width:50px!important;
    height:44px!important;
    flex:0 0 50px!important;
    border-radius:15px!important;
  }
  .ai-product{
    grid-template-columns:42px minmax(0,1fr) auto!important;
    gap:.5rem!important;
    padding:.48rem!important;
    border-radius:13px!important;
  }
  .ai-product-media{
    width:42px!important;
    height:42px!important;
  }
  .ai-product-copy b{
    font-size:.8rem!important;
  }
  .ai-product-action strong{
    font-size:.78rem!important;
  }
  .ai-product-action button{
    width:32px!important;
    height:32px!important;
  }
  .ai-product-buttons{
    gap:.2rem!important;
  }
  .ai-followups button,
  .ai-actions button,
  .ai-actions a{
    min-height:34px!important;
    font-size:.7rem!important;
    padding:.38rem .62rem!important;
  }
}

@media(max-width:380px){
  .ai-planner{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }
  .ai-planner button{
    min-height:40px!important;
    flex-direction:row!important;
  }
}

/* Keep WhatsApp and AI as separate mobile support actions. */
@media (max-width:768px){
  .ai-fab{
    bottom:calc(var(--bottom-nav-h,64px) + env(safe-area-inset-bottom,0px) + 18px)!important;
    inset-inline-start:16px!important;
    left:auto!important;
    right:auto!important;
    width:54px!important;
    height:54px!important;
    z-index:9996!important;
  }

  .ai-box{
    bottom:calc(var(--bottom-nav-h,64px) + env(safe-area-inset-bottom,0px) + 86px)!important;
  }
}
