
.spviet-ai-chatbox{--spv-ai-primary:#8b0714;--spv-ai-gold:#d8a932;position:fixed;right:22px;bottom:22px;z-index:99999;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Noto Sans JP","Noto Sans",Arial,sans-serif}
.spviet-ai-bubble{border:0;border-radius:999px;background:linear-gradient(135deg,var(--spv-ai-primary),#65030f);color:#fff;padding:14px 18px;display:flex;gap:9px;align-items:center;box-shadow:0 18px 42px rgba(64,15,18,.28);cursor:pointer;font-weight:900}
.spviet-ai-bubble span{font-size:20px}.spviet-ai-window{position:absolute;right:0;bottom:68px;width:390px;max-width:calc(100vw - 34px);height:560px;max-height:calc(100vh - 110px);background:#fffdf8;border:1px solid rgba(139,7,20,.18);border-radius:28px;overflow:hidden;box-shadow:0 28px 70px rgba(32,10,12,.28);display:flex;flex-direction:column}
.spviet-ai-window header{background:linear-gradient(135deg,var(--spv-ai-primary),#b41424);color:#fff;padding:16px 18px;display:flex;align-items:center;justify-content:space-between}
.spviet-ai-window header strong{display:block;font-size:18px}.spviet-ai-window header small{display:block;color:#ffe4a6;font-weight:700}.spviet-ai-close{width:34px;height:34px;border-radius:50%;border:0;background:rgba(255,255,255,.15);color:#fff;font-size:25px;cursor:pointer}
.spviet-ai-messages{flex:1;overflow:auto;padding:16px;background:linear-gradient(180deg,#fffdf8,#fff7e8)}.spviet-ai-msg{max-width:86%;padding:11px 13px;border-radius:18px;margin:0 0 10px;line-height:1.45;font-size:14px;word-break:break-word}
.spviet-ai-msg.bot{background:#fff;border:1px solid rgba(139,7,20,.12);color:#321c1e;border-bottom-left-radius:6px}.spviet-ai-msg.user{background:linear-gradient(135deg,#1fa34a,#0f7d32);color:#fff;margin-left:auto;border-bottom-right-radius:6px;font-weight:700}.spviet-ai-msg.loading{opacity:.75}
.spviet-ai-quick{display:flex;gap:7px;overflow-x:auto;padding:10px 12px;border-top:1px solid rgba(139,7,20,.10);background:#fff}.spviet-ai-quick button{white-space:nowrap;border:1px solid rgba(139,7,20,.18);background:#fff7e8;color:var(--spv-ai-primary);border-radius:999px;padding:8px 10px;font-weight:800;cursor:pointer}
.spviet-ai-form{display:grid;grid-template-columns:1fr auto;gap:8px;padding:12px;background:#fff;border-top:1px solid rgba(139,7,20,.10)}.spviet-ai-form input{border:1px solid rgba(139,7,20,.22);border-radius:16px;padding:12px 13px;font-size:14px;outline:none}.spviet-ai-form input:focus{border-color:var(--spv-ai-primary);box-shadow:0 0 0 3px rgba(139,7,20,.08)}
.spviet-ai-form button{border:0;border-radius:16px;background:var(--spv-ai-primary);color:#fff;font-weight:900;padding:0 15px;cursor:pointer}.spviet-ai-links{display:flex;flex-wrap:wrap;gap:7px;margin:4px 0 10px}.spviet-ai-links a{display:inline-flex;padding:7px 10px;border-radius:999px;background:#fff;border:1px solid rgba(139,7,20,.16);color:var(--spv-ai-primary)!important;font-weight:800;text-decoration:none;font-size:12px}
@media(max-width:620px){.spviet-ai-chatbox{right:14px;bottom:86px}.spviet-ai-window{position:fixed;left:10px;right:10px;bottom:80px;width:auto;height:min(620px,calc(100vh - 120px));border-radius:22px}.spviet-ai-bubble b{display:none}}


/* SPVIET AI Chat Box V7.1 close fix */
.spviet-ai-window[hidden],
#spviet-ai-chatbox .spviet-ai-window[hidden]{
  display:none!important;
}
#spviet-ai-chatbox:not(.open) .spviet-ai-window{
  display:none!important;
}
#spviet-ai-chatbox.open .spviet-ai-window{
  display:flex!important;
}
.spviet-ai-close{
  position:relative;
  z-index:5;
  pointer-events:auto!important;
}

.spviet-ai-product-cards{display:grid;grid-template-columns:1fr;gap:8px;margin:4px 0 10px}
.spviet-ai-product-card{display:grid;grid-template-columns:54px 1fr;gap:10px;align-items:center;padding:8px;border:1px solid rgba(139,7,20,.12);border-radius:16px;background:#fff;color:#321c1e!important;text-decoration:none}
.spviet-ai-product-card img{width:54px;height:54px;object-fit:cover;border-radius:12px}
.spviet-ai-product-card b{display:block;font-size:13px;line-height:1.3}
.spviet-ai-product-card em{display:block;font-style:normal;color:#8b0714;font-weight:900;margin-top:3px}


/* SPVIET V7.4: mobile input/send button fix */
.spviet-ai-form{
  grid-template-columns:minmax(0,1fr) auto!important;
  width:100%;
  box-sizing:border-box;
}
.spviet-ai-form input{
  min-width:0!important;
  width:100%!important;
  box-sizing:border-box;
}
.spviet-ai-form button{
  min-width:62px!important;
  height:52px!important;
  white-space:nowrap!important;
  flex-shrink:0!important;
}
@media(max-width:620px){
  .spviet-ai-chatbox{
    left:0!important;
    right:0!important;
    bottom:0!important;
    width:100%!important;
    max-width:100%!important;
  }
  .spviet-ai-window{
    left:0!important;
    right:0!important;
    bottom:0!important;
    width:100vw!important;
    max-width:100vw!important;
    height:calc(100dvh - 84px)!important;
    max-height:calc(100dvh - 84px)!important;
    border-radius:24px 24px 0 0!important;
    box-sizing:border-box!important;
  }
  .spviet-ai-form{
    padding:10px 10px max(12px, env(safe-area-inset-bottom)) 10px!important;
    gap:8px!important;
    background:#fff!important;
  }
  .spviet-ai-form button{
    min-width:64px!important;
    padding:0 12px!important;
    border-radius:18px!important;
  }
  .spviet-ai-quick{
    padding:9px 10px!important;
  }
}


/* SPVIET V7.6 - Mobile UX, draggable chat bubble, active contrast */
.spviet-ai-bubble{
  touch-action:none!important;
  user-select:none!important;
  -webkit-user-select:none!important;
  cursor:grab!important;
}
.spviet-ai-dragging .spviet-ai-bubble{
  cursor:grabbing!important;
  transform:scale(.96)!important;
  box-shadow:0 18px 46px rgba(139,7,20,.36)!important;
}
.spviet-ai-custom-pos{
  position:fixed!important;
  z-index:99996!important;
}
.spviet-ai-quick button:active,
.spviet-ai-links a:active,
.spviet-ai-form button:active,
.spviet-ai-product-card:active{
  background:#8b0714!important;
  color:#fff!important;
  border-color:#8b0714!important;
  opacity:1!important;
  filter:none!important;
}
.spviet-ai-quick button:focus,
.spviet-ai-links a:focus,
.spviet-ai-form button:focus{
  outline:3px solid rgba(19,151,69,.35)!important;
  outline-offset:2px!important;
}
.spviet-ai-quick button.is-loading,
.spviet-ai-links a.is-loading{
  background:#139745!important;
  color:#fff!important;
  border-color:#139745!important;
}

/* Move third-party language widgets away from bottom hood on phone/tablet */
@media(max-width:1024px){
  .gtranslate_wrapper,
  .gt_float_switcher,
  .gt_switcher_wrapper,
  .goog-te-gadget,
  .translatepress-floating-language-switcher,
  .trp-language-switcher-container,
  [class*="gtranslate"],
  [id*="gtranslate"]{
    z-index:99970!important;
  }
}
@media(max-width:620px){
  #spviet-ai-chatbox:not(.open){
    left:14px!important;
    right:auto!important;
    bottom:calc(86px + env(safe-area-inset-bottom))!important;
  }
  #spviet-ai-chatbox.spviet-ai-custom-pos:not(.open){
    bottom:auto!important;
  }
  #spviet-ai-chatbox.open{
    left:0!important;
    right:0!important;
    bottom:0!important;
    top:auto!important;
  }
  .gtranslate_wrapper,
  .gt_float_switcher,
  .gt_switcher_wrapper,
  .translatepress-floating-language-switcher,
  .trp-language-switcher-container,
  [class*="gtranslate"],
  [id*="gtranslate"]{
    bottom:calc(92px + env(safe-area-inset-bottom))!important;
    right:12px!important;
    max-width:190px!important;
    transform:scale(.88);
    transform-origin:right bottom;
  }
}
@media(min-width:621px) and (max-width:1024px){
  #spviet-ai-chatbox:not(.open){
    left:18px!important;
    right:auto!important;
    bottom:calc(96px + env(safe-area-inset-bottom))!important;
  }
  #spviet-ai-chatbox.spviet-ai-custom-pos:not(.open){
    bottom:auto!important;
  }
  .gtranslate_wrapper,
  .gt_float_switcher,
  .gt_switcher_wrapper,
  .translatepress-floating-language-switcher,
  .trp-language-switcher-container,
  [class*="gtranslate"],
  [id*="gtranslate"]{
    bottom:calc(104px + env(safe-area-inset-bottom))!important;
    right:18px!important;
  }
}
