:root {
  --jai-primary: #2d6cdf;
  --jai-llm-bg: #111827;
  --jai-llm-bg-2: #0f172a;
  --jai-llm-panel: #172033;
  --jai-llm-panel-2: #1b2740;
  --jai-llm-text: #eef2ff;
  --jai-llm-muted: #b9c5e5;
  --jai-llm-border: rgba(255,255,255,.08);
  --jai-llm-glow: rgba(45,108,223,.14);
  --jai-llm-user: #243761;
  --jai-llm-assistant: #17223c;
}

.jewechwi-llm-shell,
.jewechwi-llm-page,
.llm-shell,
.jewechwi-llm-target {
  position: relative;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(72, 94, 160, 0.14), transparent 28%),
    radial-gradient(circle at top right, rgba(96, 124, 198, 0.10), transparent 24%),
    linear-gradient(180deg, var(--jai-llm-bg) 0%, var(--jai-llm-bg-2) 100%);
  color: var(--jai-llm-text);
  font-family: Inter, Arial, sans-serif;
  overflow-x: hidden;
}

.jewechwi-llm-shell::before,
.jewechwi-llm-page::before,
.llm-shell::before,
.jewechwi-llm-target::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 20% 18%, rgba(45,108,223,.11), transparent 18%),
    radial-gradient(circle at 80% 12%, rgba(82,134,245,.08), transparent 16%),
    radial-gradient(circle at 50% 100%, rgba(61,117,237,.06), transparent 22%);
  z-index: 0;
}

.jewechwi-llm-topbar,
.jewechwi-llm-body,
.jewechwi-llm-chat-area,
.jewechwi-llm-composer {
  position: relative;
  z-index: 1;
}

.jewechwi-llm-topbar {
  padding: 20px 18px 10px;
}

.jewechwi-llm-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
}

.jewechwi-llm-brand img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  display: block;
  border-radius: 12px;
  background: rgba(255,255,255,.08);
  padding: 4px;
}

.jewechwi-llm-brand-badge {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--jai-primary), #78a6ff);
  color: #fff;
  box-shadow: 0 10px 30px rgba(45,108,223,.22);
  font-size: 14px;
  font-weight: 800;
}

.jewechwi-llm-brand-text {
  font-size: 15px;
  line-height: 1.2;
}

.jewechwi-llm-body {
  width: min(1100px, calc(100% - 24px));
  margin: 0 auto;
  padding: 8px 0 28px;
}

.jewechwi-llm-intro {
  margin-bottom: 16px;
}

.jewechwi-llm-intro-card {
  background: rgba(18, 25, 51, 0.88);
  border: 1px solid var(--jai-llm-border);
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 20px 44px rgba(0,0,0,.22);
}

.jewechwi-llm-title {
  margin: 0 0 8px;
  font-size: 28px;
  line-height: 1.15;
  color: #fff;
}

.jewechwi-llm-subtitle {
  margin: 0;
  color: var(--jai-llm-muted);
  line-height: 1.65;
  font-size: 15px;
}

.jewechwi-llm-prompts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.prompt-chip,
.jewechwi-llm-prompt,
.jewechwi-prompt-chip,
[data-prompt] {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.05);
  color: #f3f6ff !important;
  border-radius: 16px;
  padding: 18px 20px;
  cursor: pointer;
  transition: all .2s ease;
  font-weight: 500;
  line-height: 1.45;
  box-shadow: none;
  font-family: inherit;
  font-size: 14px;
}

.prompt-chip:hover,
.jewechwi-llm-prompt:hover,
.jewechwi-prompt-chip:hover,
[data-prompt]:hover {
  background: rgba(45,108,223,0.14);
  border-color: rgba(120,166,255,0.26);
  color: #fff !important;
  transform: translateY(-1px);
}

.prompt-chip:focus,
.jewechwi-llm-prompt:focus,
.jewechwi-prompt-chip:focus,
[data-prompt]:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(45,108,223,0.18);
}

.jewechwi-llm-chat-area {
  background: rgba(18, 25, 51, 0.88);
  border: 1px solid var(--jai-llm-border);
  border-radius: 26px;
  box-shadow: 0 24px 48px rgba(0,0,0,.22);
  overflow: hidden;
}

.jewechwi-llm-messages-wrap {
  padding: 22px 18px 8px;
  max-height: 62vh;
  min-height: 360px;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.jewechwi-llm-messages {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.jewechwi-llm-welcome {
  border: 1px solid var(--jai-llm-border);
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
  border-radius: 22px;
  padding: 20px;
}

.jewechwi-llm-welcome h3 {
  margin: 0 0 10px;
  font-size: 21px;
  color: #fff;
}

.jewechwi-llm-welcome p {
  margin: 0;
  color: var(--jai-llm-muted);
  line-height: 1.65;
}

.jewechwi-llm-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.jewechwi-llm-avatar {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  box-shadow: 0 10px 24px rgba(0,0,0,.22);
}

.jewechwi-llm-avatar.is-assistant {
  background: linear-gradient(135deg, var(--jai-primary), #78a6ff);
}

.jewechwi-llm-avatar.is-user {
  background: #243761;
}

.jewechwi-llm-bubble {
  flex: 1;
  min-width: 0;
  border-radius: 28px;
  padding: 16px 18px;
  border: 1px solid var(--jai-llm-border);
  box-shadow: 0 12px 28px rgba(0,0,0,.18);
  line-height: 1.65;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.jewechwi-llm-bubble.is-assistant {
  background: var(--jai-llm-assistant);
  color: #eef2ff;
}

.jewechwi-llm-bubble.is-user {
  background: var(--jai-llm-user);
  color: #fff;
}

.jewechwi-llm-meta {
  font-size: 12px;
  color: var(--jai-llm-muted);
  margin-bottom: 8px;
}

.jewechwi-llm-content a {
  color: #8db7ff;
  text-decoration: none;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.jewechwi-llm-typing {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.jewechwi-llm-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  background: var(--jai-llm-muted);
  animation: jewechwiLlmBlink 1s infinite ease-in-out;
}

.jewechwi-llm-typing span:nth-child(2) { animation-delay: .15s; }
.jewechwi-llm-typing span:nth-child(3) { animation-delay: .3s; }

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

.jewechwi-llm-composer {
  padding: 14px 16px 16px;
  border-top: 1px solid var(--jai-llm-border);
  background: linear-gradient(180deg, rgba(255,255,255,.01), rgba(255,255,255,.03));
}

.jewechwi-llm-form {
  display: flex;
  align-items: stretch;
  gap: 12px;
}

.jewechwi-llm-input {
  flex: 1;
  min-height: 92px;
  max-height: 220px;
  resize: none;
  border: 1px solid rgba(255,255,255,.08);
  outline: none;
  border-radius: 28px;
  background: rgba(255,255,255,.03);
  color: #eef2ff;
  font-size: 15px;
  line-height: 1.5;
  padding: 18px 18px;
  font-family: inherit;
  box-sizing: border-box;
}

.jewechwi-llm-input::placeholder {
  color: #9fb0dc;
}

.jewechwi-llm-input:focus {
  box-shadow: 0 0 0 3px rgba(45,108,223,.18);
  border-color: rgba(120,166,255,.22);
}

.jewechwi-llm-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  align-self: stretch;
}

.jewechwi-llm-clear {
  border: none;
  background: rgba(255,255,255,.06);
  color: #eef2ff;
  border-radius: 18px;
  padding: 12px 12px;
  cursor: pointer;
  font-weight: 600;
  font-family: inherit;
  transition: .2s ease;
}

.jewechwi-llm-clear:hover {
  background: rgba(255,255,255,.09);
}

.jewechwi-llm-send {
  background: linear-gradient(135deg, var(--jai-primary), #78a6ff);
  color: #fff;
  border: none;
  border-radius: 18px;
  width: 52px;
  height: 52px;
  min-width: 52px;
  min-height: 52px;
  cursor: pointer;
  padding: 0;
  margin: 0;
  line-height: 1;
  font-size: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  appearance: none;
  -webkit-appearance: none;
  touch-action: manipulation;
  position: relative;
  flex-shrink: 0;
  box-shadow: 0 14px 30px rgba(45,108,223,0.22);
  transition: .2s ease;
}

.jewechwi-llm-send:hover {
  filter: brightness(1.04);
  transform: translateY(-1px);
}

.jewechwi-llm-send:active {
  transform: scale(0.96);
}

.jewechwi-llm-send:disabled {
  opacity: .55;
  cursor: not-allowed;
  transform: none;
}

.jewechwi-llm-send:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(45,108,223,.18);
}

.jewechwi-llm-send .jewechwi-send-svg {
  width: 18px;
  height: 18px;
  display: block;
  fill: #fff;
  transform: translateX(1px) translateY(0);
  transform-origin: center;
  pointer-events: none;
  flex-shrink: 0;
}

.jewechwi-llm-help {
  margin-top: 10px;
  font-size: 12px;
  color: var(--jai-llm-muted);
  padding: 0 4px;
}

@media (max-width: 768px) {
  .jewechwi-llm-body {
    width: calc(100% - 16px);
  }

  .jewechwi-llm-topbar {
    padding: 14px 10px 8px;
  }

  .jewechwi-llm-title {
    font-size: 22px;
  }

  .jewechwi-llm-intro-card {
    padding: 18px;
  }

  .jewechwi-llm-prompts {
    grid-template-columns: 1fr;
  }

  .jewechwi-llm-messages-wrap {
    min-height: 300px;
    max-height: 54vh;
    padding: 16px 12px 8px;
  }

  .jewechwi-llm-composer {
    padding: 12px;
  }

  .jewechwi-llm-form {
    gap: 8px;
  }

  .jewechwi-llm-send {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    border-radius: 16px;
  }

  .jewechwi-llm-send .jewechwi-send-svg {
    width: 18px;
    height: 18px;
  }
}


/* Fix final: composer collé en bas comme ChatGPT/Gemini */
.jewechwi-llm-shell,
.jewechwi-llm-target {
  min-height: min(78vh, 860px);
}

.jewechwi-llm-chat-area {
  display: flex;
  flex-direction: column;
  min-height: min(78vh, 860px);
}

.jewechwi-llm-messages-wrap {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  padding-bottom: 12px;
}

.jewechwi-llm-composer {
  margin-top: auto;
  position: sticky;
  bottom: 0;
  z-index: 4;
  backdrop-filter: blur(12px);
  background: linear-gradient(180deg, rgba(11,16,32,.35), rgba(18,25,51,.96) 20%);
}

.jewechwi-llm-input {
  min-height: 108px;
  padding: 20px 18px;
}

.jewechwi-llm-help {
  text-align: left;
}

@media (max-width: 768px) {
  .jewechwi-llm-shell,
  .jewechwi-llm-target,
  .jewechwi-llm-chat-area {
    min-height: 72vh;
  }

  .jewechwi-llm-input {
    min-height: 96px;
  }
}


/* Stronger bottom composer layout for standalone LLM page */
body.jewechwi-llm-standalone-page .jewechwi-llm-page-main {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 92px);
}

body.jewechwi-llm-standalone-page .jewechwi-llm-target {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: calc(100vh - 300px);
}

body.jewechwi-llm-standalone-page .jewechwi-llm-chat-area {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: inherit;
  height: 100%;
}

body.jewechwi-llm-standalone-page .jewechwi-llm-messages-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-bottom: 16px;
}

body.jewechwi-llm-standalone-page .jewechwi-llm-composer {
  margin-top: auto;
  position: sticky;
  bottom: 0;
  z-index: 6;
}

body.jewechwi-llm-standalone-page .jewechwi-llm-input {
  min-height: 120px;
  border-radius: 30px;
}

@media (max-width: 768px) {
  body.jewechwi-llm-standalone-page .jewechwi-llm-page-main {
    min-height: calc(100vh - 74px);
  }

  body.jewechwi-llm-standalone-page .jewechwi-llm-target {
    min-height: calc(100vh - 250px);
  }

  body.jewechwi-llm-standalone-page .jewechwi-llm-input {
    min-height: 104px;
  }
}
