/* Gæstens sider: wifi-login (captive portal) og chat. Admin bruger style.css. */
:root {
  --brand: #1f5f5b;
  --brand-dark: #174845;
  --brand-soft: #e3efed;
  --page: #eef1f0;
  --surface: #ffffff;
  --bubble-bot: #f2f4f5;
  --ink: #1d2427;
  --muted: #6a7377;
  --line: #d9dfe1;
  --error: #b5402a;
  --shadow: 0 12px 40px rgba(20, 40, 45, 0.16);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body.guest { margin: 0; background: var(--page); line-height: 1.45; }
.hidden { display: none !important; }
button { font: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: 0.55; }

/* ---------- Wifi-login ---------- */
.portal { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.portal-card {
  width: min(400px, 100%);
  background: var(--surface);
  border-radius: 20px;
  padding: 32px 28px 24px;
  box-shadow: var(--shadow);
}
.portal-icon {
  width: 56px; height: 56px; border-radius: 16px;
  display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand);
  margin-bottom: 18px;
}
.portal-hotel { margin: 0; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--brand); }
.portal h1 { margin: 4px 0 8px; font-size: 1.45rem; line-height: 1.2; }
.portal-lead { margin: 0 0 18px; color: var(--muted); font-size: 0.95rem; }
.portal label { display: block; font-size: 0.85rem; font-weight: 600; margin: 14px 0 6px; }
.portal input {
  width: 100%; font: inherit; font-size: 1rem;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff;
}
.portal input:focus { outline: 3px solid var(--brand-soft); border-color: var(--brand); }
.portal button {
  width: 100%; margin-top: 22px; padding: 13px; border: 0; border-radius: 12px;
  background: var(--brand); color: #fff; font-weight: 600; font-size: 1rem;
}
.portal button:hover:not(:disabled) { background: var(--brand-dark); }
.portal-error { min-height: 1.2em; margin: 10px 0 0; color: var(--error); font-size: 0.9rem; }
.portal-fine { margin: 6px 0 0; color: var(--muted); font-size: 0.8rem; }

/* ---------- Chatvindue ---------- */
.chat-shell { height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.chat-window {
  position: relative;
  width: min(440px, 100%);
  height: min(760px, 100%);
  display: flex; flex-direction: column;
  background: var(--surface);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.chat-header {
  position: relative;
  display: flex; align-items: center; gap: 14px;
  padding: 18px 16px 18px 22px;
  background: var(--brand); color: #fff;
}
.chat-logo {
  flex: 0 0 auto;
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.16);
  font-weight: 800; font-size: 1.35rem;
}
.chat-heading { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat-heading strong { font-size: 1.2rem; letter-spacing: 0.01em; }
.chat-heading span { font-size: 0.95rem; opacity: 0.9; }
.chat-menu-button {
  border: 0; background: transparent; color: #fff;
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
}
.chat-menu-button:hover, .chat-menu-button[aria-expanded='true'] { background: rgba(255, 255, 255, 0.14); }
.chat-menu {
  position: absolute; right: 14px; top: calc(100% - 6px); z-index: 5;
  min-width: 250px; padding: 6px;
  background: var(--surface); color: var(--ink);
  border-radius: 12px; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.chat-menu button {
  border: 0; background: transparent; text-align: left;
  padding: 10px 12px; border-radius: 8px; font-size: 0.92rem;
}
.chat-menu button:hover { background: var(--bubble-bot); }

.chat-body {
  flex: 1; overflow-y: auto;
  padding: 18px 20px 12px;
  display: flex; flex-direction: column; gap: 14px;
  scroll-behavior: smooth;
}
.chat-notice { margin: 0 8px; text-align: center; color: var(--muted); font-size: 0.85rem; }
.chat-time { margin: 6px 0 0; text-align: center; color: var(--muted); font-size: 0.85rem; }

/* Beskeder */
.msg { display: flex; gap: 10px; align-items: flex-end; max-width: 100%; }
.msg.continued { margin-top: -6px; }
.msg-content { display: flex; flex-direction: column; gap: 4px; min-width: 0; max-width: 82%; }
.msg-name { font-size: 0.85rem; color: var(--muted); margin-left: 4px; }
.msg-meta { font-size: 0.75rem; color: var(--muted); margin: 0 4px; }
.bubble {
  padding: 12px 16px;
  border-radius: 18px;
  white-space: pre-line;
  overflow-wrap: anywhere;
  font-size: 0.98rem;
}
.msg-avatar {
  flex: 0 0 auto;
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand);
  font-weight: 800; font-size: 0.95rem;
  margin-bottom: 22px;
}
.msg.continued .msg-avatar { visibility: hidden; }
.msg.bot .bubble { background: var(--bubble-bot); border-bottom-left-radius: 6px; }
.msg.user { justify-content: flex-end; }
.msg.user .msg-content { align-items: flex-end; }
.msg.user .bubble { background: var(--brand); color: #fff; border-bottom-right-radius: 6px; }

/* Hurtigknapper */
.quick-replies { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.quick-replies button {
  border: 1.5px solid var(--brand); background: var(--surface); color: var(--brand);
  padding: 7px 14px; border-radius: 999px; font-size: 0.9rem; font-weight: 500;
}
.quick-replies button:hover { background: var(--brand-soft); }
.quick-replies button.back { border-color: var(--line); color: var(--muted); }
.quick-replies button.back:hover { background: var(--bubble-bot); color: var(--ink); }

/* Søjlediagram i chatboblen: niveau pr. time i dag, ingen tal */
:root { --low: #5fa77f; --mid: #e0a43a; --high: #c9553d; }
.chat-chart { margin: 12px 0 2px; padding: 12px 12px 10px; background: var(--surface); border-radius: 12px; white-space: normal; }
.chat-chart figcaption { font-size: 0.82rem; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.chart-bars { display: flex; align-items: stretch; gap: 3px; height: 92px; }
.chart-col { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chart-track { flex: 1; display: flex; align-items: flex-end; }
.chart-bar { width: 100%; border-radius: 4px 4px 0 0; background: #dfe4e6; transition: height 0.4s; }
.chart-bar.low { background: var(--low); }
.chart-bar.mid { background: var(--mid); }
.chart-bar.high { background: var(--high); }
.chart-bar.empty { background: #eceff0; }
.chart-bar:not(.now) { opacity: 0.55; }
.chart-bar.now { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--ink); }
.chart-tick { height: 16px; margin-top: 4px; font-size: 0.68rem; color: var(--muted); text-align: center; white-space: nowrap; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; font-size: 0.75rem; color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.chart-legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.chart-legend i.low { background: var(--low); }
.chart-legend i.mid { background: var(--mid); }
.chart-legend i.high { background: var(--high); }

/* "Skriver …" */
.msg.typing .msg-avatar { margin-bottom: 0; }
.msg.typing .bubble { display: flex; gap: 5px; padding: 15px 18px; }
.msg.typing .bubble span {
  width: 7px; height: 7px; border-radius: 50%; background: #9aa4a8;
  animation: blink 1.2s infinite ease-in-out;
}
.msg.typing .bubble span:nth-child(2) { animation-delay: 0.15s; }
.msg.typing .bubble span:nth-child(3) { animation-delay: 0.3s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* Skrivefelt */
.chat-composer { display: flex; gap: 8px; padding: 12px 16px 16px; }
.chat-composer input {
  flex: 1; min-width: 0;
  font: inherit; font-size: 1rem;
  padding: 14px 20px;
  border: 1.5px solid #8a9396; border-radius: 999px;
}
.chat-composer input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.chat-composer button {
  flex: 0 0 auto; width: 50px; border: 0; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: grid; place-items: center;
}
.chat-composer button:hover:not(:disabled) { background: var(--brand-dark); }

/* Mobil: chatten fylder hele skærmen */
@media (max-width: 520px) {
  .chat-shell { padding: 0; }
  .chat-window { width: 100%; height: 100%; border-radius: 0; box-shadow: none; }
  .chat-body { padding: 16px 16px 10px; }
  .portal-card { padding: 28px 20px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .chat-body { scroll-behavior: auto; }
  .msg.typing .bubble span { animation: none; }
}
