/* ── Elevation 168 — Motivation Chat ── */

.chat-section {
  background: #050608;
  border-top: 1px solid rgba(225,6,0,0.12);
}

/* Full-bleed — strip horizontal padding from .section, restore it inside */
.chat-section.section {
  padding-left: 0 !important;
  padding-right: 0 !important;
}

.chat-section-top {
  padding-left: clamp(20px, 6vw, 78px);
  padding-right: clamp(20px, 6vw, 78px);
}

/* ── Widget shell ── */
.chat-widget {
  background: #0b0f13;
  border-left: none;
  border-right: none;
  border-top: 1px solid rgba(247,247,244,0.08);
  border-bottom: 1px solid rgba(247,247,244,0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-width: none;
}

/* ── Header ── */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(247,247,244,0.07);
  background: rgba(0,0,0,0.28);
}

.chat-identity {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-avatar {
  width: 32px;
  height: 32px;
  background: var(--hot-red);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: Anton, sans-serif;
  font-size: 0.72rem;
  color: #fff;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.chat-nick {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--white);
  letter-spacing: 0.04em;
}

.chat-rename-btn {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.58rem;
  color: rgba(247,247,244,0.28);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 180ms ease;
}
.chat-rename-btn:hover { color: rgba(247,247,244,0.6); }

.chat-live-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #4caf50;
}
.chat-live-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  background: #4caf50;
  border-radius: 50%;
  animation: livePulse 1.8s ease-in-out infinite;
}
@keyframes livePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}
.chat-live-badge.demo {
  color: rgba(247,247,244,0.25);
}
.chat-live-badge.demo::before {
  background: rgba(247,247,244,0.25);
  animation: none;
}

/* ── Message feed ── */
.chat-feed {
  height: 280px;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
.chat-feed::-webkit-scrollbar { width: 3px; }
.chat-feed::-webkit-scrollbar-track { background: transparent; }
.chat-feed::-webkit-scrollbar-thumb { background: rgba(247,247,244,0.1); }

.chat-empty {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  color: rgba(247,247,244,0.18);
  letter-spacing: 0.06em;
  text-align: center;
  margin: auto;
  line-height: 1.8;
}

.chat-msg {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  animation: msgIn 260ms cubic-bezier(0.34,1.4,0.64,1) both;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(6px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

.chat-msg-av {
  width: 28px;
  height: 28px;
  background: rgba(247,247,244,0.06);
  border: 1px solid rgba(247,247,244,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: Anton, sans-serif;
  font-size: 0.6rem;
  color: rgba(247,247,244,0.4);
  flex-shrink: 0;
}

.chat-msg-body { flex: 1; min-width: 0; }

.chat-msg-nick {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(247,247,244,0.35);
  margin-bottom: 4px;
}

.chat-msg-bubble {
  display: inline-block;
  padding: 8px 12px;
  background: rgba(247,247,244,0.04);
  border: 1px solid rgba(247,247,244,0.07);
  font-size: 0.82rem;
  color: rgba(247,247,244,0.82);
  line-height: 1.4;
}

/* Mine — red accent */
.chat-msg.is-mine .chat-msg-av {
  background: rgba(225,6,0,0.12);
  border-color: rgba(225,6,0,0.3);
  color: rgba(225,6,0,0.7);
}
.chat-msg.is-mine .chat-msg-nick { color: rgba(225,6,0,0.6); }
.chat-msg.is-mine .chat-msg-bubble {
  background: rgba(225,6,0,0.1);
  border-color: rgba(225,6,0,0.22);
}

/* ── Phrase buttons ── */
.chat-phrases {
  padding: 14px 20px 20px;
  border-top: 1px solid rgba(247,247,244,0.06);
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chat-phrase {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: rgba(247,247,244,0.6);
  background: rgba(247,247,244,0.04);
  border: 1px solid rgba(247,247,244,0.1);
  padding: 7px 12px;
  cursor: pointer;
  user-select: none;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 110ms ease;
  white-space: nowrap;
}
.chat-phrase:hover {
  background: rgba(225,6,0,0.12);
  border-color: rgba(225,6,0,0.38);
  color: var(--white);
  transform: translateY(-1px);
}
.chat-phrase:active { transform: scale(0.96); }
.chat-phrase.fired {
  background: rgba(225,6,0,0.2);
  border-color: rgba(225,6,0,0.45);
  color: var(--white);
}
.chat-phrase:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
}

/* ── Rename modal ── */
.chat-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(5,6,8,0.88);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}
.chat-modal-overlay.open { display: flex; }

.chat-modal-box {
  background: #0b0f13;
  border: 1px solid rgba(225,6,0,0.28);
  padding: 32px;
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-modal-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--hot-red);
}

.chat-modal-input {
  background: rgba(247,247,244,0.04);
  border: 1px solid rgba(247,247,244,0.14);
  color: var(--white);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.92rem;
  padding: 11px 14px;
  width: 100%;
  outline: none;
  box-sizing: border-box;
  transition: border-color 200ms ease;
}
.chat-modal-input:focus { border-color: rgba(225,6,0,0.5); }

.chat-modal-actions { display: flex; gap: 10px; }

.chat-modal-save {
  flex: 1;
  background: var(--hot-red);
  border: none;
  color: #fff;
  font-family: Anton, sans-serif;
  font-size: 1rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 11px;
  cursor: pointer;
  transition: opacity 180ms ease;
}
.chat-modal-save:hover { opacity: 0.85; }

.chat-modal-cancel {
  background: none;
  border: 1px solid rgba(247,247,244,0.14);
  color: rgba(247,247,244,0.45);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  padding: 11px 16px;
  cursor: pointer;
  transition: border-color 180ms ease, color 180ms ease;
}
.chat-modal-cancel:hover { border-color: rgba(247,247,244,0.35); color: rgba(247,247,244,0.7); }

/* ── Responsive ── */
@media (max-width: 640px) {
  .chat-feed { height: 220px; }
  .chat-phrases { gap: 6px; }
  .chat-phrase { font-size: 0.6rem; padding: 6px 10px; }
  .chat-modal-box { margin: 0 16px; padding: 24px; }
}
