/* =============================================================================
   giftchat.css — gifts.wtf "Request to Chat" POPUP (index.html marketplace).

   A minimizable chat widget bottom-right, on-brand with the rest of gifts.wtf:
   every colour is drawn from the shared theme palette (--void/--panel/--raised/
   --hairline/--ink-*/--p*/--gain/--on-accent), so it re-themes for free across
   dark / light / hashtag. The only motion is transform/opacity (compositor-
   friendly) and it is disabled wholesale under reduced-motion.

   NAMING. Everything is scoped under .gc-* / #gc* so nothing here can collide
   with market.css or fragchat.css.
   ========================================================================== */

/* the fixed anchor bottom-right; children (bubble + panel) position off it.
   Keyed on the #gcRoot ID as well as the class so it pins for certain. */
#gcRoot, .gc-root{
  position:fixed !important; right:20px; bottom:20px; z-index:120;
  font-family:var(--font-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif);
}

/* ---------------------------------------------------------------------------
   LAUNCHER BUBBLE — the always-there "Ask a seller" pill.
   ------------------------------------------------------------------------ */
.gc-launcher{
  display:inline-flex; align-items:center; gap:11px;
  padding:9px 18px 9px 9px;
  border-radius:999px;
  background:linear-gradient(140deg, var(--p300), var(--p400) 60%, var(--p500));
  border:1px solid var(--p600);
  color:var(--on-accent);
  box-shadow:0 12px 30px rgba(46,134,200,.45),
             0 0 0 1px rgba(255,255,255,.08) inset;
  transform-origin:bottom right;
  animation:gcLaunchIn .4s cubic-bezier(.2,.85,.3,1) both;
  transition:transform .16s ease, box-shadow .16s ease, filter .16s ease;
}
.gc-launcher:hover{
  transform:translateY(-2px);
  box-shadow:0 16px 40px rgba(77,169,238,.6), 0 0 0 1px rgba(255,255,255,.14) inset;
  filter:brightness(1.04);
}
.gc-launcher:active{ transform:translateY(0); }
.gc-launcher.is-hidden{ display:none; }

.gc-launcher-ic{
  position:relative; flex:0 0 auto;
  width:38px; height:38px; border-radius:50%;
  display:inline-flex; align-items:center; justify-content:center;
  background:radial-gradient(120% 120% at 50% 20%, var(--raised), var(--void));
  border:2px solid rgba(255,255,255,.55); overflow:visible;
  color:var(--on-accent);
}
.gc-launcher-online{
  position:absolute; right:-1px; bottom:-1px;
  width:11px; height:11px; border-radius:50%;
  background:var(--gain); border:2px solid var(--p400);
  box-shadow:0 0 8px var(--gain);
  animation:gcBlip 2.2s ease-in-out infinite;
}
.gc-launcher-txt{ display:flex; flex-direction:column; line-height:1.15; text-align:left; }
.gc-launcher-txt b{ font-size:14px; font-weight:800; letter-spacing:.01em; }
.gc-launcher-sub{ font-size:10.5px; opacity:.86; letter-spacing:.02em; }

/* the attention "ping" ring around the bubble */
.gc-launcher::after{
  content:""; position:absolute; inset:0; border-radius:999px;
  border:1.5px solid var(--p500); opacity:0; pointer-events:none;
  animation:gcPing 3.4s ease-out infinite;
}

/* ---------------------------------------------------------------------------
   PANEL — the chat window itself.
   ------------------------------------------------------------------------ */
/* POSITIONING — id-forced so it can't be overridden. NOTE: keep opacity/
   transform OFF this id rule — an id (1,0,0) would beat the class-only
   `.gc-panel.is-in` (0,2,0) and pin the panel at opacity:0 (open but invisible,
   the "buttons don't work" bug). The show/hide animation lives on the class. */
#gcPanel, .gc-panel{
  position:fixed !important; top:74px; right:20px; left:auto; bottom:auto;
  width:clamp(360px, 33vw, 480px);
  height:min(620px, calc(100vh - 110px));
  display:flex; flex-direction:column; overflow:hidden;
  background:var(--panel);
  border:1px solid var(--hairline-2);
  border-radius:18px;
  box-shadow:0 30px 80px rgba(0,0,0,.6), 0 0 0 1px rgba(77,169,238,.08);
  transform-origin:top right;
  z-index:130;
}
/* entry animation on the CLASS only, so .is-in cleanly overrides it */
.gc-panel{
  transform:translateY(-10px) scale(.96); opacity:0;
  transition:transform .22s cubic-bezier(.2,.85,.3,1), opacity .18s ease;
}
.gc-panel.is-in{ transform:none; opacity:1; }
.gc-panel[hidden]{ display:none !important; }

/* ---- header (the drag handle) ------------------------------------------- */
.gc-head{
  display:flex; align-items:center; gap:10px;
  padding:11px 12px;
  cursor:move; user-select:none; -webkit-user-select:none;
  background:
    radial-gradient(120% 160% at 0% 0%, rgba(77,169,238,.18), transparent 60%),
    var(--raised);
  border-bottom:1px solid var(--hairline-2);
}
.gc-head .gc-icobtn{ cursor:pointer; }
.gc-head-pfp{
  position:relative; flex:0 0 auto; width:38px; height:38px; border-radius:50%;
  display:inline-flex; align-items:center; justify-content:center;
  background:radial-gradient(120% 120% at 50% 20%, var(--raised), var(--void));
  border:2px solid var(--p400); color:var(--p400);
}
.gc-head-online{
  position:absolute; right:-1px; bottom:-1px;
  width:10px; height:10px; border-radius:50%;
  background:var(--gain); border:2px solid var(--raised);
  box-shadow:0 0 7px var(--gain);
  animation:gcBlip 2.2s ease-in-out infinite;
}
.gc-head-meta{ flex:1 1 auto; min-width:0; display:flex; flex-direction:column; gap:1px; }
.gc-head-id{ color:var(--ink-hi); font-weight:800; font-size:15px; letter-spacing:.01em; }
.gc-head-sub{
  color:var(--gain); font-size:10.5px; letter-spacing:.02em;
  display:inline-flex; align-items:center; gap:6px;
}
.gc-head-btns{ flex:0 0 auto; display:inline-flex; gap:2px; }
.gc-icobtn{
  width:30px; height:30px; border-radius:8px;
  display:inline-flex; align-items:center; justify-content:center;
  color:var(--ink-lo); font-size:20px; line-height:1;
  transition:background .14s ease, color .14s ease;
}
.gc-icobtn:hover{ background:var(--hover); color:var(--ink-hi); }

/* ---- message body ------------------------------------------------------- */
.gc-body{ flex:1 1 auto; min-height:0; display:flex; position:relative; }
.gc-list{
  flex:1 1 auto; min-height:0; overflow-y:auto; overflow-x:hidden;
  padding:14px 12px 6px;
  display:flex; flex-direction:column; gap:9px;
  scrollbar-width:thin;
  background:
    radial-gradient(140% 60% at 90% 0%, rgba(77,169,238,.05), transparent 60%),
    var(--void);
}
.gc-list::-webkit-scrollbar{ width:8px; }
.gc-list::-webkit-scrollbar-thumb{ background:var(--hairline-2); border-radius:8px; }

/* ---- the item-context card (what the buyer is asking about) ------------- */
.gc-item{
  display:flex; align-items:center; gap:10px;
  padding:8px 10px; border-radius:12px;
  background:var(--raised); border:1px solid var(--hairline-2);
  animation:gcMsgIn .26s ease both;
}
.gc-item-thumb{
  flex:0 0 auto; width:40px; height:40px; border-radius:9px; overflow:hidden;
  display:inline-flex; align-items:center; justify-content:center;
  background:var(--void); border:1px solid var(--hairline); color:var(--p400);
}
.gc-item-thumb img{ width:100%; height:100%; object-fit:cover; display:block; }
.gc-item-meta{ min-width:0; flex:1 1 auto; }
.gc-item-name{
  color:var(--ink-hi); font-weight:800; font-size:13px;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.gc-item-coll{ color:var(--ink-faint); font-size:10.5px; letter-spacing:.02em; margin-top:1px; }

/* one message row */
.gc-msg{
  display:flex; align-items:flex-end; gap:8px; max-width:100%;
  animation:gcMsgIn .26s cubic-bezier(.2,.85,.3,1) both;
}
.gc-from-customer{ flex-direction:row-reverse; }
.gc-col{ min-width:0; max-width:80%; display:flex; flex-direction:column; }

/* left-side avatars */
.gc-avatar{
  flex:0 0 auto; width:28px; height:28px; border-radius:50%;
  display:inline-flex; align-items:center; justify-content:center;
  overflow:hidden;
}
.gc-avatar-seller{
  background:var(--raised); border:1.5px solid var(--p400);
  color:var(--p400); box-shadow:0 0 0 1px var(--void);
}
.gc-avatar-ai{
  background:var(--raised); border:1px solid var(--hairline-2);
  color:var(--p400);
}

/* the bubble */
.gc-bubble{
  position:relative;
  padding:8px 12px 6px;
  border-radius:14px;
  font-size:13.5px; line-height:19px;
  color:var(--ink-mid);
  word-wrap:break-word; overflow-wrap:anywhere;
}
.gc-b-name{
  font-size:10px; font-weight:800; letter-spacing:.06em;
  margin-bottom:2px; opacity:.85;
}
.gc-time{
  margin-top:3px; font-size:9.5px; letter-spacing:.02em;
  color:var(--ink-faint); text-align:right;
}

/* AI (bot) — neutral raised, left */
.gc-from-ai .gc-bubble{
  background:var(--raised); border:1px solid var(--hairline);
  border-bottom-left-radius:5px;
}
.gc-from-ai .gc-b-name{ color:var(--p500); }

/* seller (anonymous human) — sky-blue tinted, left, emphasized */
.gc-from-seller .gc-bubble{
  background:linear-gradient(180deg, rgba(77,169,238,.16), rgba(77,169,238,.09));
  border:1px solid rgba(77,169,238,.42);
  border-bottom-left-radius:5px;
  color:var(--ink-hi);
  box-shadow:0 2px 10px rgba(46,134,200,.14);
}
.gc-from-seller .gc-b-name{ color:var(--p500); }

/* customer — solid accent, right */
.gc-from-customer .gc-col{ align-items:flex-end; }
.gc-from-customer .gc-bubble{
  background:linear-gradient(160deg, var(--p400), var(--p300));
  border:1px solid var(--p500);
  color:var(--on-accent);
  border-bottom-right-radius:5px;
  box-shadow:0 4px 14px rgba(46,134,200,.34);
}
.gc-from-customer .gc-time{ color:rgba(255,255,255,.7); }

/* system / status line — subtle, centered */
.gc-sys{
  align-self:center; text-align:center; max-width:90%;
  animation:gcMsgIn .26s ease both;
}
.gc-sys-txt{
  display:inline-block; padding:4px 12px;
  font-size:10.5px; letter-spacing:.03em;
  color:var(--ink-faint);
  background:var(--panel); border:1px solid var(--hairline);
  border-radius:999px;
}

/* ---- typing indicator --------------------------------------------------- */
.gc-typing{ display:inline-flex; align-items:center; gap:4px; padding:11px 13px; }
.gc-typing-dot{
  width:6px; height:6px; border-radius:50%; background:var(--p500);
  animation:gcType 1.2s ease-in-out infinite;
}
.gc-typing-dot:nth-child(2){ animation-delay:.16s; }
.gc-typing-dot:nth-child(3){ animation-delay:.32s; }

/* ---------------------------------------------------------------------------
   GATE — the honest login/telegram prompt inside the panel.
   ------------------------------------------------------------------------ */
.gc-gate{
  flex:1 1 auto; min-height:0; overflow-y:auto;
  display:flex; flex-direction:column; align-items:center; text-align:center;
  gap:11px; padding:26px 22px;
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(77,169,238,.10), transparent 60%),
    var(--void);
  animation:gcMsgIn .26s ease both;
}
.gc-gate-ic{
  width:54px; height:54px; border-radius:50%;
  display:inline-flex; align-items:center; justify-content:center;
  background:var(--raised); border:2px solid var(--p400); color:var(--p400);
  box-shadow:0 6px 18px rgba(0,0,0,.5);
}
.gc-gate-title{ margin:2px 0 0; color:var(--ink-hi); font-size:17px; font-weight:800; }
.gc-gate-msg{ margin:0; color:var(--ink-mid); font-size:13px; line-height:20px; max-width:280px; }
.gc-gate-btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  margin-top:4px; padding:11px 22px; border-radius:12px;
  text-decoration:none;
  color:var(--on-accent); font-weight:800; font-size:14px;
  background:linear-gradient(140deg, var(--p300), var(--p400));
  border:1px solid var(--p500);
  box-shadow:0 8px 22px rgba(46,134,200,.4);
  transition:transform .12s ease, box-shadow .16s ease, filter .16s ease;
}
.gc-gate-btn:hover{ transform:translateY(-1px); filter:brightness(1.05);
  box-shadow:0 12px 28px rgba(77,169,238,.55); }
.gc-gate-fine{ margin:2px 0 0; color:var(--ink-faint); font-size:10.5px; line-height:16px; max-width:260px; }

/* ---------------------------------------------------------------------------
   COMPOSER — text input + send.
   ------------------------------------------------------------------------ */
.gc-compose{
  flex:0 0 auto; display:flex; align-items:center; gap:8px;
  padding:10px 11px;
  background:var(--raised);
  border-top:1px solid var(--hairline-2);
}
.gc-input{
  flex:1 1 auto; min-width:0;
  padding:10px 14px; border-radius:999px;
  background:var(--void);
  border:1px solid var(--hairline-2);
  color:var(--ink-hi); font-size:13.5px;
  transition:border-color .14s ease, box-shadow .14s ease;
}
.gc-input::placeholder{ color:var(--ink-faint); }
.gc-input:focus{ border-color:var(--p400); box-shadow:0 0 0 3px rgba(77,169,238,.18); }
.gc-input:disabled{ opacity:.6; }
.gc-send{
  flex:0 0 auto; width:40px; height:40px; border-radius:50%;
  display:inline-flex; align-items:center; justify-content:center;
  color:var(--on-accent);
  background:linear-gradient(140deg, var(--p400), var(--p300));
  border:1px solid var(--p500);
  box-shadow:0 4px 14px rgba(46,134,200,.4);
  transition:transform .12s ease, filter .16s ease;
}
.gc-send:hover:not(:disabled){ transform:translateY(-1px) scale(1.04); filter:brightness(1.06); }
.gc-send:active:not(:disabled){ transform:none; }
.gc-send:disabled{ opacity:.45; filter:grayscale(.3); }
.gc-send svg{ margin-left:-1px; }

/* ---------------------------------------------------------------------------
   THE "💬 Ask seller" BUTTON — rendered by market.js onto each gift card.
   ------------------------------------------------------------------------ */
.gc-ask{
  display:inline-flex; align-items:center; gap:6px;
  margin-top:8px; padding:6px 12px; border-radius:999px;
  font-size:11.5px; font-weight:700; letter-spacing:.01em;
  color:var(--p500);
  background:var(--void);
  border:1px solid var(--p500);
  cursor:pointer;
  transition:transform .12s ease, background .16s ease, color .16s ease, box-shadow .16s ease;
}
.gc-ask:hover{
  background:var(--p400); color:var(--on-accent);
  transform:translateY(-1px);
  box-shadow:0 6px 16px rgba(77,169,238,.4);
}
.gc-ask .gc-ask-ic{ font-size:12px; line-height:1; }

/* ---------------------------------------------------------------------------
   KEYFRAMES
   ------------------------------------------------------------------------ */
@keyframes gcLaunchIn{ from{ transform:translateY(18px) scale(.8); opacity:0; } to{ transform:none; opacity:1; } }
@keyframes gcMsgIn{ from{ transform:translateY(8px); opacity:0; } to{ transform:none; opacity:1; } }
@keyframes gcBlip{ 0%,100%{ opacity:1; } 50%{ opacity:.35; } }
@keyframes gcPing{ 0%{ transform:scale(1); opacity:.5; } 70%,100%{ transform:scale(1.16); opacity:0; } }
@keyframes gcType{ 0%,60%,100%{ transform:translateY(0); opacity:.5; } 30%{ transform:translateY(-4px); opacity:1; } }

/* ---------------------------------------------------------------------------
   RESPONSIVE — hug the screen on small widths.
   ------------------------------------------------------------------------ */
@media (max-width:480px){
  .gc-root{ right:12px; bottom:12px; }
  .gc-panel{
    width:calc(100vw - 24px);
    height:min(72vh, calc(100vh - 96px));
  }
  .gc-launcher-sub{ display:none; }
}

/* ---------------------------------------------------------------------------
   REDUCED MOTION — freeze all decoration; the widget stays fully usable.
   ------------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce){
  .gc-launcher, .gc-panel, .gc-msg, .gc-sys, .gc-item, .gc-gate,
  .gc-launcher-online, .gc-head-online, .gc-typing-dot, .gc-launcher::after,
  .gc-ask{
    animation:none !important;
    transition:none !important;
  }
  .gc-panel{ transform:none; opacity:1; }
  .gc-launcher-online, .gc-head-online{ opacity:1; }
}
