/* The composer "+" menu, tool chips, attachment thumbnails and the image library (composer_plus.js). */
:root { --tool-chip: #8cbcff; --tool-chip-bg: #1f3b63; --tool-chip-bg-hover: #26487a; }

#btnCommands.tool-button { width: 38px; padding: 0; justify-content: center; border-radius: 50%; }
#btnCommands.tool-button > span:not([data-icon="plus"]) { display: none; }

.plus-menu { position: fixed; z-index: 80; width: min(392px, calc(100vw - 16px)); padding: 6px; border-radius: 18px;
  background: var(--surface-raised); box-shadow: 0 16px 40px #0007, 0 0 0 1px #ffffff12; animation: plus-in var(--motion-normal, .16s) ease; }
@keyframes plus-in { from { opacity: 0; transform: translateY(6px) scale(.98); } }
.plus-item { width: 100%; display: grid; grid-template-columns: 22px auto 1fr; align-items: center; gap: 12px; padding: 10px 12px;
  border-radius: 12px; color: var(--ink); text-align: left; font-size: 14px; }
.plus-item svg { width: 20px; height: 20px; color: var(--muted); }
.plus-item:hover, .plus-item:focus-visible { background: var(--surface-hover); outline: none; }
.plus-item.on svg, .plus-item.on .plus-label { color: var(--tool-chip); }
.plus-label { font-weight: 600; white-space: nowrap; }
.plus-hint { color: var(--quiet); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tool-chip { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 999px;
  background: var(--tool-chip-bg); color: var(--tool-chip); font-size: 14px; font-weight: 500; white-space: nowrap; }
.tool-chip svg { width: 17px; height: 17px; }
button.tool-chip { margin: 0 auto 0 6px; }  /* sits beside +, the right-hand controls stay right */
button.tool-chip svg:last-child { width: 0; opacity: 0; transition: width .12s ease, opacity .12s ease; }
button.tool-chip:hover, button.tool-chip:focus-visible { background: var(--tool-chip-bg-hover); outline: none; }
button.tool-chip:hover svg:last-child, button.tool-chip:focus-visible svg:last-child { width: 15px; opacity: 1; }
.user-text.has-tool { display: block; }
.user-text.has-tool .tool-chip { height: 30px; margin: 0 6px 0 0; padding: 0 11px; vertical-align: middle; font-size: 13.5px; }

.composer-tray { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 4px 10px; }
.tray-thumb { position: relative; width: 112px; height: 112px; border-radius: 14px; overflow: hidden; background: #ffffff0a; }
.tray-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tray-file { position: relative; display: inline-flex; align-items: center; gap: 8px; max-width: 240px; height: 46px; padding: 0 30px 0 12px;
  border-radius: 12px; background: #ffffff0d; color: var(--ink); font-size: 13px; }
.tray-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tray-file svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--muted); }
.uploading::after { content: ''; position: absolute; inset: 0; background: linear-gradient(100deg, #0000 20%, #ffffff1f 50%, #0000 80%) 0 0 / 200% 100%;
  animation: tray-shine 1.1s linear infinite; }
@keyframes tray-shine { to { background-position: -200% 0; } }
.tray-remove { position: absolute; top: 6px; right: 6px; z-index: 1; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%;
  background: #000a; color: #fff; opacity: 0; transition: opacity .12s ease; }
.tray-file .tray-remove { top: 12px; opacity: .7; background: transparent; color: var(--muted); }
.tray-remove svg { width: 14px; height: 14px; }
.tray-thumb:hover .tray-remove, .tray-thumb:focus-within .tray-remove, .tray-file:hover .tray-remove { opacity: 1; }
@media (hover: none) { .tray-remove { opacity: 1; } }

.message-attachments { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-bottom: 8px; }
.message-thumb { width: 180px; max-width: 60vw; aspect-ratio: 1; object-fit: cover; border-radius: 16px; }

.library-dialog { width: min(760px, calc(100vw - 32px)); max-height: min(78vh, 720px); padding: 0; border: 0; border-radius: 20px;
  background: var(--surface); color: var(--ink); box-shadow: 0 24px 60px #0009; }
.library-dialog::backdrop { background: #0009; }
.library-head { display: flex; align-items: center; gap: 12px; padding: 16px 16px 12px; }
.library-head h2 { margin: 0; font-size: 17px; }
.library-search { flex: 1; min-width: 0; height: 36px; padding: 0 12px; border-radius: 10px; border: 0; background: #ffffff0d; color: var(--ink); }
.library-close { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; color: var(--muted); }
.library-close:hover { background: var(--surface-hover); color: var(--ink); }
.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; padding: 4px 16px 18px; overflow-y: auto;
  max-height: calc(min(78vh, 720px) - 70px); }
.library-tile { aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: #ffffff0a; }
.library-tile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s ease; }
.library-tile:hover img, .library-tile:focus-visible img { transform: scale(1.04); }
.library-note { grid-column: 1 / -1; color: var(--muted); font-size: 14px; padding: 24px 0; text-align: center; }
@media (prefers-reduced-motion: reduce) { .plus-menu, .uploading::after { animation: none; } }
