/* ES-Gift native support chat (support-chat.js). Phone first (390 px), RTL by default. */
#es-support-chat { --sc-wine: #872838; --sc-wine-2: #a04258; --sc-bg: #15151a; --sc-card: #1e1e24;
  --sc-line: #2c2c34; --sc-text: #f2f2f4; --sc-mute: #9a9aa3;
  position: fixed; inset-inline-end: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 100001; font-family: 'Cairo', system-ui, sans-serif; color: var(--sc-text); }
html[dir="rtl"] #es-support-chat { right: 16px; left: auto; }
html[dir="ltr"] #es-support-chat { left: 16px; right: auto; }
#es-support-chat * { box-sizing: border-box; }
.sc-btn { position: relative; width: 56px; height: 56px; border-radius: 50%; border: 0; cursor: pointer;
  background: linear-gradient(135deg, var(--sc-wine), var(--sc-wine-2)); color: #fff;
  box-shadow: 0 6px 22px rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; }
.sc-btn svg { width: 26px; height: 26px; fill: currentColor; }
.sc-btn:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.sc-badge { position: absolute; top: -4px; inset-inline-start: -4px; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 11px; background: #fff; color: var(--sc-wine); font-weight: 800; font-size: 12px; line-height: 22px;
  text-align: center; box-shadow: 0 2px 6px rgba(0,0,0,.4); }
.sc-panel { position: absolute; bottom: 68px; right: 0; width: min(380px, calc(100vw - 24px));
  height: min(560px, calc(100vh - 110px)); height: min(560px, calc(100dvh - 110px));
  display: flex; flex-direction: column; background: var(--sc-bg); border: 1px solid var(--sc-line);
  border-radius: 18px; overflow: hidden; box-shadow: 0 18px 50px rgba(0,0,0,.6); }
.sc-panel[hidden] { display: none; }
html[dir="ltr"] .sc-panel { left: 0; right: auto; }
.sc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px;
  background: linear-gradient(135deg, var(--sc-wine), var(--sc-wine-2)); color: #fff; }
.sc-title { font-weight: 800; font-size: 15px; }
.sc-code { font-weight: 600; opacity: .85; font-size: 13px; direction: ltr; unicode-bidi: isolate; margin: 0 8px; }
.sc-x { background: none; border: 0; color: #fff; font-size: 26px; line-height: 1; cursor: pointer; padding: 0 4px; }
.sc-list { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px;
  overscroll-behavior: contain; }
.sc-hello, .sc-closed { color: var(--sc-mute); font-size: 13px; line-height: 1.8; text-align: center; padding: 8px 6px; }
.sc-msg { max-width: 84%; padding: 7px 11px; border-radius: 14px; font-size: 14px; line-height: 1.7;
  white-space: pre-wrap; overflow-wrap: anywhere; }
.sc-me { align-self: flex-start; background: var(--sc-wine); color: #fff; border-start-start-radius: 4px; }
.sc-support { align-self: flex-end; background: var(--sc-card); border: 1px solid var(--sc-line); border-start-end-radius: 4px; }
.sc-system { align-self: center; background: none; color: var(--sc-mute); font-size: 12px; text-align: center; }
.sc-who { display: block; font-size: 11px; font-weight: 700; opacity: .75; }
.sc-msg img { display: block; max-width: 100%; max-height: 220px; border-radius: 10px; margin-top: 6px; }
.sc-time { display: block; font-size: 10px; opacity: .6; margin-top: 2px; }
.sc-ident { padding: 10px 12px 0; display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--sc-line); }
.sc-ident[hidden] { display: none; }
.sc-ident-note { margin: 0; color: var(--sc-mute); font-size: 12px; line-height: 1.7; }
.sc-ident input { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--sc-line);
  background: var(--sc-card); color: var(--sc-text); font: inherit; font-size: 16px; }
.sc-ident input[dir="ltr"] { text-align: right; }
html[dir="ltr"] .sc-ident input[dir="ltr"] { text-align: left; }
.sc-ident input:focus, .sc-form textarea:focus { outline: none; border-color: var(--sc-wine-2);
  box-shadow: 0 0 0 2px rgba(160,66,88,.35); }
.sc-err { margin: 6px 12px 0; padding: 7px 10px; border-radius: 10px; background: #3a1820; color: #ffd4da; font-size: 13px; }
.sc-err[hidden], .sc-prev[hidden] { display: none; }
.sc-prev { margin: 6px 12px 0; display: flex; justify-content: space-between; align-items: center; gap: 8px;
  font-size: 12px; color: var(--sc-mute); }
.sc-prev-x { background: none; border: 1px solid var(--sc-line); color: var(--sc-text); border-radius: 8px;
  padding: 2px 8px; font: inherit; font-size: 12px; cursor: pointer; }
.sc-form { display: flex; align-items: flex-end; gap: 6px; padding: 10px; border-top: 1px solid var(--sc-line); }
.sc-form textarea { flex: 1; min-width: 0; resize: none; max-height: 120px; padding: 10px 12px; border-radius: 14px;
  border: 1px solid var(--sc-line); background: var(--sc-card); color: var(--sc-text); font: inherit;
  font-size: 16px; line-height: 1.5; }
.sc-attach, .sc-send { flex: 0 0 42px; width: 42px; height: 42px; border-radius: 50%; border: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center; }
.sc-attach { background: var(--sc-card); color: var(--sc-mute); border: 1px solid var(--sc-line); }
.sc-send { background: var(--sc-wine); color: #fff; }
html[dir="rtl"] .sc-send svg { transform: scaleX(-1); }
.sc-send:disabled { opacity: .5; }
.sc-attach svg, .sc-send svg { width: 20px; height: 20px; fill: currentColor; }
@media (max-width: 480px) {
  #es-support-chat.is-open { inset-inline: 0; bottom: 0; }
  html[dir] #es-support-chat.is-open { left: 0; right: 0; }
  #es-support-chat.is-open .sc-btn { display: none; }
  #es-support-chat.is-open .sc-panel { position: fixed; inset: 0; width: 100%; height: 100%; border-radius: 0; border: 0; }
}
