/* =========
   Design tokens (enterprise)
   ========= */
:root{
  --bg:#f6f7fb;
  --panel:#fff;
  --text:#1f2a37;
  --muted:#4b5563;
  --brand:#0a4fbf;
  --brand-600:#093f99;
  --brand-050:#e9f0ff;
  --border:#e5e7eb;
  --shadow-1:0 2px 0 rgba(0,0,0,.04);
  --shadow-2:0 10px 30px rgba(0,0,0,.07);
  --radius-0:0;
  --radius-sm:6px;
  --radius-md:10px;
  --w:335px;
  --h:400px;
}

/* ========= Demo-bakgrunn ========= */
html,body{height:100%;margin:0;background:var(--bg);}
body{
  font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  color:var(--text);
}
.demo-bg{
  min-height:100%;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:32px;
  padding:32px;
}
.demo-col{max-width:420px;}
.demo-col p{color:var(--muted);}

/* ========= Widget ========= */
.bot-widget{
  position:fixed;
  bottom:100px;
  right:26px;
  width:var(--w);
  height:var(--h);
  display:flex;
  flex-direction:column;
  background:var(--panel);
  border:1px solid var(--border);
  box-shadow:var(--shadow-2);
  border-radius:14px;
  overflow:hidden;
  z-index:9999;
  transition:opacity .25s ease,transform .25s ease;
}
.bot-widget.show,
.bot-widget.active{display:flex;opacity:1;transform:translateY(0);}

/* ========= Header ========= */
.bot-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:9px 14px;
  background:var(--brand);
  color:#fff;
  border-bottom:1px solid rgba(255,255,255,.14);
  font-size:14px;
  min-height:38px;
}
.bot-brand{display:flex;gap:8px;align-items:center;}
.bot-title strong{font-size:14px;font-weight:700;}
.bot-title span{font-size:11px;opacity:.9;}
.bot-close{display:none!important;}

/* ========= Meldingsområde ========= */
.bot-messages{
  flex:1;
  overflow:auto;
  padding:10px 10px 6px 10px;
  display:flex;
  flex-direction:column;
  gap:10px;
  background:linear-gradient(180deg,var(--brand-050)0%,#fafcff 160px,#fff 160px);
}
.bot-messages::-webkit-scrollbar{width:6px;}
.bot-messages::-webkit-scrollbar-thumb{background:#d6d8de;border-radius:4px;}

/* ========= Bobler ========= */
.msg{display:flex;}
.msg-user{justify-content:flex-end;}
.bubble{
  position:relative;
  max-width:85%;
  border:1px solid var(--border);
  padding:10px 12px;
  background:#fff;
  border-radius:8px;
  box-shadow:0 2px 8px rgba(0,0,0,.03);
  font-size:13px;
  line-height:1.45;
  animation:fadein .18s ease-out;
}
.msg-bot .bubble{border-left:3px solid var(--brand);}
.msg-user .bubble{border-left:3px solid #2f2f2f;background:#f8f9fb;}
.copy-btn{display:none!important;}
@keyframes fadein{from{opacity:0;transform:translateY(2px)}to{opacity:1;transform:translateY(0)}}

/* ========= Intro-kort ========= */
.intro-card {
  position: relative;
  left: 1px; /* flytt 1px mot høyre for optisk balanse */
  width: calc(100% - 2px);
  box-sizing: border-box;
  background: #fff;
  border: 1px solid #dce6f9;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  padding: 14px 11px 12px 11px;
  font-size: 13px;
  line-height: 1.5;
}

.intro-card p{
  margin:0 0 10px;
  color:#1e293b;
}
.intro-card strong{color:var(--brand);font-weight:600;}
.intro-card em{color:#334155;}

/* ========= Inputbar ========= */
.bot-inputbar{
  display:flex;
  align-items:center;
  gap:6px;
  padding:8px 12px;
  border-top:1px solid var(--border);
  background:#fff;
}
.bot-inputbar label{display:none!important;}
.bot-inputbar input{
  flex:1;
  padding:9px 12px;
  border:1px solid var(--border);
  border-radius:6px;
  font-size:13px;
}
.bot-inputbar input:focus{
  border-color:var(--brand);
  box-shadow:0 0 0 2px rgba(10,79,191,.1);
  outline:none;
}
.bot-inputbar .send{
  all:unset;
  cursor:pointer;
  background:var(--brand);
  color:#fff;
  padding:9px 12px;
  border-radius:6px;
  font-weight:700;
  display:flex;
  align-items:center;
  justify-content:center;
}
.bot-inputbar .send:hover{background:var(--brand-600);}

/* ========= Footer ========= */
.bot-footer{
  padding:3px 12px 6px;
  border-top:1px solid var(--border);
  background:#fff;
  color:var(--muted);
  font-size:10px;
  text-align:center;
}

/* ========= Behandlingskort ========= */
.treatments{display:grid;gap:8px;}
.card{
  border:1px solid var(--border);
  padding:8px;
  background:#fff;
  display:flex;
  flex-direction:column;
  gap:6px;
}
.card h4{margin:0 0 4px;font-size:13px;}
.card p{margin:0 0 6px;color:var(--muted);font-size:12px;}
.card .meta{display:inline-block;padding:2px 6px;border:1px solid var(--border);font-size:11px;}
.card .actions{display:flex;gap:6px;flex-wrap:wrap;margin-top:auto;}
.btn{
  all:unset;
  cursor:pointer;
  background:var(--brand);
  color:#fff;
  font-size:11px;
  padding:7px 9px;
  border-radius:4px;
}
.btn.alt{background:#fff;color:var(--brand);border:1px solid var(--brand);}
.btn.subtle{border-color:#cbd5e1;color:#334155;}

/* ========= Kart ========= */
.map-wrap{border:1px solid var(--border);background:#f8f9fb;height:176px;width:100%;}
.map-wrap iframe{width:100%;height:100%;border:0;}

/* ========= Typing-indikator ========= */
.typing{
  display:inline-flex;
  gap:4px;
  padding:8px 10px;
  border-radius:8px;
  background:#f1f5f9;
  border:1px solid var(--border);
  max-width:fit-content;
  align-items:center;
}
.typing .dot{
  width:5px;
  height:5px;
  border-radius:50%;
  background:var(--brand);
  opacity:0.4;
  animation:blink 1.4s infinite;
}
.typing .dot:nth-child(2){animation-delay:.2s;}
.typing .dot:nth-child(3){animation-delay:.4s;}
@keyframes blink{
  0%{opacity:.4;transform:translateY(0);}
  20%{opacity:1;transform:translateY(-2px);}
  40%{opacity:.4;transform:translateY(0);}
}

/* ========= Chat-toggle ========= */
.chat-toggle{
  position:fixed;
  bottom:28px;
  right:28px;
  width:60px;
  height:60px;
  border-radius:50%;
  background:#0066cc;
  color:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  box-shadow:0 10px 25px rgba(0,0,0,0.25);
  transition:transform .25s ease,background .25s ease,box-shadow .25s ease;
  z-index:9999;
}
.chat-toggle:hover{
  background:#004a99;
  transform:scale(1.05);
  box-shadow:0 14px 28px rgba(0,0,0,0.3);
}
.chat-toggle img{
  width:28px;
  height:28px;
  pointer-events:none;
  user-select:none;
}

/* ========= Diverse ========= */
html,body{height:100vh;overflow:hidden;}
.demo-bg{min-height:100vh;height:100vh;background:#f5f5f5;padding:40px;}
.pdf-button{
  display:inline-block;
  margin-top:16px;
  background:#0066cc;
  color:#fff;
  padding:10px 18px;
  border-radius:8px;
  text-decoration:none;
  font-weight:600;
  transition:background .2s;
}
.pdf-button:hover{background:#004c99;}
.pdf-note{font-size:.85rem;color:#666;margin-top:4px;}
.msg-bot .intro-card {
  max-width: 100% !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 14px 12px 12px 12px;
  box-sizing: border-box;
  border-radius: 12px;
  border: 1px solid #dce6f9;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  background: #fff;
}