/* SOGpt image input for SOG Agent
   The paperclip in the composer row, the tray of staged thumbnails above it, the
   drop state on the panel, and the pictures as they appear in the thread. */

/* -- composer row ------------------------------------------------------- */

/* styles.css sizes the row as three columns. Each injected control adds one, so
   the combinations are declared here rather than left to wrap onto a new line. */
.agent-composer > .sog-attach-row {
  grid-template-columns: 30px 30px minmax(0, 1fr) 30px;
}

.agent-composer > .sog-attach-row.sog-voice-row {
  grid-template-columns: 30px 30px minmax(0, 1fr) 30px 30px;
}

.sog-attach-button {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--hairline);
  border-radius: var(--r-1);
  background: var(--surface-2);
  color: var(--text-3);
  cursor: pointer;
  transition: color var(--motion-fast) var(--ease),
              border-color var(--motion-fast) var(--ease),
              background var(--motion-fast) var(--ease);
}

.sog-attach-button svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.82;
  stroke-linecap: butt;
  stroke-linejoin: miter;
}

.sog-attach-button:hover:not(:disabled) {
  border-color: var(--hairline-strong);
  color: var(--text-1);
}

.sog-attach-button:focus-visible {
  outline: 2px solid var(--gold-ring);
  outline-offset: 2px;
}

.sog-attach-button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

/* -- staged thumbnails -------------------------------------------------- */

.sog-attach-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 8px 8px 0;
}

.sog-attach-item {
  position: relative;
  width: 54px;
  height: 54px;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--hairline);
  border-radius: var(--r-1);
  background: var(--surface-3);
}

.sog-attach-item img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.sog-attach-item.uploading img {
  opacity: .4;
}

.sog-attach-progress {
  position: absolute;
  inset: 0;
  display: none;
  border: 2px solid transparent;
  border-top-color: var(--gold);
  border-radius: 50%;
  margin: auto;
  width: 18px;
  height: 18px;
  animation: sog-attach-spin 1.1s linear infinite;
}

.sog-attach-item.uploading .sog-attach-progress {
  display: block;
}

@keyframes sog-attach-spin {
  to { transform: rotate(360deg); }
}

.sog-attach-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, .62);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

.sog-attach-remove:hover {
  background: rgba(0, 0, 0, .82);
}

.sog-attach-remove:focus-visible {
  outline: 2px solid var(--gold-ring);
  outline-offset: 1px;
}

/* -- drop target -------------------------------------------------------- */

.agent-panel.sog-attach-dropping {
  position: relative;
}

.agent-panel.sog-attach-dropping::after {
  content: "Drop an image to ask about it";
  position: absolute;
  inset: 8px;
  z-index: 60;
  display: grid;
  place-items: center;
  border: 1px dashed var(--gold);
  border-radius: var(--r-3);
  background: var(--gold-soft);
  color: var(--text-1);
  font-size: var(--fs-2);
  pointer-events: none;
}

/* -- in the thread ------------------------------------------------------ */

.agent-message-images {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 6px;
}

.agent-message-images img {
  max-width: 132px;
  max-height: 132px;
  display: block;
  border: 1px solid var(--hairline);
  border-radius: var(--r-1);
  object-fit: cover;
}

@media (prefers-reduced-motion: reduce) {
  .sog-attach-button,
  .sog-attach-progress {
    transition: none;
    animation: none;
  }
}
