:root{
  --tb-max: 520px;
  --tb-gap: 10px;

  --radius: 14px;
  --border: rgba(0,0,0,.10);
  --shadow: 0 10px 30px rgba(0,0,0,.08);

  --card: rgba(255,255,255,.95);
  --bg-soft: rgba(255,255,255,.85);

  --text: #0f172a;
  --muted:#64748b;

  --accent:#2563eb;
  --accent2:#1d4ed8;
}

/* ===== chat.html container ===== */
.tb-page{
  margin:0;
  background: transparent; /* geen achtergrond */
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.tb-wrap{
  width: min(var(--tb-max), 100%);
  margin: 0 auto;
  padding: var(--tb-gap);
  box-sizing: border-box;
}

.tb-frames{
  display:flex;
  flex-direction:column;
  gap: var(--tb-gap);
}

/* Responsive hoogte: input-frame + chat-frame samen ~ viewport */
.tb-frame{
  width:100%;
  border:0;
  display:block;
  background: transparent;
}

.tb-frame--input{
  height: clamp(240px, 33vh, 320px);
}

.tb-frame--log{
  height: clamp(360px, 58vh, 680px);
}

/* ===== shared UI for index.php / index2.php ===== */
.tb-body{
  margin:0;
  background: transparent;
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.tb-card{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px;
}

.tb-top{
  display:flex;
  gap: 10px;
  align-items:flex-start;
  justify-content:space-between;
  margin-bottom: 10px;
}

.tb-emojiBar{
  flex:1;
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  padding:8px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  min-width: 0;
}

.tb-emojiBtn{
  width:32px; height:32px;
  display:flex; align-items:center; justify-content:center;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,.10);
  background: white;
  cursor:pointer;
  user-select:none;
  font-size:16px;
  line-height:1;
  transition: transform .05s ease, border-color .15s ease, background .15s ease;
}
.tb-emojiBtn:hover{ border-color: rgba(37,99,235,.40); background: rgba(37,99,235,.04); }
.tb-emojiBtn:active{ transform: scale(.98); }

.tb-sideBtns{
  display:flex;
  flex-direction:column;
  gap:8px;
  width: 120px;
  flex: 0 0 auto;
}

.tb-btn{
  appearance:none;
  border: 1px solid var(--border);
  background: white;
  color: var(--text);
  padding: 10px 10px;
  border-radius: 12px;
  cursor:pointer;
  font-weight: 650;
  font-size: 13px;
  text-align:center;
  transition: transform .05s ease, background .15s ease, border-color .15s ease;
}
.tb-btn:hover{ border-color: rgba(37,99,235,.35); background: rgba(37,99,235,.06); }
.tb-btn:active{ transform: scale(.99); }

.tb-btnPrimary{
  border-color: rgba(37,99,235,.45);
  background: var(--accent);
  color: white;
}
.tb-btnPrimary:hover{ background: var(--accent2); border-color: rgba(37,99,235,.7); }

.tb-grid{
  display:grid;
  grid-template-columns: 1fr 1fr; /* naast elkaar */
  gap:10px;
  align-items:start;
}

/* bericht-veld iets compacter zodat het past */
.tb-textarea{
  height: 70px;
  max-height: 120px;
  resize: none;
  overflow-y: auto;
  overflow-x: hidden;
  line-height: 1.35;
  -webkit-overflow-scrolling: touch;
}

.tb-btn.danger{
  background:#7f1d1d;
  border-color:rgba(185,28,28,.5);
  color:white;
}
.tb-btn.danger:hover{
  background:#991b1b;
}

.tb-label{
  display:block;
  font-size: 12px;
  color: var(--muted);
  margin: 2px 0 6px;
}

.tb-input, .tb-textarea{
  width:100%;
  box-sizing:border-box;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  background: white;
}

.tb-input:focus, .tb-textarea:focus{
  border-color: rgba(37,99,235,.55);
  box-shadow: 0 0 0 4px rgba(37,99,235,.12);
}

.tb-textarea{
  height: 92px;
  resize: none;
  overflow:auto;
  -webkit-overflow-scrolling: touch;
}

.tb-hint{
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

/* ===== chatlog ===== */
.tb-logWrap{
  height: 100%;
  overflow:auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 2px;
}

.tb-msg{
  border: 1px solid rgba(0,0,0,.08);
  background: white;
  border-radius: 12px;
  padding: 8px 10px;
  margin: 8px 0;
  word-break: break-word;
}

.tb-meta{
  font-size: 12px;
  color: var(--muted);
  display:flex;
  gap:8px;
  align-items:center;
  margin-bottom: 4px;
}
.tb-name{ font-weight: 750; color: var(--text); }
.tb-time{ font-size: 11px; }

/* ===== small screens tweaks ===== */
@media (max-width: 420px){
  :root{ --tb-gap: 8px; }
  .tb-sideBtns{ width: 105px; }
  .tb-emojiBtn{ width:30px; height:30px; }
}

/* ===== Scrollbaar bovenste (input) frame ===== */
.tb-inputScroll{
  height: 100vh;                 /* vult hele iframe */
  overflow-y: auto;              /* scroll hier */
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: var(--tb-gap);
  box-sizing: border-box;
}

/* SYSTEEM bericht (alleen lokaal zichtbaar) */
.tb-msg.tb-system{
  background: rgba(96,165,250,.14);
  border-color: rgba(96,165,250,.35);
}
.tb-msg.tb-system .tb-name{
  color: #93c5fd;
}
.tb-msg.tb-system .tb-time{
  opacity: .75;
}
