/* 1010monky chatt-widget - premium 2026 glas, ljus/mork-adaptiv.
   Brand-gron #448C74 (+ ljusare #5BA88C). Launcher: svart i ljust lage,
   vit i morkt lage. Allt klassnamn stabilt for JS:en. */
#monky-chat {
  --monky: #448C74;
  --monky-2: #5BA88C;
  --monky-grad: linear-gradient(135deg, #5BA88C 0%, #3f8067 100%);
  /* ljust lage (default) */
  --mc-launcher-bg: #14171a;
  --mc-launcher-icon: #ffffff;
  --mc-glass: rgba(255, 255, 255, .82);
  --mc-body-bg: rgba(243, 250, 247, .72);
  --mc-text: #1b2126;
  --mc-muted: #79838a;
  --mc-bubble-in: rgba(255, 255, 255, .92);
  --mc-bubble-bot: rgba(243, 247, 241, .94);
  --mc-border: rgba(20, 30, 26, .08);
  --mc-border-soft: rgba(20, 30, 26, .06);
  --mc-pill: rgba(255, 255, 255, .9);
  --mc-shadow: 0 28px 70px rgba(28, 60, 48, .26);
}
@media (prefers-color-scheme: dark) {
  #monky-chat {
    --mc-launcher-bg: #ffffff;
    --mc-launcher-icon: #14171a;
    --mc-glass: rgba(26, 31, 34, .82);
    --mc-body-bg: rgba(18, 22, 25, .55);
    --mc-text: #e9eef1;
    --mc-muted: #97a1a8;
    --mc-bubble-in: rgba(255, 255, 255, .07);
    --mc-bubble-bot: rgba(122, 167, 144, .15);
    --mc-border: rgba(255, 255, 255, .12);
    --mc-border-soft: rgba(255, 255, 255, .08);
    --mc-pill: rgba(30, 35, 38, .9);
    --mc-shadow: 0 28px 70px rgba(0, 0, 0, .5);
  }
}
[data-bs-theme="dark"] #monky-chat {
  --mc-launcher-bg: #ffffff;
  --mc-launcher-icon: #14171a;
  --mc-glass: rgba(26, 31, 34, .82);
  --mc-body-bg: rgba(18, 22, 25, .55);
  --mc-text: #e9eef1;
  --mc-muted: #97a1a8;
  --mc-bubble-in: rgba(255, 255, 255, .07);
  --mc-bubble-bot: rgba(122, 167, 144, .15);
  --mc-border: rgba(255, 255, 255, .12);
  --mc-border-soft: rgba(255, 255, 255, .08);
  --mc-pill: rgba(30, 35, 38, .9);
  --mc-shadow: 0 28px 70px rgba(0, 0, 0, .5);
}

#monky-chat * { box-sizing: border-box; }

/* ---------- Launcher ---------- */
#monky-chat-launcher {
  position: fixed; right: 24px; bottom: 24px; z-index: 1050;
  width: 60px; height: 60px; border: none; cursor: pointer; padding: 0;
  background: var(--mc-launcher-bg); border-radius: 50%;
  display: grid; place-items: center;
  box-shadow: 0 14px 34px rgba(20, 23, 26, .32), inset 0 1px 0 rgba(255, 255, 255, .14);
  transition: transform .18s cubic-bezier(.2,.7,.3,1), box-shadow .18s ease;
}
#monky-chat-launcher:hover { transform: translateY(-3px) scale(1.05); box-shadow: 0 20px 44px rgba(20, 23, 26, .42); }
#monky-chat-launcher:active { transform: translateY(-1px) scale(1.02); }
#monky-chat-launcher svg { width: 26px; height: 26px; }
#monky-chat-launcher svg path { fill: var(--mc-launcher-icon); }
#monky-chat-launcher.mc-hidden { display: none; }
#monky-chat-launcher.mc-attn { animation: mc-attn 1.6s ease-in-out infinite; }
@keyframes mc-attn { 0%,100% { transform: none; } 25% { transform: translateY(-3px) rotate(-5deg); } 75% { transform: translateY(-3px) rotate(5deg); } }

/* ---------- Hint-pill ---------- */
.mc-hint {
  position: fixed; right: 96px; bottom: 38px; z-index: 1050;
  background: var(--mc-pill); color: var(--mc-text); cursor: pointer;
  font: 600 13px/1 'Inter', system-ui, sans-serif;
  padding: 11px 16px; border-radius: 13px; white-space: nowrap;
  border: 1px solid var(--mc-border-soft);
  box-shadow: 0 10px 28px rgba(20, 23, 26, .18);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  animation: mc-bob-y 3.2s ease-in-out infinite;
}
.mc-hint::after { content: ''; position: absolute; right: -6px; top: 50%; transform: translateY(-50%); border: 7px solid transparent; border-left-color: var(--mc-pill); border-right: 0; }
@keyframes mc-bob-y { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
#monky-chat-launcher.mc-hidden + .mc-hint { display: none; }

/* ---------- Panel ---------- */
#monky-chat-panel {
  position: fixed; right: 24px; bottom: 24px; z-index: 1051;
  width: 384px; max-width: calc(100vw - 24px); height: 600px; max-height: calc(100vh - 44px);
  display: none; font-family: 'Inter', system-ui, sans-serif;
}
#monky-chat-panel.mc-open { display: block; animation: mc-in .26s cubic-bezier(.2,.7,.3,1); }
@keyframes mc-in { from { opacity: 0; transform: translateY(16px) scale(.97); } to { opacity: 1; transform: none; } }

.mc-shell {
  height: 100%; display: flex; flex-direction: column; overflow: hidden;
  background: var(--mc-glass);
  -webkit-backdrop-filter: blur(24px) saturate(160%); backdrop-filter: blur(24px) saturate(160%);
  border-radius: 26px; border: 1px solid var(--mc-border);
  box-shadow: var(--mc-shadow), inset 0 1px 0 rgba(255, 255, 255, .25);
}

/* Header */
.mc-header { background: var(--monky-grad); color: #fff; padding: 18px 18px 16px; display: flex; align-items: center; gap: 12px; position: relative; }
.mc-header::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: rgba(255,255,255,.18); }
.mc-header-mark { width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.28); display: grid; place-items: center; font-weight: 700; font-size: 17px; color: #fff; flex: 0 0 auto; }
.mc-title { font-weight: 700; font-size: 16px; line-height: 1.2; }
.mc-status { font-size: 12px; opacity: .92; display: flex; align-items: center; gap: 7px; margin-top: 3px; }
.mc-dot { width: 8px; height: 8px; border-radius: 50%; background: #b6f0d8; display: inline-block; box-shadow: 0 0 0 0 rgba(182,240,216,.7); animation: mc-pulse 2s infinite; }
@keyframes mc-pulse { 0% { box-shadow: 0 0 0 0 rgba(182,240,216,.6); } 70% { box-shadow: 0 0 0 7px rgba(182,240,216,0); } 100% { box-shadow: 0 0 0 0 rgba(182,240,216,0); } }
.mc-close { margin-left: auto; background: rgba(255,255,255,.18); border: none; color: #fff; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 19px; line-height: 1; transition: background .12s ease; }
.mc-close:hover { background: rgba(255,255,255,.34); }

/* Body */
.mc-body { flex: 1; overflow-y: auto; padding: 18px; background: var(--mc-body-bg); display: flex; flex-direction: column; gap: 12px; }
.mc-body::-webkit-scrollbar { width: 8px; }
.mc-body::-webkit-scrollbar-thumb { background: var(--mc-border); border-radius: 8px; }
.mc-body { scrollbar-width: thin; scrollbar-color: var(--mc-border) transparent; }

.mc-intro { background: var(--mc-bubble-in); border: 1px solid var(--mc-border-soft); border-radius: 18px; padding: 15px 16px; font-size: 14px; line-height: 1.55; color: var(--mc-text); box-shadow: 0 2px 10px rgba(20,23,26,.05); }

/* meddelanderader */
.mc-row { display: flex; max-width: 100%; }
.mc-row-visitor { justify-content: flex-end; }
.mc-row-in { justify-content: flex-start; }
.mc-grouped { margin-top: -6px; }
.mc-col { display: flex; flex-direction: column; max-width: 84%; }
.mc-bubble { padding: 11px 15px; border-radius: 18px; font-size: 14px; line-height: 1.45; word-wrap: break-word; overflow-wrap: anywhere; animation: mc-pop .18s ease; }
.mc-bubble a { color: inherit; text-decoration: underline; }
@keyframes mc-pop { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.mc-visitor { background: var(--monky-grad); color: #fff; border-bottom-right-radius: 6px; box-shadow: 0 6px 16px rgba(53,111,92,.28); }
.mc-admin, .mc-bot { background: var(--mc-bubble-in); color: var(--mc-text); border: 1px solid var(--mc-border-soft); border-bottom-left-radius: 6px; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.mc-bot { background: var(--mc-bubble-bot); }
.mc-system { align-self: center; font-size: 12px; color: var(--mc-muted); text-align: center; }
.mc-meta { font-size: 11px; color: var(--mc-muted); margin-top: 3px; padding: 0 4px; }
.mc-row-visitor .mc-meta { text-align: right; }

/* Snabbval */
.mc-quick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.mc-chip { border: 1px solid var(--monky); color: var(--monky); background: transparent; border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 500; cursor: pointer; transition: background .12s ease, transform .1s ease, color .12s ease; }
.mc-chip:hover { background: var(--monky); color: #fff; transform: translateY(-1px); }

/* Footer / input */
.mc-footer { padding: 12px; border-top: 1px solid var(--mc-border-soft); background: var(--mc-glass); }
.mc-inputrow { display: flex; gap: 8px; align-items: flex-end; }
.mc-input { flex: 1; resize: none; border: 1px solid var(--mc-border); border-radius: 15px; padding: 11px 14px; font: 400 14px/1.4 'Inter', system-ui, sans-serif; max-height: 110px; outline: none; background: var(--mc-bubble-in); color: var(--mc-text); transition: border-color .12s ease, box-shadow .12s ease; }
.mc-input::placeholder { color: var(--mc-muted); }
.mc-input:focus { border-color: var(--monky-2); box-shadow: 0 0 0 3px rgba(91,168,140,.22); }
.mc-send { flex: 0 0 auto; width: 44px; height: 44px; border-radius: 14px; border: none; background: var(--monky); color: #fff; cursor: pointer; display: grid; place-items: center; font-size: 18px; transition: background .12s ease, transform .1s ease; }
.mc-send:hover { background: #3a7a64; transform: scale(1.05); }
.mc-send:disabled { opacity: .45; cursor: default; transform: none; }
.mc-send.mc-loading { font-size: 0; }
.mc-send.mc-loading::after { content: ""; width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.45); border-top-color: #fff; border-radius: 50%; animation: mc-spin .7s linear infinite; }
@keyframes mc-spin { to { transform: rotate(360deg); } }
.mc-foot-note { text-align: center; font-size: 11px; color: var(--mc-muted); margin-top: 9px; }

/* skarmlasare + scroll-las + honeypot */
.mc-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
body.mc-noscroll { overflow: hidden; }
.mc-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

@media (max-width: 460px) {
  #monky-chat-panel { right: 0; bottom: 0; width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; }
  .mc-shell { border-radius: 0; }
  #monky-chat-launcher { right: 16px; bottom: 16px; }
  .mc-hint { display: none; }
}

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