/* FSGAMEO AI chat — champagne gold, full-bleed within leftnav workspace */

.fs-ai-chat {
  --ai-gold: var(--fs-accent, #e8c96a);
  --ai-gold-soft: var(--fs-accent-soft, #f7e5a3);
  --ai-gold-deep: var(--fs-accent-deep, #c19549);
  --ai-surface: var(--fs-surface, #151920);
  --ai-elevated: var(--fs-elevated, #1b212b);
  --ai-line: var(--fs-line, rgba(255, 255, 255, 0.08));
  --ai-line-gold: var(--fs-line-gold, rgba(232, 201, 106, 0.28));
  --ai-text: var(--fs-text, #eef0f4);
  --ai-muted: var(--fs-muted, #9aa3af);
  --ai-bg: var(--fs-bg, #0c0e12);
}

body.fs-ai-chat-page .fs-ai-search-wrap,
body.fs-ai-chat-page .fs-d-header.fs-ai-search-wrap {
  display: none !important;
}

body.fs-ai-chat-page.fs-leftnav-layout .fs-main--ai-chat {
  padding: 0;
  min-height: calc(100vh - 24px);
}

body.fs-ai-chat-page .fs-main--ai-chat {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

.fs-ai-chat {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  width: 100%;
  min-height: calc(100vh - 32px);
  max-height: calc(100vh - 32px);
  margin: 0;
  background:
    radial-gradient(1200px 480px at 12% -10%, rgba(232, 201, 106, 0.08), transparent 55%),
    linear-gradient(180deg, rgba(21, 25, 32, 0.96), rgba(12, 14, 18, 0.98));
  border: 1px solid var(--ai-line-gold);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
}

.fs-ai-chat__side {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 22px 18px;
  background: rgba(12, 14, 18, 0.72);
  border-right: 1px solid var(--ai-line);
}

.fs-ai-chat__brand {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--ai-line);
}

.fs-ai-chat__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--ai-line-gold);
  background: rgba(232, 201, 106, 0.08);
  color: var(--ai-gold);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.fs-ai-chat__title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.04em;
  background: linear-gradient(90deg, var(--ai-gold-deep), var(--ai-gold-soft), var(--ai-gold));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.fs-ai-chat__sub {
  color: var(--ai-muted);
  font-size: 13px;
}

.fs-ai-chat__nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fs-ai-chat__tab {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  width: 100%;
  padding: 14px 14px;
  border-radius: 12px;
  border: 1px solid var(--ai-line);
  background: rgba(255, 255, 255, 0.02);
  color: var(--ai-text);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}

.fs-ai-chat__tab:hover {
  border-color: var(--ai-line-gold);
  background: rgba(232, 201, 106, 0.06);
}

.fs-ai-chat__tab.is-active {
  border-color: var(--ai-line-gold);
  background: linear-gradient(135deg, rgba(232, 201, 106, 0.16), rgba(193, 149, 73, 0.08));
  box-shadow: inset 0 0 0 1px rgba(247, 229, 163, 0.08);
}

.fs-ai-chat__tab-name {
  font-size: 15px;
  font-weight: 700;
}

.fs-ai-chat__tag {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ai-gold-soft);
  background: rgba(232, 201, 106, 0.12);
  border: 1px solid rgba(232, 201, 106, 0.22);
}

.fs-ai-chat__tag.is-free {
  color: #102018;
  background: linear-gradient(90deg, #f7e5a3, #e8c96a);
  border-color: transparent;
}

.fs-ai-chat__hint {
  margin-top: auto;
  margin-bottom: 0;
  color: var(--ai-muted);
  font-size: 12px;
  line-height: 1.65;
}

.fs-ai-chat__stage {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: rgba(12, 14, 18, 0.35);
}

.fs-ai-chat__messages,
.fs-ai-chat__draw {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 28px 28px 12px;
}

.fs-ai-chat__messages[hidden],
.fs-ai-chat__draw[hidden],
.fs-ai-chat__composer[hidden] {
  display: none !important;
}

.fs-ai-chat__msg {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 20px;
}

.fs-ai-chat__msg.is-user {
  flex-direction: row-reverse;
}

.fs-ai-chat__avatar {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #1a1408;
  background: linear-gradient(135deg, var(--ai-gold-soft), var(--ai-gold-deep));
  box-shadow: 0 0 0 1px rgba(232, 201, 106, 0.35);
}

.fs-ai-chat__msg.is-user .fs-ai-chat__avatar {
  color: #f7e5a3;
  background: rgba(232, 201, 106, 0.12);
  box-shadow: inset 0 0 0 1px rgba(232, 201, 106, 0.35);
}

.fs-ai-chat__bubble {
  max-width: min(780px, 86%);
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--ai-line);
  background: rgba(27, 33, 43, 0.92);
  color: var(--ai-text);
  font-size: 15px;
  line-height: 1.75;
  word-break: break-word;
}

.fs-ai-chat__msg.is-user .fs-ai-chat__bubble {
  background: linear-gradient(135deg, rgba(232, 201, 106, 0.22), rgba(193, 149, 73, 0.16));
  border-color: var(--ai-line-gold);
  color: #fff8e8;
}

.fs-ai-chat__bubble a {
  color: var(--ai-gold);
  border-bottom: 1px dashed rgba(232, 201, 106, 0.45);
}

.fs-ai-chat__bubble a:hover {
  color: var(--ai-gold-soft);
}

.fs-ai-chat__bubble p { margin: 0 0 10px; }
.fs-ai-chat__bubble p:last-child { margin-bottom: 0; }
.fs-ai-chat__bubble ul,
.fs-ai-chat__bubble ol {
  margin: 0 0 10px;
  padding-left: 1.2em;
  list-style: disc;
}
.fs-ai-chat__bubble code {
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.92em;
}
.fs-ai-chat__bubble pre {
  overflow-x: auto;
  padding: 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--ai-line);
}

.fs-ai-chat__bubble--img {
  padding: 10px;
  background: rgba(0, 0, 0, 0.22);
}

.fs-ai-chat__bubble--img img,
.ai-drawing-img {
  display: block;
  max-width: min(520px, 100%);
  width: 100%;
  border-radius: 12px;
  margin: 0 auto;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

.fs-ai-chat__composer {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  padding: 14px 20px 18px;
  border-top: 1px solid var(--ai-line);
  background: rgba(12, 14, 18, 0.78);
  backdrop-filter: blur(8px);
}

.fs-ai-chat__input {
  flex: 1;
  min-height: 46px;
  max-height: 160px;
  resize: none;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--ai-line);
  background: rgba(27, 33, 43, 0.95);
  color: var(--ai-text);
  font: inherit;
  line-height: 1.5;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.fs-ai-chat__input:focus {
  border-color: var(--ai-line-gold);
  box-shadow: 0 0 0 3px rgba(232, 201, 106, 0.12);
}

.fs-ai-chat__input::placeholder {
  color: rgba(154, 163, 175, 0.85);
}

.fs-ai-chat__send {
  flex: 0 0 auto;
  min-width: 88px;
  height: 46px;
  padding: 0 18px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #1a1408;
  background: linear-gradient(135deg, var(--ai-gold-soft), var(--ai-gold), var(--ai-gold-deep));
  transition: filter 0.2s, transform 0.15s;
}

.fs-ai-chat__send:hover {
  filter: brightness(1.05);
}

.fs-ai-chat__send:active {
  transform: translateY(1px);
}

.fs-ai-chat__send.is-ghost {
  color: var(--ai-gold-soft);
  background: transparent;
  border: 1px solid var(--ai-line-gold);
}

.fs-ai-chat__lightbox {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.88);
  cursor: zoom-out;
}

.fs-ai-chat__lightbox img {
  max-width: 96vw;
  max-height: 96vh;
  border-radius: 16px;
  box-shadow: 0 4px 32px #000;
}

.ai-loading-dots::after {
  content: '';
  display: inline-block;
  width: 1.2em;
  animation: fs-ai-dots 1.2s steps(4, end) infinite;
}

@keyframes fs-ai-dots {
  0% { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75% { content: '...'; }
}

.ai-loading-question {
  color: var(--ai-gold-soft);
  font-weight: 700;
}

@media (max-width: 960px) {
  body.fs-ai-chat-page.fs-leftnav-layout .fs-main--ai-chat {
    min-height: calc(100vh - 70px);
  }

  .fs-ai-chat {
    grid-template-columns: 1fr;
    min-height: calc(100vh - 78px);
    max-height: none;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  .fs-ai-chat__side {
    gap: 12px;
    padding: 14px 14px 10px;
    border-right: 0;
    border-bottom: 1px solid var(--ai-line);
  }

  .fs-ai-chat__brand {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    padding-bottom: 10px;
  }

  .fs-ai-chat__title {
    font-size: 17px;
  }

  .fs-ai-chat__sub,
  .fs-ai-chat__hint {
    display: none;
  }

  .fs-ai-chat__nav {
    flex-direction: row;
  }

  .fs-ai-chat__tab {
    flex: 1;
    padding: 10px 12px;
  }

  .fs-ai-chat__messages,
  .fs-ai-chat__draw {
    padding: 18px 14px 10px;
  }

  .fs-ai-chat__composer {
    padding: 10px 12px 14px;
  }

  .fs-ai-chat__bubble {
    max-width: 92%;
  }
}

/* Desktop leftnav: fill workspace edge-to-edge */
@media (min-width: 961px) {
  body.fs-ai-chat-page.fs-leftnav-layout .fs-workspace > .fs-main--ai-chat {
    width: 100%;
    max-width: none;
    padding: 12px 16px 16px;
  }

  body.fs-ai-chat-page.fs-leftnav-layout .fs-ai-chat {
    width: 100%;
    min-height: calc(100vh - 40px);
    max-height: calc(100vh - 40px);
  }
}
