/* =========================
   FOH ↔ Livestream — Styles
   ========================= */

/* Theme */
:root{
  --bg:#0f1115;
  --panel:#161a22;
  --panel-2:#121723;
  --border:#2a2f3a;
  --ink:#e7ebf3;

  --foh:#2d7cfb;           /* FOH blue */
  --stream:#28a745;        /* Stream green */
  --orange:#ff8c00;        /* Continue / accent */
  --danger:#b00020;        /* Critical alert red */

  --chip:#1b2130;
  --muted:#9aa3b2;
}

/* Reset-ish */
* { box-sizing: border-box; }
html, body { height:100%; }
body {
  margin:0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
}

/* Layout */
.wrap { display:flex; flex-direction:column; height:100vh; max-width:1000px; margin:0 auto; }

/* Header */
header {
  display:flex; align-items:center; justify-content:space-between;
  padding:12px 16px; border-bottom:1px solid var(--border);
  background:var(--panel); position:sticky; top:0; z-index:5;
}
header h1 { font-size:16px; margin:0; opacity:.9; }
.right-tools { display:flex; gap:10px; align-items:center; }
.me-label { opacity:.8; font-size:12px; }

/* Cog button */
.snip-cog-btn {
  background:none; border:1px solid var(--border); padding:6px; border-radius:8px;
  cursor:pointer; display:inline-flex; align-items:center; justify-content:center;
  transition: box-shadow .15s ease, transform .12s ease, background .15s ease;
}
.snip-cog-btn:hover { transform: translateY(-1px); box-shadow:0 6px 16px rgba(0,0,0,.25); }
.snip-cog-btn img { width:20px; height:20px; display:block; transition: transform .2s ease; }
.snip-cog-btn:hover img { transform: rotate(30deg); }

/* Alert banner */
.hidden { display:none !important; }
.alert {
  display:flex; align-items:center; gap:12px;
  padding:10px 14px; color:#fff; background: var(--danger);
  border-bottom:1px solid #9a001b; animation: pulse 1.2s ease-in-out infinite;
}
.alert strong { letter-spacing:.3px; }
.alert .spacer { flex:1; opacity:.95; }

/* Main thread */
.thread { flex:1; overflow:auto; padding:12px 16px; }
.msg {
  background:var(--panel); border:1px solid var(--border);
  border-radius:12px; padding:10px 12px; margin-bottom:10px;
}
.meta { display:flex; gap:8px; align-items:center; margin-bottom:6px; font-size:12px; opacity:.9; }
.role {
  display:inline-block; padding:2px 8px; border-radius:999px; font-weight:600; font-size:11px;
}
.role.FOH   { background:rgba(45,124,251,.15); color:#8fb8ff; border:1px solid rgba(45,124,251,.35); }
.role.STREAM{ background:rgba(40,167,69,.18); color:#88db9a; border:1px solid rgba(40,167,69,.35); }
.reply-ctx { font-size:12px; opacity:.8; margin-bottom:6px; }
.text { white-space: pre-wrap; }

input,
textarea,
select {
  font-size: 16px;
}

#input {
  font-size: 16px;
  padding: 14px 16px;
  min-height: 56px;
}

/* Inline actions on messages */
.row-actions { display:flex; gap:6px; margin-top:8px; }

/* Buttons */
.btn {
  border:1px solid var(--border); background:var(--panel); color:var(--ink);
  padding:6px 10px; border-radius:10px; cursor:pointer; transition:background .15s ease, transform .1s ease, box-shadow .15s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0,0,0,.25); }
.btn:active { transform: translateY(0); box-shadow:none; }
.btn.primary { background: var(--foh); border-color: transparent; color:#fff; }
.btn.ghost { background:transparent; }
.btn.mini { padding:4px 8px; font-size:12px; }

/* Quick phrases + composer */
.quick-phrases {
  display:flex; flex-wrap:wrap; gap:8px; padding:8px 16px;
  border-top:1px solid var(--border); background:var(--panel);
}
.chip {
  border:1px solid var(--border); background: var(--chip); color:var(--ink);
  padding:6px 10px; border-radius:999px; cursor:pointer;
  transition: background .15s ease, transform .1s ease, box-shadow .15s ease;
}
.chip:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0,0,0,.25); }

.chip {
  font-size: 15px;
  padding: 10px 14px;
  border-radius: 999px;
}

.composer {
  display:flex; gap:8px; align-items:flex-end;
  padding:10px 16px; border-top:1px solid var(--border); background:var(--panel);
}
textarea#input {
  flex:1; min-height:44px; max-height:160px; resize:vertical;
  background:#0f141f; border:1px solid var(--border); border-radius:12px;
  color:var(--ink); padding:10px; outline:none;
}
textarea#input:focus { border-color:#3a8bff; box-shadow:0 0 0 3px rgba(58,139,255,.2); }
.composer .send { background: var(--stream); color:#fff; border:none; }
.composer .clear { background:#2a2f3a; color:#ddd; border:1px solid var(--border); }

#sendBtn {
  font-size: 19px;
  font-weight: 600;
  padding: 16px 18px;
}

#clearBtn {
  font-size: 16px;
  padding: 14px 16px;
  opacity: 0.9;
}

/* Role/Name/PIN modal */
.modal {
  position:fixed; inset:0; display:none; align-items:center; justify-content:center;
  background: rgba(0,0,0,.55); z-index:50;
}
.card {
  background:var(--panel); border:1px solid var(--border); border-radius:14px;
  padding:18px 18px 16px; max-width:460px; width:92%;
  box-shadow:0 16px 40px rgba(0,0,0,.35);
}
.card h2 { margin:0 0 8px 0; }
.field { margin:10px 0; }
.field label { display:block; margin-bottom:6px; opacity:.9; }
.roles { display:flex; gap:10px; margin-top:6px; }
.role-btn {
  flex:1; border:1px solid var(--border); background:var(--panel-2); color:#dbe4ff;
  padding:10px; border-radius:10px; cursor:pointer; transition: border-color .15s, transform .1s, box-shadow .15s;
}
.role-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0,0,0,.25); }
.role-btn[data-role="FOH"].selected    { background: rgba(45,124,251,.20); border-color: rgba(45,124,251,.5); }
.role-btn[data-role="STREAM"].selected { background: rgba(40,167,69,.25);  border-color: rgba(40,167,69,.55); }

.pin-grid { display:flex; gap:10px; margin-top:6px; }
.pin {
  width:46px; height:48px; text-align:center; font-size:22px;
  background:#0f141f; border:1px solid var(--border); border-radius:10px; color:var(--ink);
}
.pin:focus { border-color:#3a8bff; box-shadow:0 0 0 3px rgba(58,139,255,.2); outline:none; }

.continue {
  margin-top:12px; background: var(--orange); color:#fff;
  border:none; padding:10px 14px; border-radius:10px; cursor:pointer;
  transition: opacity .15s ease, transform .1s ease, box-shadow .15s ease;
}
.continue:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(0,0,0,.25); }
.continue:disabled { opacity:.5; cursor:not-allowed; box-shadow:none; transform:none; }

.pin {
  font-size: 18px; /* or even 20px */
}

/* Snippet modal */
#snipModal {
  position:fixed; inset:0; display:none; align-items:center; justify-content:center;
  background: rgba(0,0,0,.6); z-index:60;
}
#snipModal .modal-card {
  background:#fff; color:#111; border-radius:12px; max-width:480px; width:92%;
  padding:18px 18px 14px; box-shadow:0 10px 30px rgba(0,0,0,.35);
  animation: fadeIn .2s ease-out;
}
#snipModal h3 { margin:0 0 10px 0; }
#snipList .row { display:flex; gap:6px; align-items:center; margin:.35rem 0; }
#snipList input {
  flex:1; background:#f6f7fb; border:1px solid #d8dbe6; border-radius:8px;
  padding:.45rem .6rem; color:#111;
}
#snipList .btn { background:#eee; color:#111; border-color:#ddd; }
#snipList .btn.mini { padding:4px 8px; }
.snip-actions { display:flex; justify-content:flex-end; gap:8px; margin-top:.75rem; }

/* Utilities */
.link { color:#89b4ff; cursor:pointer; text-decoration:none; }
.link:hover { text-decoration:underline; }

/* Animations */
@keyframes pulse { 0%,100%{ filter:saturate(1) } 50%{ filter:saturate(1.3) } }
@keyframes fadeIn { from { transform: scale(.96); opacity:0 } to { transform: scale(1); opacity:1 } }

/* Responsive */
@media (max-width: 640px){
  .composer { flex-direction: column; align-items: stretch; }
  .composer .btn { width:100%; }
  .right-tools { gap:6px; }
  .me-label { display:none; }
}
/* ---- Start screen (login modal) hardening ---- */
#loginModal.modal {
  position: fixed;
  inset: 0;
  display: flex;           /* JS toggles, but ensure flex rules apply */
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.55);
  z-index: 50;
}

#loginModal .card {
  background: var(--panel, #161a22);
  border: 1px solid var(--border, #2a2f3a);
  border-radius: 14px;
  padding: 18px 18px 16px;
  max-width: 460px;
  width: 92%;
  box-shadow: 0 16px 40px rgba(0,0,0,.35);
}

#loginModal .card h2 {
  margin: 0 0 8px 0;
  font-size: 18px;
}

#loginModal .field { margin: 10px 0; }
#loginModal .field label { display: block; margin-bottom: 6px; opacity: .9; }

#loginModal input {
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border, #2a2f3a);
  background: #0f141f;
  color: var(--ink, #e7ebf3);
  outline: none;
}
#loginModal input:focus {
  border-color: #3a8bff;
  box-shadow: 0 0 0 3px rgba(58,139,255,.2);
}

.login-logo {
  text-align: center;
  margin-bottom: 18px;
}

.login-logo img {
  max-width: 140px;
  width: 100%;
  height: auto;
}

/* Mobile login sizing */
@media (max-width: 600px) {

  /* Make the role buttons bigger */
  .role-btn {
    font-size: 16px;
    padding: 14px 14px;
    border-radius: 14px;
  }

  /* Continue button bigger */
  @media (max-width: 600px) {
  #loginModal .role-btn {
    font-size: 17px;
    padding: 16px 14px;
    border-radius: 14px;
  }

  #loginModal .continue {
    font-size: 18px;
    padding: 16px 18px;
    border-radius: 14px;
  }

  #loginResetBtn {
    font-size: 16px;
    padding: 14px 16px;
    border-radius: 12px;
  }
}
  /* PIN grid: force full width + even boxes */
  #loginModal .pin-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    width: 100%;
  }

  /* PIN input: fill each grid column */
  #loginModal .pin-grid .pin {
    width: 100%;
    height: 56px;
    font-size: 20px;
    text-align: center;
    border-radius: 14px;
  }
}

/* Role buttons */
#loginModal .roles { display: flex; gap: 10px; margin-top: 6px; }
#loginModal .role-btn {
  flex: 1;
  border: 1px solid var(--border, #2a2f3a);
  background: #121723;
  color: #dbe4ff;
  padding: 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color .15s, transform .1s, box-shadow .15s;
}
#loginModal .role-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0,0,0,.25); }
#loginModal .role-btn[data-role="FOH"].selected {
  background: rgba(45,124,251,.20);
  border-color: rgba(45,124,251,.5);
}
#loginModal .role-btn[data-role="STREAM"].selected {
  background: rgba(40,167,69,.25);
  border-color: rgba(40,167,69,.55);
}

/* PIN grid */
/* Desktop default */
#loginModal .pin-grid { display: flex; gap: 10px; margin-top: 6px; }
#loginModal .pin {
  width: 46px; height: 48px; text-align: center; font-size: 22px;
  background: #0f141f; border: 1px solid var(--border, #2a2f3a);
  border-radius: 10px; color: var(--ink, #e7ebf3);
}

/* Mobile: full width PIN boxes */
@media (max-width: 600px) {
  #loginModal .pin-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    width: 100%;
  }
  #loginModal .pin-grid .pin {
    width: 100% !important;
    height: 56px;
    font-size: 20px;
    border-radius: 14px;
  }
}
#loginModal .pin:focus {
  border-color: #3a8bff;
  box-shadow: 0 0 0 3px rgba(58,139,255,.2);
  outline: none;
}

/* Continue button */
#loginModal .continue {
  margin-top: 12px;
  background: var(--orange, #ff8c00);
  color: #fff;
  border: none;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: opacity .15s, transform .1s, box-shadow .15s;
}
#loginModal .continue:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(0,0,0,.25); }
#loginModal .continue:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; transform: none; }
/* ==== Alert bar tweaks ==== */
.alert {
  padding: 14px 16px;              /* slightly deeper */
}
.alert strong {
  font-size: 1.1rem;                /* bigger NEW MESSAGE text */
}

/* Make ACK button full word */
#ackBtn::after {
  content: "NOWLEDGE";              /* adds the rest after "ACK" */
}
#ackBtn {
  min-width: 110px;                 /* gives it room */
  text-align: center;
}

/* ==== Snippet editor Cancel button text colour ==== */
#snipList + .snip-actions .btn.ghost,
#cancelSnipBtn {
  color: #444;                      /* darker grey text for better contrast */
}

/* ==== Highlight latest message ==== */
.msg.latest {
  border-color: #5da0ff;            /* brighter blue border */
  box-shadow: 0 0 0 1px rgba(93,160,255,0.4);
}
