/* AIcompanion/aibeloved/assets/css/aibeloved-chat.css
 * Chat UI for AI Beloved. Inherits the clone's dark theme; adds the chat shell.
 * The static SSR dump of chat.html is hidden; #ab-chat-root takes over.
 */
body > *:not(#ab-chat-root) { display: none !important; }

#ab-chat-root.ab-app {
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #0a0a0b;
  color: #f5f5f7;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* header */
.ab-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  border-bottom: 1px solid #1c1c1f;
  background: #0e0e10;
}
.ab-char-pick { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; cursor: pointer; }
.ab-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; flex: none;
}
.ab-who { min-width: 0; }
.ab-name { font-weight: 700; font-size: 15px; line-height: 1.2; }
.ab-tag { font-size: 12px; color: #9a9aa2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ab-pick-btn {
  background: #1a1a1d; border: 1px solid #2a2a2e; color: #cfcfd6;
  border-radius: 8px; width: 28px; height: 28px; cursor: pointer; flex: none;
}
.ab-level { width: 200px; flex: none; }
.ab-level-row { display: flex; justify-content: space-between; font-size: 11px; color: #b6b6be; margin-bottom: 4px; }
.ab-xpbar { height: 6px; background: #1f1f23; border-radius: 99px; overflow: hidden; }
.ab-xpfill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #ff5d8f, #a855f7);
  transition: width .5s ease;
}
.ab-tools { display: flex; gap: 8px; flex: none; }
.ab-select, .ab-reset {
  background: #1a1a1d; border: 1px solid #2a2a2e; color: #d6d6dd;
  border-radius: 8px; padding: 6px 10px; font-size: 12px; cursor: pointer;
}

/* messages */
.ab-messages {
  flex: 1; overflow-y: auto; padding: 22px 16px;
  display: flex; flex-direction: column; gap: 12px;
  max-width: 820px; width: 100%; margin: 0 auto;
}
.ab-msg { display: flex; }
.ab-user { justify-content: flex-end; }
.ab-assistant { justify-content: flex-start; }
.ab-bubble {
  max-width: 78%; padding: 11px 14px; border-radius: 16px;
  font-size: 14.5px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word;
}
.ab-user .ab-bubble {
  background: linear-gradient(135deg, #ff5d8f, #a855f7);
  color: #fff; border-bottom-right-radius: 5px;
}
.ab-assistant .ab-bubble {
  background: #1a1a1d; color: #ececf1; border-bottom-left-radius: 5px;
}

/* composer */
.ab-composer {
  display: flex; gap: 10px; align-items: flex-end;
  padding: 14px 16px; border-top: 1px solid #1c1c1f; background: #0e0e10;
  max-width: 820px; width: 100%; margin: 0 auto;
}
.ab-input {
  flex: 1; resize: none; border-radius: 14px; border: 1px solid #2a2a2e;
  background: #161618; color: #f2f2f5; padding: 12px 14px; font-size: 14.5px;
  font-family: inherit; line-height: 1.4; max-height: 140px; outline: none;
}
.ab-input:focus { border-color: #a855f7; }
.ab-send {
  background: linear-gradient(135deg, #ff5d8f, #a855f7); color: #fff;
  border: none; border-radius: 14px; padding: 0 20px; height: 46px;
  font-weight: 600; cursor: pointer; flex: none;
}
.ab-send:hover { filter: brightness(1.07); }

/* character picker */
.ab-picker {
  position: absolute; top: 64px; left: 18px; z-index: 10;
  background: #161618; border: 1px solid #2a2a2e; border-radius: 14px;
  width: 320px; max-height: 70vh; overflow-y: auto; padding: 8px;
  box-shadow: 0 16px 40px rgba(0,0,0,.5);
}
.ab-pick-item {
  display: flex; align-items: center; gap: 10px; padding: 10px;
  border-radius: 10px; cursor: pointer;
}
.ab-pick-item:hover { background: #1f1f23; }
.ab-pick-av {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 14px;
}
.ab-pick-item small { color: #9a9aa2; }
.ab-pick-create { border-top: 1px solid #2a2a2e; margin-top: 4px; }

@media (max-width: 640px) {
  .ab-level { width: 120px; }
  .ab-bubble { max-width: 88%; }
}
