/* ── + / attach / camera buttons ─────────────────────────────────────────── */

/* Floating UI tooltip element — positioned by JS, viewport-aware */
#tooltip {
  position: fixed;
  background: oklch(var(--b3));
  color: oklch(var(--bc) / 90%);
  font-size: 0.75rem;
  line-height: 1.4;
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 9999;
  box-shadow: var(--shadow-tooltip);
  opacity: 0;
  transition: opacity 0.15s;
}

#tooltip.visible {
  opacity: 1;
}

.footer-icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid oklch(var(--bc) / 15%);
  background: oklch(var(--b1));
  color: oklch(var(--bc) / 60%);
  font-size: 1rem;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: opacity 0.15s;
}

.footer-icon-btn:active { opacity: 0.7; }

#plus-btn {
  transition: transform 0.2s ease, opacity 0.15s;
}

#plus-btn.expanded {
  transform: rotate(45deg);
}

.footer-expand-btn {
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  border-width: 0;
  margin-left: -0.5rem;
  transition: max-width 0.2s ease, opacity 0.15s ease, border-width 0.2s ease, margin-left 0.2s ease;
}

.footer-expand-btn.visible {
  max-width: 52px;
  opacity: 1;
  border-width: 1px;
  margin-left: 0;
}

/* ── Quote pill ───────────────────────────────────────────────────────────── */

#quote-pill {
  position: fixed;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  background: oklch(var(--p));
  color: oklch(var(--pc));
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 999px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  z-index: 800;
  user-select: none;
  -webkit-user-select: none;
  transition: opacity 0.12s, transform 0.12s;
  white-space: nowrap;
}

#quote-pill svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

#quote-pill.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
}

/* ── Quote chips (Phase C) ────────────────────────────────────────────────── */

#quote-blocks:empty {
  display: none;
}

#quote-blocks {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.quote-chip {
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid oklch(var(--bc) / 10%);
  animation: quote-chip-in 0.15s ease;
}

@keyframes quote-chip-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.quote-chip.removing {
  animation: quote-chip-out 0.15s ease forwards;
}

@keyframes quote-chip-out {
  to { opacity: 0; transform: translateY(-4px); max-height: 0; overflow: hidden; }
}

.quote-chip-header {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.5rem 0.2rem;
  font-size: 0.75rem;
  color: oklch(var(--bc) / 50%);
}

.quote-chip-role {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex: 1;
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.quote-chip-role svg {
  width: 13px;
  height: 13px;
}

.quote-chip[data-role="assistant"] .quote-chip-role {
  color: oklch(var(--p) / 80%);
}

.quote-chip[data-role="user"] .quote-chip-role {
  color: oklch(var(--s) / 80%);
}

.quote-chip-delete {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  background: none;
  color: oklch(var(--bc) / 40%);
  cursor: pointer;
  border-radius: 4px;
  flex-shrink: 0;
  transition: color 0.1s, background 0.1s;
}

.quote-chip-delete:hover {
  color: oklch(var(--bc) / 80%);
  background: oklch(var(--bc) / 8%);
}

.quote-chip-delete svg {
  width: 13px;
  height: 13px;
}

.quote-chip-body {
  padding: 0 0.75rem 0.4rem;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  /* Colored left border by role */
  border-left: 2.5px solid oklch(var(--bc) / 15%);
  margin-left: 0.5rem;
  font-size: 0.85rem;
  line-height: 1.5;
}

.quote-chip[data-role="assistant"] .quote-chip-body {
  border-left-color: oklch(var(--p) / 40%);
}

.quote-chip[data-role="user"] .quote-chip-body {
  border-left-color: oklch(var(--s) / 40%);
}

.quote-chip-body.collapsed {
  max-height: 5.5rem;
}

.quote-chip-body.collapsed:not(.no-overflow)::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2.5rem;
  background: linear-gradient(to bottom, transparent, oklch(var(--b1)));
  pointer-events: none;
}

.quote-chip-body:not(.collapsed) {
  max-height: 60dvh;
  overflow-y: auto;
}

/* Suppress normal margins inside chip body to keep it compact */
.quote-chip-body p { margin: 0 0 0.3em; }
.quote-chip-body p:last-child { margin-bottom: 0; }
.quote-chip-body pre { margin: 0.2em 0; }
.quote-chip-body table { font-size: 0.8em; }

.quote-response {
  width: 100%;
  min-height: 36px;
  max-height: 120px;
  padding: 0.35rem 0.75rem;
  background: transparent;
  border: none;
  border-top: 1px solid oklch(var(--bc) / 8%);
  border-radius: 0;
  color: oklch(var(--bc));
  font-size: 0.9rem;
  font-family: inherit;
  resize: none;
  outline: none;
  line-height: 1.5;
  overflow-y: auto;
  box-sizing: border-box;
}

.quote-response::placeholder {
  color: oklch(var(--bc) / 35%);
}

/* ── Image attachments in chat history ────────────────────────────────────── */

.msg-attachment-img {
  display: block;
  max-width: 240px;
  max-height: 240px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  border: 1px solid oklch(var(--b3));
  margin-top: 6px;
}

/* ── Attachment preview ───────────────────────────────────────────────────── */

.attach-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.attach-preview:empty {
  display: none;
}

.attach-thumb {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  overflow: visible;
}

.attach-thumb img {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid oklch(var(--b3));
}

.attach-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: oklch(var(--n));
  border: none;
  color: oklch(var(--nc));
  font-size: 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}

/* ── Text file attachment pill (input preview) ───────────────────────────── */

.attach-doc-pill {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 52px;
  padding: 0 28px 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid oklch(var(--b3));
  background: oklch(var(--b2));
  max-width: 160px;
  overflow: visible;
}

.attach-doc-name {
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.attach-doc-size {
  font-size: 0.7rem;
  color: oklch(var(--bc) / 55%);
  white-space: nowrap;
  flex-shrink: 0;
}

.attach-doc-badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: oklch(var(--p));
  flex-shrink: 0;
}
