
/* =====================================
   ASK ZIRADDIN — SUPPLIED CHAT DESIGN
   ===================================== */

/* LIGHT THEME */
:root {
  --chat-bg: rgba(255, 255, 255, 0.95);
  --chat-text: #070707;
  --chat-muted: #777777;
  --chat-border: #e8e8e8;
  --chat-hover: rgba(0, 0, 0, 0.055);
  --chat-bubble: #f4f4f4;
  --chat-input: rgba(247, 247, 247, 0.4);
  --chat-button: #ffffff;
  --chat-accent: #5535ed;
  --chat-accent-text: #ffffff;
}

/* DARK THEME */
body[data-theme="dark"] {
  --chat-bg: rgba(37, 37, 37, 0.95);
  --chat-text: #fafafa;
  --chat-muted: #aaaaaa;
  --chat-border: #414141;
  --chat-hover: rgba(255, 255, 255, 0.075);
  --chat-bubble: #333333;
  --chat-input: rgba(255, 255, 255, 0.045);
  --chat-button: #292929;
  --chat-accent: #6448ff;
  --chat-accent-text: #ffffff;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: Inter, Geist, Arial, sans-serif;
  background: #111116;
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--chat-accent);
  outline-offset: 2px;
}

/* =====================================
   FLOATING LAUNCH BUTTON
   ===================================== */

.chat-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9998;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #ffffff;
  color: #161616;
  border: 1px solid #e7e7e7;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  box-shadow: 0 8px 28px #00000035;
  transition: transform 0.2s, box-shadow 0.2s;
}

.chat-launcher:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 35px #00000055;
}

.launcher-logo {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 9px;
  color: white;
  background: #6348f5;
  font-size: 14px;
  font-weight: 800;
}

/* =====================================
   MAIN CHAT WINDOW
   ===================================== */

.chat-panel {
  position: fixed;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow: hidden;

  background: var(--chat-bg);
  color: var(--chat-text);
  border: 1px solid var(--chat-border);
  border-radius: 16px;

  backdrop-filter:
    blur(8px)
    brightness(1.01)
    saturate(1.2);

  -webkit-backdrop-filter:
    blur(8px)
    brightness(1.01)
    saturate(1.2);

  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);

  font-size: 12px;
}

.chat-panel.is-closed {
  display: none;
}

/* MODE 1: CENTERED
   Exact reference at 1280x585:
   760px wide, 468px high */
.chat-panel.mode-center {
  width: min(760px, calc(100vw - 32px));
  height: min(680px, 80vh);
  top: 50%;
  left: 50%;
  transform: translate(
    calc(-50% + var(--drag-x, 0px)),
    calc(-50% + var(--drag-y, 0px))
  );
}

/* MODE 2: RIGHT DOCK
   Exact reference width: 440px
   16px on top, right and bottom */
.chat-panel.mode-dock {
  width: 440px;
  max-width: calc(100vw - 32px);
  top: 16px;
  right: 16px;
  bottom: 16px;
  height: auto;
  left: auto;
  transform: none;
}

/* MODE 3: FULL SCREEN */
.chat-panel.mode-full {
  inset: 0;
  width: 100vw;
  height: 100vh;
  max-width: none;
  transform: none;
  border-radius: 0;
}

/* =====================================
   HEADER
   ===================================== */

.chat-header {
  height: 36px;
  min-height: 36px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  user-select: none;
  cursor: grab;
}

.mode-full .chat-header {
  cursor: default;
}

.chat-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 3px;
  width: 83px;
  min-width: 83px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: -0.45px;
  white-space: nowrap;
}

.brand-symbol {
  color: #6650ff;
  font-size: 18px;
  line-height: 1;
}

.ai-label {
  font-size: 10.5px;
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 1.5px;
}

.icon-button {
  width: 21px;
  height: 21px;
  padding: 0;
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--chat-muted);
  border: 1px solid transparent;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}

.icon-button:hover {
  background: var(--chat-hover);
  color: var(--chat-text);
}

.glyph {
  display: inline-grid;
  place-items: center;
}

.glyph svg,
.icon-button svg,
.add-button svg,
.send-button svg,
.theme-button svg,
.demo-open svg,
.chat-launcher svg {
  width: 12px;
  height: 12px;
}

/* =====================================
   CHAT BODY
   ===================================== */

.chat-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--chat-border) transparent;
}

.mode-full .chat-body {
  padding: 12px 16px;
}

/* =====================================
   WELCOME SCREEN
   ===================================== */

.welcome-screen {
  width: 100%;
  max-width: 288px;
  min-height: 100%;
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.welcome-logo {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  font-size: 26px;
  font-weight: 850;
  color: #755bff;
}

.welcome-screen h2 {
  margin: 12px 0 0;
  color: var(--chat-text);
  font-size: 13.5px;
  line-height: 21px;
  font-weight: 600;
}

.welcome-screen p {
  margin: 4px 0 0;
  color: var(--chat-muted);
  font-size: 10.5px;
  line-height: 15px;
}

.suggestions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 18px;
}

.suggestion-button {
  width: 100%;
  min-height: 31px;
  padding: 7px 10.5px;
  border: 1px solid var(--chat-border);
  border-radius: 12px;
  background: transparent;
  color: var(--chat-muted);
  text-align: left;
  font-size: 10.5px;
  line-height: 15px;
  transition: background 0.15s, color 0.15s;
}

.suggestion-button:hover {
  background: var(--chat-hover);
  color: var(--chat-text);
}

/* =====================================
   MESSAGES
   ===================================== */

.message-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.mode-full .message-list {
  max-width: 672px;
  margin: 0 auto;
}

.message-user {
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 7px;
}

.user-bubble {
  max-width: 85%;
  padding: 8px 10.5px;
  border-radius: 16px;
  border-bottom-right-radius: 5px;
  background: var(--chat-bubble);
  color: var(--chat-text);
  font-size: 10.5px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.user-actions {
  padding-top: 3px;
  opacity: 0;
  transition: opacity 0.15s;
}

.message-user:hover .user-actions {
  opacity: 1;
}

.message-assistant {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.assistant-avatar {
  width: 18px;
  height: 18px;
  margin-top: 3px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--chat-border);
  border-radius: 5px;
  background: var(--chat-button);
  color: #816dff;
  font-size: 10px;
  font-weight: 800;
}

.assistant-main {
  min-width: 0;
  flex: 1;
}

.assistant-text {
  color: var(--chat-text);
  font-size: 10.5px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.response-actions {
  display: flex;
  gap: 1.5px;
  margin-top: 4px;
}

.feedback-selected {
  color: #725cff;
}

.thinking {
  color: var(--chat-muted);
  font-size: 10.5px;
  padding-top: 6px;
}

.thinking::after {
  content: "";
  animation: thinking-dots 1.2s infinite;
}

@keyframes thinking-dots {
  0% { content: ""; }
  33% { content: "."; }
  66% { content: ".."; }
  100% { content: "..."; }
}

/* =====================================
   INPUT / COMPOSER
   ===================================== */

.chat-footer {
  flex-shrink: 0;
  padding: 0 9px 8px;
}

.mode-full .chat-footer {
  width: 100%;
  max-width: 672px;
  margin: 0 auto;
}

.composer {
  border: 1px solid var(--chat-border);
  background: var(--chat-input);
  border-radius: 11px;
  padding: 4px;
}

.composer:focus-within {
  border-color: #8d7aff;
}

.composer-row {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  width: 100%;
}

.add-wrap {
  position: relative;
  flex-shrink: 0;
}

.add-button {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  background: var(--chat-button);
  color: var(--chat-text);
  border: 1px solid var(--chat-border);
  border-radius: 8px;
}

.add-button:hover {
  background: var(--chat-hover);
}

#messageInput {
  flex: 1;
  min-width: 0;
  min-height: 24px;
  max-height: 110px;
  resize: none;
  overflow-y: auto;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--chat-text);
  font-size: 10.5px;
  line-height: 18px;
  padding: 3px 2px;
  scrollbar-width: thin;
}

#messageInput::placeholder {
  color: var(--chat-muted);
}

.send-button {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: var(--chat-accent);
  color: var(--chat-accent-text);
}

.send-button:hover {
  filter: brightness(1.1);
}

.message-count {
  text-align: center;
  color: var(--chat-muted);
  font-size: 11px;
  font-weight: 500;
  padding: 8px 0 0;
}

/* =====================================
   ATTACHMENT MENU
   ===================================== */

.add-menu {
  position: absolute;
  bottom: 34px;
  left: 0;
  width: 165px;
  padding: 5px;
  border: 1px solid var(--chat-border);
  background: var(--chat-bg);
  backdrop-filter: blur(10px);
  border-radius: 10px;
  box-shadow: 0 12px 30px #00000030;
  z-index: 5;
}

.add-menu button {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--chat-text);
  font-size: 11px;
  text-align: left;
}

.add-menu button:hover {
  background: var(--chat-hover);
}

.tool-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-bottom: 6px;
}

.tool-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  border: 0;
  border-radius: 6px;
  background: var(--chat-hover);
  color: var(--chat-text);
  font-size: 10px;
}

/* =====================================
   RIGHT-DOCK RESIZE HANDLE
   ===================================== */

.resize-handle {
  display: none;
  position: absolute;
  left: -3px;
  top: 0;
  bottom: 0;
  width: 8px;
  z-index: 8;
  cursor: ew-resize;
  align-items: center;
  justify-content: center;
}

.resize-handle span {
  width: 3px;
  height: 18px;
  border-radius: 6px;
  background: var(--chat-border);
}

.mode-dock .resize-handle {
  display: flex;
}

/* =====================================
   TOAST CONFIRMATION
   ===================================== */

.toast {
  position: fixed;
  left: 50%;
  bottom: 25px;
  transform: translateX(-50%);
  z-index: 10001;
  padding: 10px 15px;
  border-radius: 9px;
  color: white;
  background: #24242b;
  box-shadow: 0 10px 30px #00000040;
  font-size: 12px;
}

/* =====================================
   MOBILE
   ===================================== */

@media (max-width: 600px) {

  .demo-hero {
    left: 7%;
    right: 7%;
    top: 28%;
  }

  .chat-panel.mode-center {
    width: calc(100vw - 16px);
    height: 85vh;
  }

  .chat-panel.mode-dock {
    top: 8px;
    bottom: 8px;
    right: 8px;
    width: calc(100vw - 16px) !important;
    max-width: none;
  }

  .resize-handle {
    display: none !important;
  }

  .chat-header {
    padding: 0 9px;
  }

  .header-actions {
    gap: 0;
  }

  .brand-logo {
    width: 83px;
    min-width: 83px;
  }

  .chat-launcher {
    bottom: 16px;
    right: 16px;
  }
}
