/* ============================================================
   NOX — chat widget styles
   ----------------------------------------------------------------
   Floating button bottom-right + slide-up panel.
   Brand-matched typography (Bebas Neue / Barlow Condensed),
   theme-aware (vanilla / brown), mobile takes over full-width.
   Motion baseline: cubic-bezier(0.32, 0.72, 0, 1) ~620ms (longer
   for panel slide), shorter for button hover states.
   ============================================================ */

.nox-chat {
  --nox-orange: #E8540A;
  --nox-cream: #F2EDE8;
  --nox-ink: #151515;
  --nox-panel-w: 380px;
  --nox-panel-h: 580px;
  --nox-radius: 14px;
  --nox-ease: cubic-bezier(0.32, 0.72, 0, 1);

  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: 'Barlow Condensed', 'Arial Narrow', sans-serif;
}

/* ---- Toggle button (bottom-right) ---- */
.nox-chat__toggle {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--nox-orange);
  color: var(--nox-cream);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow:
    0 10px 28px rgba(232, 84, 10, 0.32),
    0 2px 6px rgba(0, 0, 0, 0.12);
  transition:
    transform 0.4s var(--nox-ease),
    box-shadow 0.4s var(--nox-ease),
    background 0.4s var(--nox-ease);
  outline: none;
}

.nox-chat__toggle:hover {
  transform: translateY(-2px);
  box-shadow:
    0 14px 36px rgba(232, 84, 10, 0.4),
    0 3px 8px rgba(0, 0, 0, 0.15);
}

.nox-chat__toggle:focus-visible {
  outline: 2px solid var(--nox-orange);
  outline-offset: 4px;
}

.nox-chat__toggle:active {
  transform: translateY(0);
}

.nox-chat__toggle-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Robot face — subtle blink every ~6s so Nox feels alive */
.nox-face-eye {
  transform-box: fill-box;
  transform-origin: center;
  animation: noxBlink 6.4s infinite;
}

@keyframes noxBlink {
  0%, 93%, 97%, 100% { transform: scaleY(1); }
  95% { transform: scaleY(0.12); }
}

@media (prefers-reduced-motion: reduce) {
  .nox-face-eye { animation: none; }
}

.nox-chat__toggle-dot {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #1AB967;
  border: 2px solid var(--nox-orange);
  box-shadow: 0 0 0 0 rgba(26, 185, 103, 0.5);
  animation: noxPulse 2.8s var(--nox-ease) infinite;
}

@keyframes noxPulse {
  0%   { box-shadow: 0 0 0 0 rgba(26, 185, 103, 0.55); }
  70%  { box-shadow: 0 0 0 10px rgba(26, 185, 103, 0); }
  100% { box-shadow: 0 0 0 0 rgba(26, 185, 103, 0); }
}

/* Toggle morphs to X-ish accent when panel is open */
.nox-chat[data-state="open"] .nox-chat__toggle {
  transform: rotate(90deg);
}

/* ---- Panel ---- */
.nox-chat__panel {
  position: absolute;
  bottom: calc(100% + 14px);
  right: 0;
  width: var(--nox-panel-w);
  max-width: calc(100vw - 32px);
  height: var(--nox-panel-h);
  max-height: calc(100vh - 100px);
  background: var(--nox-cream);
  border-radius: var(--nox-radius);
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.22),
    0 4px 12px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.97);
  pointer-events: none;
  transition:
    opacity   0.42s var(--nox-ease),
    transform 0.52s var(--nox-ease);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.nox-chat[data-state="open"] .nox-chat__panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ---- Header ---- */
.nox-chat__header {
  flex-shrink: 0;
  padding: 14px 16px;
  background: var(--nox-ink);
  color: var(--nox-cream);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(232, 84, 10, 0.2);
}

.nox-chat__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.nox-chat__mark {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--nox-orange);
  color: var(--nox-cream);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nox-chat__brand-text {
  min-width: 0;
}

.nox-chat__name {
  font-family: 'Bebas Neue', 'Arial Black', Impact, sans-serif;
  font-size: 18px;
  letter-spacing: 0.05em;
  line-height: 1;
  color: var(--nox-cream);
}

.nox-chat__role {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(242, 237, 232, 0.6);
  margin-top: 3px;
}

.nox-chat__close {
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(242, 237, 232, 0.08);
  color: var(--nox-cream);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.25s var(--nox-ease);
  flex-shrink: 0;
}

.nox-chat__close:hover {
  background: rgba(242, 237, 232, 0.18);
}

/* ---- Messages list ---- */
.nox-chat__messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}

.nox-chat__messages::-webkit-scrollbar { width: 6px; }
.nox-chat__messages::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 3px; }

.nox-chat__msg {
  max-width: 86%;
  padding: 10px 14px;
  border-radius: 14px;
  font-family: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  font-size: 15px;
  line-height: 1.5;
  word-wrap: break-word;
}

.nox-chat__msg p {
  margin: 0 0 6px 0;
}

.nox-chat__msg p:last-child { margin-bottom: 0; }

.nox-chat__msg ul {
  margin: 6px 0;
  padding-left: 18px;
}

.nox-chat__msg li { margin-bottom: 3px; }

.nox-chat__msg strong { font-weight: 700; }

.nox-chat__msg em { font-style: italic; }

.nox-chat__msg code {
  background: rgba(0, 0, 0, 0.07);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: ui-monospace, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
}

.nox-chat__msg a {
  color: #B83F00;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 700;
}

.nox-chat__msg a:hover { color: var(--nox-orange); }

.nox-chat__msg--user {
  align-self: flex-end;
  background: var(--nox-ink);
  color: var(--nox-cream);
  border-bottom-right-radius: 4px;
}

.nox-chat__msg--user a { color: #FFB07A; }

.nox-chat__msg--assistant {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.85);
  color: var(--nox-ink);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-bottom-left-radius: 4px;
}

/* ---- Suggestion chips (empty state) ---- */
.nox-chat__suggestions {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.nox-chat__chip {
  font-family: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  padding: 9px 13px;
  border: 1px solid rgba(232, 84, 10, 0.32);
  background: rgba(232, 84, 10, 0.05);
  color: var(--nox-ink);
  border-radius: 10px;
  cursor: pointer;
  transition:
    border-color 0.28s var(--nox-ease),
    background   0.28s var(--nox-ease),
    transform    0.18s var(--nox-ease);
  line-height: 1.35;
}

.nox-chat__chip:hover {
  border-color: var(--nox-orange);
  background: rgba(232, 84, 10, 0.1);
  transform: translateY(-1px);
}

.nox-chat__chip:active {
  transform: translateY(0);
}

.nox-chat__chip:focus-visible {
  outline: 2px solid var(--nox-orange);
  outline-offset: 2px;
}

:root.dark .nox-chat__chip {
  background: rgba(232, 84, 10, 0.08);
  border-color: rgba(232, 84, 10, 0.35);
  color: var(--nox-cream);
}

:root.dark .nox-chat__chip:hover {
  border-color: var(--nox-orange);
  background: rgba(232, 84, 10, 0.14);
}

/* Typing dots */
.nox-chat__msg--thinking {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nox-chat__dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.nox-chat__dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--nox-orange);
  opacity: 0.4;
  animation: noxDot 1.1s var(--nox-ease) infinite;
}

.nox-chat__dots span:nth-child(2) { animation-delay: 0.15s; }
.nox-chat__dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes noxDot {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40%           { opacity: 1; transform: translateY(-3px); }
}

.nox-chat__thinking-text {
  font-size: 13px;
  letter-spacing: 0.04em;
  color: rgba(21, 21, 21, 0.6);
}

/* ---- Input area ---- */
.nox-chat__form {
  flex-shrink: 0;
  padding: 12px;
  background: rgba(0, 0, 0, 0.02);
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.nox-chat__input {
  flex: 1;
  resize: none;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: var(--nox-cream);
  color: var(--nox-ink);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  font-size: 15px;
  line-height: 1.4;
  max-height: 120px;
  outline: none;
  transition: border-color 0.25s var(--nox-ease);
}

.nox-chat__input:focus {
  border-color: var(--nox-orange);
}

.nox-chat__input::placeholder {
  color: rgba(21, 21, 21, 0.4);
}

.nox-chat__input:disabled {
  opacity: 0.6;
  cursor: wait;
}

.nox-chat__send {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: var(--nox-orange);
  color: var(--nox-cream);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.25s var(--nox-ease),
    transform  0.18s var(--nox-ease);
}

.nox-chat__send:hover {
  background: #FF6520;
  transform: translateY(-1px);
}

.nox-chat__send:active { transform: translateY(0); }

.nox-chat__send:disabled {
  opacity: 0.5;
  cursor: wait;
  transform: none;
}

/* ---- Footer ---- */
.nox-chat__footer {
  flex-shrink: 0;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: var(--nox-cream);
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.nox-chat__clear {
  border: none;
  background: none;
  color: rgba(21, 21, 21, 0.45);
  font: inherit;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  transition: color 0.2s var(--nox-ease), background 0.2s var(--nox-ease);
}

.nox-chat__clear:hover {
  color: var(--nox-orange);
  background: rgba(232, 84, 10, 0.06);
}

/* ============================================================
   BROWN MODE (dark theme on noxusstudios.com)
   The site uses `:root.dark` for brown mode.
   ============================================================ */
:root.dark .nox-chat {
  --nox-cream: #E8DCCB;
  --nox-ink: #14100B;
}

:root.dark .nox-chat__panel {
  background: #1A130C;
  border-color: rgba(255, 255, 255, 0.05);
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.5),
    0 4px 12px rgba(0, 0, 0, 0.25);
}

:root.dark .nox-chat__header {
  background: #0E0A06;
  border-bottom-color: rgba(232, 84, 10, 0.25);
}

:root.dark .nox-chat__close {
  background: rgba(232, 220, 203, 0.08);
}

:root.dark .nox-chat__close:hover {
  background: rgba(232, 220, 203, 0.18);
}

:root.dark .nox-chat__msg--user {
  background: var(--nox-orange);
  color: #fff;
}

:root.dark .nox-chat__msg--user a {
  color: #FFE5D5;
}

:root.dark .nox-chat__msg--assistant {
  background: rgba(255, 255, 255, 0.04);
  color: var(--nox-cream);
  border-color: rgba(255, 255, 255, 0.06);
}

:root.dark .nox-chat__msg code {
  background: rgba(255, 255, 255, 0.08);
}

:root.dark .nox-chat__msg a { color: #FFB07A; }
:root.dark .nox-chat__msg a:hover { color: #FFC9A0; }

:root.dark .nox-chat__thinking-text {
  color: rgba(232, 220, 203, 0.55);
}

:root.dark .nox-chat__form {
  background: rgba(255, 255, 255, 0.02);
  border-top-color: rgba(255, 255, 255, 0.05);
}

:root.dark .nox-chat__input {
  background: #14100B;
  color: var(--nox-cream);
  border-color: rgba(255, 255, 255, 0.1);
}

:root.dark .nox-chat__input::placeholder {
  color: rgba(232, 220, 203, 0.35);
}

:root.dark .nox-chat__footer {
  background: #1A130C;
  color: rgba(232, 220, 203, 0.4);
  border-top-color: rgba(255, 255, 255, 0.04);
}

:root.dark .nox-chat__clear {
  color: rgba(232, 220, 203, 0.4);
}

:root.dark .nox-chat__clear:hover {
  background: rgba(232, 84, 10, 0.12);
}

/* ============================================================
   MOBILE — takes over most of the screen
   ============================================================ */
@media (max-width: 600px) {
  .nox-chat {
    bottom: 16px;
    right: 16px;
  }

  .nox-chat__panel {
    width: calc(100vw - 32px);
    height: calc(100vh - 100px);
    max-height: calc(100vh - 100px);
    right: 0;
    bottom: calc(100% + 12px);
  }

  .nox-chat__toggle {
    width: 52px;
    height: 52px;
  }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .nox-chat__toggle,
  .nox-chat__panel,
  .nox-chat__send,
  .nox-chat__close,
  .nox-chat__clear {
    transition: none !important;
    animation: none !important;
  }
  .nox-chat__toggle-dot {
    animation: none !important;
  }
  .nox-chat__dots span {
    animation: none !important;
  }
}
