
#ai-chat-messages .oms-ai-product-message{max-width:100%!important;width:100%;min-width:0;box-sizing:border-box}
#ai-chat-messages .oms-ai-products{display:flex;gap:10px;max-width:100%;overflow-x:auto;overscroll-behavior-x:contain;scroll-snap-type:x mandatory;-webkit-overflow-scrolling:touch;padding:8px 2px 12px;scrollbar-width:thin;scrollbar-color:#efb4d0 transparent;direction:rtl}
#ai-chat-messages .oms-ai-product{flex:0 0 min(265px,88%);min-width:0;min-height:116px;display:flex;align-items:center;gap:10px;padding:9px;border:1px solid #f3d2e2;border-radius:16px;background:linear-gradient(130deg,#fff,#fff9fc);box-shadow:0 3px 12px rgba(157,23,77,.06);scroll-snap-align:start;box-sizing:border-box;opacity:0;animation:omsAiCardEnter .42s cubic-bezier(.2,.8,.2,1) both}
#ai-chat-messages .oms-ai-product:only-child{flex-basis:min(100%,350px)}
#ai-chat-messages .oms-ai-product-image{flex:0 0 94px;width:94px;height:94px;border:0;border-radius:12px;background:#fdf2f8;display:flex;align-items:center;justify-content:center;overflow:hidden;cursor:pointer;color:#d9468e;padding:0}
#ai-chat-messages .oms-ai-product-image img{width:100%;height:100%;object-fit:contain;transition:transform .3s ease}
#ai-chat-messages .oms-ai-product-image:active img{transform:scale(.96)}
#ai-chat-messages .oms-ai-product-info{min-width:0;flex:1;display:flex;flex-direction:column;align-items:stretch;gap:5px}
#ai-chat-messages .oms-ai-product-name{background:none;border:0;text-align:right;font:800 12px/1.45 Tajawal,sans-serif;color:#3b1730;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;padding:0;cursor:pointer}
#ai-chat-messages .oms-ai-product-price{font-size:15px;line-height:1.2;font-weight:900;color:#c21870;direction:rtl}
#ai-chat-messages .oms-ai-product-actions{display:flex;align-items:center;gap:6px}
#ai-chat-messages .oms-ai-add{flex:1;display:flex;align-items:center;justify-content:center;gap:5px;background:linear-gradient(110deg,#e3157d,#c21870);color:#fff;border:0;border-radius:10px;padding:8px 5px;font:800 11px Tajawal,sans-serif;white-space:nowrap;cursor:pointer}
#ai-chat-messages .oms-ai-view{flex:0 0 31px;width:31px;height:31px;border:1px solid #f4d1e1;border-radius:10px;background:#fff0f7;color:#bd1768;cursor:pointer}
@keyframes omsAiCardEnter{from{opacity:0;transform:translateY(13px) scale(.975)}to{opacity:1;transform:translateY(0) scale(1)}}
@media(prefers-reduced-motion:reduce){#ai-chat-messages .oms-ai-product{animation:none;opacity:1}}
@media(max-width:380px){#ai-chat-messages .oms-ai-product{flex-basis:min(248px,92%);gap:7px}#ai-chat-messages .oms-ai-product-image{flex-basis:78px;width:78px;height:84px}}

/* One Store: coordinated full-message and product-card reveal (no typing effect) */
#ai-chat-messages .oms-ai-response-enter{
  animation:omsAiResponseReveal .46s cubic-bezier(.19,1,.22,1) both!important;
  transform-origin:top right;
}
@keyframes omsAiResponseReveal{
  0%{opacity:0;transform:translate3d(0,15px,0) scale(.975);filter:blur(3px)}
  65%{filter:blur(0)}
  100%{opacity:1;transform:translate3d(0,0,0) scale(1);filter:blur(0)}
}
#ai-chat-messages .oms-ai-product{
  animation:omsAiCardEnter .55s cubic-bezier(.18,1,.25,1) both!important;
}
@keyframes omsAiCardEnter{
  0%{opacity:0;transform:translate3d(18px,12px,0) scale(.95)}
  100%{opacity:1;transform:translate3d(0,0,0) scale(1)}
}
#ai-chat-messages .oms-ai-view{
  display:inline-flex;align-items:center;justify-content:center;
  min-width:34px;min-height:34px;font-size:15px;
  transition:transform .2s ease,background-color .2s ease;
}
#ai-chat-messages .oms-ai-view:active{transform:scale(.91)}
@media(prefers-reduced-motion:reduce){
  #ai-chat-messages .oms-ai-response-enter,
  #ai-chat-messages .oms-ai-product{animation:none!important;opacity:1!important;transform:none!important;filter:none!important}
}



body.oms-ai-open{overflow:hidden!important}
body.oms-ai-open #cart-modal{position:fixed!important;inset:0!important;z-index:2000001!important;display:block!important}
body.oms-ai-open #cart-backdrop{display:none!important}
body.oms-ai-open #cart-content{position:fixed!important;inset:0!important;width:100%!important;max-width:none!important;height:100dvh!important;min-height:100dvh!important;padding:0!important;border-radius:0!important;transform:none!important;transition:none!important;display:flex!important;flex-direction:column!important;background:#f8f3f5!important}
body.oms-ai-open #cart-content>div:first-child:not(#oms-ai-chat-header),body.oms-ai-open #cart-nav,body.oms-ai-open #cart-footer{display:none!important}
body.oms-ai-open #cart-content>div.flex-grow{flex:1 1 0!important;min-height:0!important;overflow:hidden!important;display:flex!important;flex-direction:column!important}
body.oms-ai-open #cart-view-ai{display:flex!important;flex:1 1 0!important;min-height:0!important;overflow:hidden!important}
body.oms-ai-open #cart-view-ai #ai-chat-messages{flex:1 1 0!important;min-height:0!important;border:0!important;border-radius:0!important;background:#f8f3f5!important;padding:18px 12px!important;overflow-y:auto!important;font-size:14px!important}
body.oms-ai-open #cart-view-ai>div:last-child{padding:10px 12px calc(10px + env(safe-area-inset-bottom,0px))!important;background:#fff!important;box-shadow:0 -3px 20px #4811290a!important;gap:9px!important}
body.oms-ai-open #ai-chat-input{font-size:16px!important;min-height:45px!important;border-radius:24px!important}
body.oms-ai-open #ai-chat-send-btn{border-radius:50%!important;width:44px!important;height:44px!important}
#oms-ai-chat-header{display:none}
body.oms-ai-open #oms-ai-chat-header{display:flex!important;align-items:center;gap:12px;flex:none;min-height:70px;padding:calc(env(safe-area-inset-top,0px) + 10px) 14px 10px;background:linear-gradient(120deg,#a31959,#db2777);color:white;box-shadow:0 2px 15px #77133c30}
#oms-ai-chat-back{width:40px;height:40px;border-radius:50%;display:grid;place-items:center;background:#ffffff20;color:#fff;font-size:20px}
.oms-ai-header-avatar{width:43px;height:43px;display:grid;place-items:center;border-radius:50%;background:#fff2f8;color:#c21870;font-size:22px}
.oms-ai-chat-meta{display:block;font-size:11px;opacity:.87;margin-top:3px}
#ai-chat-messages .oms-ai-reaction-wrap{position:relative;width:fit-content;max-width:100%;margin-bottom:5px}
#ai-chat-messages .oms-ai-reaction-bar{display:flex;gap:3px;justify-content:flex-start;margin-top:3px;direction:ltr}
#ai-chat-messages .oms-ai-react-btn{font-size:16px;line-height:1;border:1px solid transparent;border-radius:12px;padding:4px 6px;background:transparent;opacity:.58;transition:.2s}
#ai-chat-messages .oms-ai-react-btn:hover,#ai-chat-messages .oms-ai-react-btn[aria-pressed="true"]{opacity:1;background:#fce7f3;border-color:#f9a8d4;transform:scale(1.07)}
#ai-chat-messages .oms-ai-reaction-wrap .oms-ai-reaction-selected{position:absolute;bottom:23px;left:5px;background:white;border:1px solid #f4d1e0;border-radius:12px;padding:2px 5px;font-size:13px}
#ai-chat-messages .oms-ai-message-status{display:block;font-size:10px;color:#907985;text-align:left;direction:rtl;padding:1px 8px 2px}
#ai-chat-messages .oms-ai-message-status i{color:#1697bf;margin-left:4px}



/* Compact bubbles: each message hugs its text rather than filling the row. */
#ai-chat-messages > div:not(.oms-ai-product-message):not(.fb-typing-indicator):not(:has(.oms-ai-products)){
 width:fit-content!important;max-width:min(88%,560px)!important;min-width:0!important;
 display:table!important;table-layout:auto!important;overflow-wrap:anywhere;word-break:normal;
}
#ai-chat-messages > div.oms-ai-product-message,#ai-chat-messages > div:has(.oms-ai-products){width:100%!important;max-width:100%!important;display:block!important}
#ai-chat-messages > div:not(.fb-typing-indicator){
 animation:omsAiBubbleSlide .34s cubic-bezier(.16,1,.3,1) both!important;
 transform-origin:top right;will-change:transform,opacity;
}
@keyframes omsAiBubbleSlide{
 from{opacity:0;transform:translate3d(0,13px,0) scale(.94);filter:blur(2px)}
 to{opacity:1;transform:translate3d(0,0,0) scale(1);filter:blur(0)}
}
#ai-chat-messages .oms-ai-message-status{color:rgba(255,255,255,.9)!important;font-weight:700}
#ai-chat-messages .oms-ai-message-status i{color:#fff!important;font-size:12px;filter:drop-shadow(0 1px 1px #0002)}
@media(prefers-reduced-motion:reduce){#ai-chat-messages > div{animation:none!important;will-change:auto!important}}


/* Chat compact mode: the SAME cart bottom-sheet element, sizing and position.
   Never override #cart-content width, max-width, height, bottom, radius or transform. */
body.oms-ai-modal{overflow:hidden!important}
body.oms-ai-modal #cart-modal{z-index:2000001!important}
body.oms-ai-modal #cart-backdrop{display:block!important;opacity:1!important}
body.oms-ai-modal #cart-content{
 display:flex!important;flex-direction:column!important;
 transform:translateY(0)!important;
}
body.oms-ai-modal #cart-content>div:first-child:not(#oms-ai-chat-header),
body.oms-ai-modal #cart-nav,body.oms-ai-modal #cart-footer{display:none!important}
body.oms-ai-modal #cart-content>div.flex-grow{flex:1 1 0!important;min-height:0!important;overflow:hidden!important;display:flex!important;flex-direction:column!important}
body.oms-ai-modal #cart-view-ai{display:flex!important;flex:1 1 0!important;min-height:0!important;overflow:hidden!important}
body.oms-ai-modal #ai-chat-messages{flex:1 1 0!important;min-height:0!important;overflow-y:auto!important;background:#f8f3f5!important;padding:12px!important}
body.oms-ai-modal #cart-view-ai>div:last-child{flex:none!important;padding:10px 12px!important;background:#fff!important}
body.oms-ai-modal #oms-ai-chat-header{display:flex!important;align-items:center;gap:12px;flex:none;padding:12px 14px;background:linear-gradient(120deg,#a31959,#db2777);color:white}
body.oms-ai-modal #ai-chat-input{font-size:16px!important}
body.oms-ai-modal #oms-ai-chat-mode,body.oms-ai-open #oms-ai-chat-mode{display:grid!important;place-items:center}

/* Compact chat: same #cart-content, same cart bottom sheet geometry */
body.oms-ai-modal #cart-content{
 position:absolute!important;top:auto!important;bottom:0!important;left:0!important;right:0!important;
 width:auto!important;max-width:56rem!important;height:88vh!important;max-height:none!important;
 margin-left:auto!important;margin-right:auto!important;border-radius:1.5rem 1.5rem 0 0!important;
 transform:translateY(0)!important;padding:0!important;
}
body.oms-ai-modal #cart-modal{display:block!important}
body.oms-ai-modal #cart-backdrop{display:block!important;opacity:1!important}
body.oms-ai-modal #cart-content>div:first-child:not(#oms-ai-chat-header),
body.oms-ai-open #cart-content>div:first-child:not(#oms-ai-chat-header){display:none!important}
body.oms-ai-modal #oms-ai-chat-header,body.oms-ai-open #oms-ai-chat-header{
 display:flex!important;flex-shrink:0!important;
 background:var(--oms-chat-header-bg,var(--header-gradient))!important;
 color:var(--accent-text,#fff)!important;
}
body.oms-ai-modal #oms-ai-chat-header{border-radius:1.5rem 1.5rem 0 0}
body.oms-ai-open #oms-ai-chat-header{border-radius:0}
body.oms-ai-open #cart-content{padding:0!important}
body.oms-ai-open #cart-content>div.flex-grow,body.oms-ai-modal #cart-content>div.flex-grow{padding:0!important}
body.oms-ai-modal #cart-content{overflow:hidden!important}
body.oms-ai-modal #cart-view-ai,body.oms-ai-open #cart-view-ai{min-height:0!important}
body.oms-ai-modal #oms-ai-chat-back,body.oms-ai-open #oms-ai-chat-back{flex:none}
body:not(.oms-ai-modal):not(.oms-ai-open) #cart-content>div:nth-child(2){
 background:var(--oms-chat-header-bg,var(--header-gradient))!important;
 color:var(--accent-text,#fff)!important;
 padding:12px 16px!important;margin:-20px -20px 12px!important;
 border-radius:1.5rem 1.5rem 0 0;
}
body:not(.oms-ai-modal):not(.oms-ai-open) #cart-modal-main-title,
body:not(.oms-ai-modal):not(.oms-ai-open) #close-cart-btn{color:var(--accent-text,#fff)!important}
body:not(.oms-ai-modal):not(.oms-ai-open) #icon-cart-share,
body:not(.oms-ai-modal):not(.oms-ai-open) #icon-cart-load{background:#ffffff25!important;color:var(--accent-text,#fff)!important}

/* Cart share/import avatars belong exclusively to the cart header. */
body.oms-ai-open .oms-cart-header-actions,
body.oms-ai-modal .oms-cart-header-actions{display:none!important}
body:not(.oms-ai-open):not(.oms-ai-modal) .oms-cart-header-actions{display:flex!important}

/* Minimal chat chrome; action buttons only and fresh avatar. */
#oms-ai-chat-header .oms-ai-header-space{flex:1;min-width:0}
#oms-ai-chat-header .oms-ai-header-avatar{position:relative;width:42px;height:42px;flex:none;border-radius:15px;display:grid;place-items:center;color:white;background:linear-gradient(145deg,#7c3aed,#ec4899 65%,#fb7185);box-shadow:0 4px 14px #4c1d9540;border:1px solid #ffffff65;font-size:20px}
#oms-ai-chat-header .oms-ai-avatar-spark{position:absolute;right:-5px;top:-5px;width:19px;height:19px;border-radius:50%;background:#fff;color:#a21caf;display:grid;place-items:center;font-size:10px;box-shadow:0 2px 5px #0002}
#ai-chat-messages{font-size:15px!important;line-height:1.7!important}
#ai-chat-messages > div:not(.oms-ai-product-message):not(.fb-typing-indicator):not(:has(.oms-ai-products)){max-width:min(94%,680px)!important;font-size:15px!important;line-height:1.65!important}
#ai-chat-messages .oms-ai-message-status{display:inline-flex!important;gap:3px;align-items:center;justify-content:flex-end;font-size:9px!important;opacity:.7;white-space:nowrap;padding:0 3px!important}
#ai-chat-messages .oms-ai-message-status i{font-size:10px!important;margin:0!important}
#ai-chat-messages .oms-ai-reaction-bar{gap:1px!important;opacity:.65}
#ai-chat-messages .oms-ai-react-btn{font-size:13px!important;padding:2px 4px!important}
#ai-chat-messages .oms-ai-bot-reacted{position:absolute;bottom:-10px;left:5px;display:inline-flex;align-items:center;justify-content:center;background:#fff;border:1px solid #fbcfe8;border-radius:20px;min-width:24px;height:22px;padding:0 4px;font-size:15px;box-shadow:0 2px 6px #0002;z-index:2;animation:omsAiReactionPop .25s ease-out both}
@keyframes omsAiReactionPop{from{opacity:0;transform:scale(.6)}to{opacity:1;transform:scale(1)}}

/* Right: avatar and expand. Left: close. */
body.oms-ai-modal #oms-ai-chat-header,body.oms-ai-open #oms-ai-chat-header{direction:rtl!important;display:flex!important;align-items:center!important;gap:10px!important}
#oms-ai-chat-header .oms-ai-header-avatar{order:0!important;margin:0!important}
#oms-ai-chat-header #oms-ai-chat-mode{order:1!important;flex:none!important;margin:0!important;width:39px!important;height:39px!important;display:grid!important;place-items:center!important;background:#ffffff29!important;color:white!important;border-radius:12px!important}
#oms-ai-chat-header .oms-ai-header-space{order:2!important;flex:1!important}
#oms-ai-chat-header #oms-ai-chat-back{order:3!important;flex:none!important;margin:0!important}
/* Main category labels: fit inside each category without cutting long names */
#filter-container .filter-btn>span{display:block!important;box-sizing:border-box!important;max-width:100%!important;white-space:nowrap!important;overflow:visible!important;text-overflow:clip!important;text-align:center!important;line-height:1.5!important;letter-spacing:0!important}
#filter-container .filter-btn{width:clamp(120px,32vw,210px)!important;min-width:0!important;max-width:210px!important;padding:6px 2px!important;box-sizing:border-box!important}
#filter-container .filter-btn .img-wrapper{flex:none!important}
