/* Medel Chat — widget */
#medel-chat-root{
  --medel-chat-primary:#5b4dbe;
  --mc-on-p:#ffffff;
  --mc-accent:#f5c518;
  --mc-bot:#ffffff;
  --mc-bot-text:#1d2433;
  --mc-bg:#f7f7fb;
  --mc-radius:18px;
  --mc-font:inherit;
  --mc-p:var(--medel-chat-primary);
  --mc-p2:color-mix(in srgb,var(--mc-p) 78%,#000);
  --mc-soft:color-mix(in srgb,var(--mc-p) 10%,var(--mc-bot));
  --mc-surface:#ffffff;
  --mc-text:#1d2433;
  --mc-muted:#667085;
  --mc-border:color-mix(in srgb,var(--mc-p) 12%,#e6e6ef);
  --mc-shadow:0 24px 60px rgba(20,20,50,.22);
  --mc-r-sm:calc(var(--mc-radius) * .66);
  --mc-w:380px; --mc-h:600px;
  /* Automatic values of the detailed colors (overridden in dark mode). */
  --mc-q-tx-auto:var(--mc-p);
  --mc-q-bd-auto:color-mix(in srgb,var(--mc-p) 30%,transparent);
  --mc-link-auto:var(--mc-p);
  --mc-sd-bg-auto:var(--mc-p);
  position:fixed; bottom:22px; right:22px; z-index:2147483000;
  font-family:var(--mc-font); color:var(--mc-text); line-height:1.5;
}
#medel-chat-root *{ box-sizing:border-box; }
#medel-chat-root[data-position="bottom-left"]{ right:auto; left:22px; }
#medel-chat-root[data-size="small"]{ --mc-w:340px; --mc-h:520px; }
#medel-chat-root[data-size="large"]{ --mc-w:430px; --mc-h:680px; }
#medel-chat-root button,#medel-chat-root textarea{ font-family:var(--mc-font); }

/* Bubble */
#medel-chat-bubble{
  position:relative; width:62px; height:62px; border-radius:50%; padding:0;
  background:linear-gradient(135deg,var(--mc-p),var(--mc-p2)); color:var(--mc-on-p); border:0; cursor:pointer;
  display:flex; align-items:center; justify-content:center; box-shadow:0 12px 30px color-mix(in srgb,var(--mc-p) 45%,transparent);
  transition:transform .2s ease; min-width:0 !important; min-height:0 !important; margin:0 !important; text-transform:none !important; letter-spacing:normal !important;
}
#medel-chat-bubble:hover{ transform:scale(1.06); }
#medel-chat-bubble:focus-visible{ outline:3px solid color-mix(in srgb,var(--mc-p) 40%,#fff); outline-offset:3px; }
.medel-chat-bubble__icon{ width:28px; height:28px; position:absolute; transition:opacity .2s, transform .2s; }
.medel-chat-ic-close{ opacity:0; transform:rotate(-90deg); }
.medel-chat-bubble__img{ width:100%; height:100%; border-radius:50%; object-fit:cover; }
#medel-chat-root.is-open .medel-chat-ic-open{ opacity:0; transform:rotate(90deg); }
#medel-chat-root.is-open .medel-chat-ic-close{ opacity:1; transform:none; }
.medel-chat-bubble__badge{
  position:absolute; top:-3px; inset-inline-start:-3px; background:var(--mc-accent); color:var(--mc-bd-tx,#1a1a1a);
  font-size:10px; font-weight:800; padding:2px 6px; border-radius:8px; line-height:1.4;
}
#medel-chat-root.is-open .medel-chat-bubble__badge{ display:none; }
.medel-chat-bubble__pulse{ position:absolute; inset:-6px; border-radius:50%; background:var(--mc-p); opacity:0; pointer-events:none; }
#medel-chat-root[data-animation="pulse"]:not(.is-open) .medel-chat-bubble__pulse{ animation:medelChatPulse 2.2s infinite; }
#medel-chat-root[data-animation="bounce"]:not(.is-open) #medel-chat-bubble{ animation:medelChatBounce 2.6s infinite; }
@keyframes medelChatPulse{ 0%{ transform:scale(.95); opacity:.45; } 70%,100%{ transform:scale(1.35); opacity:0; } }
@keyframes medelChatBounce{ 0%,20%,50%,80%,100%{ transform:translateY(0); } 40%{ transform:translateY(-9px); } 60%{ transform:translateY(-4px); } }

/* Popup hint */
.medel-chat-popup{
  position:absolute; bottom:76px; right:0; width:max-content; max-width:250px; padding:11px 15px; border-radius:var(--mc-r-sm);
  background:var(--mc-pp-bg,var(--mc-surface)); color:var(--mc-pp-tx,var(--mc-text)); font-size:14px; font-weight:600; box-shadow:0 10px 26px rgba(0,0,0,.14);
  cursor:pointer; display:none;
}
#medel-chat-root[data-position="bottom-left"] .medel-chat-popup{ right:auto; left:0; }
.medel-chat-popup.show{ display:block; animation:medelChatFade .3s ease; }
@keyframes medelChatFade{ from{ opacity:0; transform:translateY(8px); } to{ opacity:1; transform:none; } }

/* Window */
.medel-chat-window{
  position:absolute; bottom:78px; right:0; width:var(--mc-w); max-width:calc(100vw - 28px);
  height:var(--mc-h); max-height:calc(100vh - 110px); background:var(--mc-bg); border-radius:var(--mc-radius);
  box-shadow:var(--mc-shadow); display:none; flex-direction:column; overflow:hidden; border:1px solid var(--mc-border);
}
#medel-chat-root[data-position="bottom-left"] .medel-chat-window{ right:auto; left:0; }
.medel-chat-window.open{ display:flex; animation:medelChatOpen .25s ease; }
@keyframes medelChatOpen{ from{ opacity:0; transform:translateY(14px) scale(.98); } to{ opacity:1; transform:none; } }

.medel-chat-header{ display:flex; align-items:center; gap:12px; padding:14px 14px 14px 16px; margin:0; background:var(--mc-hd-bg,linear-gradient(135deg,var(--mc-p),var(--mc-p2))); color:var(--mc-hd-tx,var(--mc-on-p)); }
.medel-chat-header__avatar{ width:42px; height:42px; flex:none; border-radius:50%; overflow:hidden; background:color-mix(in srgb,var(--mc-hd-tx,var(--mc-on-p)) 16%,transparent); display:flex; align-items:center; justify-content:center; }
.medel-chat-header__avatar svg{ width:22px; height:22px; }
.medel-chat-header__avatar img{ width:100%; height:100%; object-fit:cover; background:#fff; }
.medel-chat-header__meta{ flex:1; min-width:0; }
.medel-chat-header__title{ font-weight:800; font-size:15.5px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.medel-chat-header__status{ font-size:12px; opacity:.9; display:flex; align-items:center; gap:6px; margin-top:1px; }
.medel-chat-dot{ width:8px; height:8px; border-radius:50%; background:#22c55e; box-shadow:0 0 0 3px rgba(34,197,94,.28); }
.medel-chat-header__actions{ display:flex; gap:4px; flex:none; }
/* Theme styles for <button> must not change these (size, padding, colors). */
#medel-chat-root .medel-chat-btn-icon{ background:transparent !important; border:0 !important; color:inherit !important; cursor:pointer; width:36px !important; height:36px !important; min-width:36px !important; min-height:0 !important; border-radius:10px !important; display:flex !important; align-items:center; justify-content:center; padding:0 !important; margin:0 !important; box-shadow:none !important; line-height:1 !important; }
#medel-chat-root .medel-chat-btn-icon svg{ display:block !important; width:20px !important; height:20px !important; flex:none; stroke:currentColor; fill:none; }
#medel-chat-root .medel-chat-btn-icon:hover,#medel-chat-root .medel-chat-btn-icon:focus-visible{ background:color-mix(in srgb,currentColor 16%,transparent) !important; }

/* Messages */
.medel-chat-body{ flex:1; padding:16px 14px; overflow-y:auto; overscroll-behavior:contain; background:var(--mc-bg); }
.medel-chat-msg{ display:flex; margin-bottom:10px; }
.medel-chat-msg.user{ justify-content:flex-end; }
.medel-chat-bubble-msg{ max-width:84%; padding:10px 13px; border-radius:var(--mc-r-sm); font-size:14.5px; line-height:1.65; word-wrap:break-word; overflow-wrap:anywhere; box-shadow:0 1px 2px rgba(0,0,0,.05); }
.medel-chat-msg.bot .medel-chat-bubble-msg{ background:var(--mc-bot); color:var(--mc-bot-text); border:1px solid var(--mc-border); border-end-start-radius:4px; }
.medel-chat-msg.user .medel-chat-bubble-msg{ background:var(--mc-u-bg,var(--mc-p)); color:var(--mc-u-tx,var(--mc-on-p)); border-end-end-radius:4px; }
.medel-chat-bubble-msg a{ color:var(--mc-link,var(--mc-link-auto)); font-weight:700; text-decoration:underline; }
.medel-chat-msg.user .medel-chat-bubble-msg a{ color:var(--mc-u-tx,var(--mc-on-p)); }
.medel-chat-bubble-msg a.medel-chat-wa{ display:inline-flex; align-items:center; gap:6px; margin:4px 0; padding:6px 12px; border-radius:999px; background:#25d366; color:#fff !important; text-decoration:none; direction:ltr; unicode-bidi:isolate; }
.medel-chat-time{ font-size:10.5px; opacity:.6; margin-top:4px; text-align:end; }

.medel-chat-typing{ display:inline-flex; gap:4px; padding:12px 14px; background:var(--mc-bot); border:1px solid var(--mc-border); border-radius:var(--mc-r-sm); }
.medel-chat-typing span{ width:7px; height:7px; border-radius:50%; background:var(--mc-muted); animation:medelChatTyp 1.2s infinite ease-in-out; }
.medel-chat-typing span:nth-child(2){ animation-delay:.15s; } .medel-chat-typing span:nth-child(3){ animation-delay:.3s; }
@keyframes medelChatTyp{ 0%,80%,100%{ transform:scale(.6); opacity:.5; } 40%{ transform:scale(1); opacity:1; } }

/* Product cards */
.medel-chat-cards{ display:flex; flex-direction:column; gap:8px; margin-top:10px; }
.medel-chat-card{ display:flex; gap:10px; align-items:center; padding:8px; border-radius:var(--mc-r-sm); background:var(--mc-soft); border:1px solid var(--mc-border); text-decoration:none !important; color:inherit !important; }
.medel-chat-card img{ width:58px; height:58px; flex:none; border-radius:10px; object-fit:cover; background:#eee; }
.medel-chat-card__body{ display:flex; flex-direction:column; min-width:0; gap:2px; }
.medel-chat-card__title{ font-size:13.5px; font-weight:800; color:var(--mc-bot-text); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.medel-chat-card__price{ font-size:13px; font-weight:800; color:var(--mc-p); }
.medel-chat-card__go{ font-size:12px; color:var(--mc-muted); text-decoration:underline; }

/* Quick actions */
.medel-chat-quick{ display:flex; flex-wrap:wrap; gap:7px; padding:0 14px 12px; background:var(--mc-bg); }
.medel-chat-quick[hidden]{ display:none; }
#medel-chat-root .medel-chat-quick button{ padding:7px 13px !important; margin:0 !important; border-radius:999px !important; background:var(--mc-q-bg,var(--mc-surface)) !important; border:1px solid var(--mc-q-bd,var(--mc-q-bd-auto)) !important; color:var(--mc-q-tx,var(--mc-q-tx-auto)) !important; font-size:13px !important; font-weight:700 !important; line-height:1.35 !important; min-height:0 !important; text-transform:none !important; letter-spacing:normal !important; box-shadow:none !important; cursor:pointer; }
#medel-chat-root .medel-chat-quick button:hover,#medel-chat-root .medel-chat-quick button:focus-visible{ background:var(--mc-q-tx,var(--mc-q-tx-auto)) !important; color:var(--mc-q-bg,var(--mc-surface)) !important; border-color:var(--mc-q-tx,var(--mc-q-tx-auto)) !important; }

/* Input */
.medel-chat-footer{ display:flex; align-items:flex-end; gap:8px; padding:10px 12px; margin:0; background:var(--mc-surface); border-top:1px solid var(--mc-border); }
#medel-chat-input{ flex:1; min-width:0; margin:0; resize:none; border:1px solid var(--mc-border); background:var(--mc-in-bg,var(--mc-bg)); border-radius:min(20px,var(--mc-radius)); padding:10px 14px; font:inherit; font-size:14.5px; line-height:1.4; color:var(--mc-in-tx,var(--mc-text)); outline:none; max-height:110px; box-shadow:none; }
#medel-chat-input::placeholder{ color:var(--mc-in-tx,var(--mc-muted)); opacity:.6; }
#medel-chat-input:focus{ border-color:var(--mc-sd-bg,var(--mc-sd-bg-auto)); background:var(--mc-in-bg,var(--mc-surface)); }
#medel-chat-root .medel-chat-btn-send{ width:42px !important; height:42px !important; min-width:42px !important; min-height:0 !important; flex:none; border-radius:50% !important; border:0 !important; padding:0 !important; margin:0 !important; background:var(--mc-sd-bg,var(--mc-sd-bg-auto)) !important; color:var(--mc-sd-tx,var(--mc-on-p)) !important; display:flex !important; align-items:center; justify-content:center; cursor:pointer; box-shadow:none !important; }
#medel-chat-root .medel-chat-btn-send:hover{ filter:brightness(.9); }
.medel-chat-btn-send:disabled{ opacity:.55; cursor:default; }
#medel-chat-root .medel-chat-btn-send svg{ display:block !important; width:18px !important; height:18px !important; fill:currentColor; }
#medel-chat-root[dir="rtl"] .medel-chat-btn-send svg{ transform:scaleX(-1); }
.medel-chat-brand{ padding:6px 12px 8px; background:var(--mc-surface); text-align:center; font-size:11px; color:var(--mc-muted); }
.medel-chat-brand a{ color:var(--mc-link,var(--mc-link-auto)); font-weight:700; text-decoration:none; }

/* Header placement: the button is part of the site header (next to the menu button or the logo). */
#medel-chat-root[data-position^="header"]{ top:0; bottom:auto; }
#medel-chat-root[data-position^="header"]:not(.mc-hdr-ready){ visibility:hidden; }
#medel-chat-hslot{ position:relative; display:inline-flex !important; align-items:center; justify-content:center; flex:none !important; align-self:center !important; width:auto !important; margin:0 10px !important; padding:0 !important; line-height:1; vertical-align:middle; z-index:50; --mc-bub:40px; font-family:var(--mc-font,inherit); }
#medel-chat-hslot *{ box-sizing:border-box; }
#medel-chat-hslot #medel-chat-bubble{ width:var(--mc-bub) !important; height:var(--mc-bub) !important; padding:0 !important; border-radius:50% !important; box-shadow:0 0 0 2px color-mix(in srgb,var(--mc-on-p) 55%,transparent),0 4px 12px rgba(0,0,0,.18); }
#medel-chat-hslot #medel-chat-bubble:hover{ transform:scale(1.06); }
#medel-chat-hslot .medel-chat-bubble__icon{ width:20px; height:20px; }
#medel-chat-hslot .medel-chat-bubble__img{ width:100%; height:100%; }
#medel-chat-hslot .medel-chat-bubble__badge{ font-size:8px; padding:1px 4px; top:-6px; }
#medel-chat-hslot .medel-chat-bubble__pulse{ inset:-4px; }
#medel-chat-hslot.is-open .medel-chat-ic-open{ opacity:0; transform:rotate(90deg); }
#medel-chat-hslot.is-open .medel-chat-ic-close{ opacity:1; transform:none; }
#medel-chat-hslot.is-open .medel-chat-bubble__badge{ display:none; }
#medel-chat-hslot[data-animation="pulse"]:not(.is-open) .medel-chat-bubble__pulse{ animation:medelChatPulse 2.2s infinite; }
#medel-chat-hslot[data-animation="bounce"]:not(.is-open) #medel-chat-bubble{ animation:medelChatBounce 2.6s infinite; }
#medel-chat-hslot .medel-chat-popup{ position:absolute; bottom:auto; top:calc(100% + 10px); left:0; right:auto; z-index:2147483000; }
#medel-chat-hslot[data-side="right"] .medel-chat-popup{ left:auto; right:0; }
#medel-chat-root[data-position^="header"] .medel-chat-window{ position:fixed; bottom:auto; top:var(--mc-win-top,70px); right:var(--mc-win-x,14px); left:auto; max-height:calc(100vh - var(--mc-win-top,70px) - 14px); }
#medel-chat-root[data-position^="header"][data-side="left"] .medel-chat-window{ right:auto; left:var(--mc-win-x,14px); }
@keyframes medelChatFadeDown{ from{ opacity:0; transform:translateY(-8px); } to{ opacity:1; transform:none; } }
#medel-chat-hslot .medel-chat-popup.show,#medel-chat-root[data-position^="header"] .medel-chat-window.open{ animation-name:medelChatFadeDown; }
/* No header found on the page: floating button at the top. */
#medel-chat-root.mc-hdr-float{ top:12px; right:16px; }
#medel-chat-root.mc-hdr-float #medel-chat-bubble{ width:46px; height:46px; }
#medel-chat-root.mc-hdr-float .medel-chat-popup{ bottom:auto; top:58px; }

.medel-chat-open-btn{ display:inline-flex; align-items:center; gap:8px; padding:12px 22px; border:0; border-radius:12px; background:var(--medel-chat-btn,#5b4dbe); color:#fff; font:inherit; font-weight:700; cursor:pointer; }

@media (max-width:480px){
  #medel-chat-root{ bottom:14px; right:14px; }
  #medel-chat-root[data-position="bottom-left"]{ left:14px; }
  /* Full screen that follows the visible area (browser bars included), so the input never hides behind them. */
  .medel-chat-window{ position:fixed; inset:0 0 auto 0; width:100%; max-width:none; height:100vh; height:100dvh; max-height:none; border-radius:0; border:0; }
  .medel-chat-footer{ padding-bottom:calc(10px + env(safe-area-inset-bottom)); }
  #medel-chat-input{ font-size:16px; }
  #medel-chat-root.is-open #medel-chat-bubble{ display:none; }
  #medel-chat-hslot{ --mc-bub:36px; margin:0 6px !important; }
  #medel-chat-root[data-position^="header"] .medel-chat-window,#medel-chat-root[data-position^="header"][data-side] .medel-chat-window{ top:0; right:0; left:0; bottom:0; max-height:none; }
}

/* Dark mode: forced, or following the visitor's device when "auto". */
#medel-chat-root[data-theme="dark"]{ --mc-bg:#0f1220; --mc-surface:#171b2d; --mc-bot:#1c2135; --mc-bot-text:#eef0f6; --mc-text:#eef0f6; --mc-muted:#9aa3b5; --mc-border:#2a3045; --mc-soft:#1a1f33; --mc-q-tx-auto:color-mix(in srgb,var(--mc-p) 30%,#fff); --mc-q-bd-auto:color-mix(in srgb,var(--mc-p) 55%,#ffffff22); --mc-link-auto:color-mix(in srgb,var(--mc-p) 40%,#fff); --mc-sd-bg-auto:color-mix(in srgb,var(--mc-p) 65%,#fff); }

@media (prefers-color-scheme:dark){
  #medel-chat-root[data-theme="auto"]{ --mc-bg:#0f1220; --mc-surface:#171b2d; --mc-bot:#1c2135; --mc-bot-text:#eef0f6; --mc-text:#eef0f6; --mc-muted:#9aa3b5; --mc-border:#2a3045; --mc-soft:#1a1f33; --mc-q-tx-auto:color-mix(in srgb,var(--mc-p) 30%,#fff); --mc-q-bd-auto:color-mix(in srgb,var(--mc-p) 55%,#ffffff22); --mc-link-auto:color-mix(in srgb,var(--mc-p) 40%,#fff); --mc-sd-bg-auto:color-mix(in srgb,var(--mc-p) 65%,#fff); }

}
@media (prefers-reduced-motion:reduce){
  #medel-chat-root *{ animation:none !important; transition:none !important; }
}
