/* Riley chat widget -- punch item #148 Phase 2, 2026-09-04. Site-wide, loaded from
   includes/foot.php. Uses the same design tokens as the rest of the redesign (style.css) --
   deliberately not a separate visual language. */

#riley-launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 900;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: var(--red);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: transform 0.15s ease;
}
#riley-launcher:hover { transform: scale(1.06); }
#riley-launcher img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; display: block; }
#riley-launcher .riley-launcher-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #2ecc71;
  border: 2px solid var(--bg);
  display: none;
}
#riley-launcher.riley-has-unread .riley-launcher-badge { display: block; }

/* Online/offline presence dot -- bottom-right of the avatar, standard chat-app placement
   (kept separate from .riley-launcher-badge above, which is the unread-count indicator,
   top-right). Added 2026-09-05, Brandon direct -- see foot.php's own comment for the
   6am-8pm Central schedule this reflects. */
#riley-launcher .riley-launcher-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--bg);
}
#riley-launcher .riley-launcher-dot.riley-online { background: #2ecc71; }
#riley-launcher .riley-launcher-dot.riley-offline { background: var(--ink-faint); }

/* "Chat with Riley" label bubble, sitting just left of the launcher -- Brandon direct,
   2026-09-05: make it obvious the launcher is clickable, not just a floating photo. */
.riley-launcher-label {
  position: fixed;
  right: 90px;
  bottom: 34px;
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.riley-launcher-label-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2ecc71;
  flex: none;
}
.riley-launcher-label-offline { color: var(--ink-muted); font-weight: 500; }
.riley-launcher-label-offline .riley-launcher-label-dot { background: var(--ink-faint); }
.riley-launcher-label-hidden { opacity: 0; pointer-events: none; }
@media (max-width: 480px) {
  .riley-launcher-label { display: none; }
}

#riley-panel {
  position: fixed;
  right: 20px;
  bottom: 92px;
  z-index: 900;
  width: min(360px, calc(100vw - 40px));
  height: min(520px, calc(100vh - 140px));
  background: var(--bg-raised);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--sans);
}
#riley-panel.riley-open { display: flex; }

#riley-panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--bg-inset);
  border-bottom: 1px solid var(--line);
}
#riley-panel-header img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
#riley-panel-header .riley-header-text { flex: 1; min-width: 0; }
#riley-panel-header .riley-header-name { color: var(--ink); font-weight: 600; font-size: 0.95rem; }
#riley-panel-header .riley-header-status { color: var(--ink-faint); font-size: 0.72rem; font-family: var(--mono); }
#riley-panel-close {
  background: none;
  border: none;
  color: var(--ink-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}
#riley-panel-close:hover { color: var(--ink); }

#riley-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.riley-msg { max-width: 85%; padding: 9px 12px; border-radius: 10px; font-size: 0.88rem; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.riley-msg-visitor { align-self: flex-end; background: var(--red); color: #fff; border-bottom-right-radius: 3px; }
.riley-msg-riley { align-self: flex-start; background: var(--bg-inset); color: var(--ink); border: 1px solid var(--line); border-bottom-left-radius: 3px; }
.riley-msg-system { align-self: center; color: var(--ink-faint); font-size: 0.76rem; font-family: var(--mono); text-align: center; max-width: 100%; }

#riley-typing { align-self: flex-start; color: var(--ink-faint); font-size: 0.78rem; font-family: var(--mono); padding: 0 16px 8px; display: none; }
#riley-typing.riley-visible { display: block; }

#riley-form { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line); background: var(--bg-inset); }
#riley-input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--ink);
  padding: 9px 12px;
  font-size: 0.88rem;
  font-family: var(--sans);
  resize: none;
}
#riley-input:focus { outline: none; border-color: var(--red); }
#riley-send {
  background: var(--red);
  border: none;
  border-radius: 8px;
  color: #fff;
  padding: 0 16px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}
#riley-send:disabled { opacity: 0.5; cursor: default; }

@media (max-width: 480px) {
  #riley-panel { right: 12px; left: 12px; width: auto; bottom: 84px; }
  #riley-launcher { right: 16px; bottom: 16px; }
}
