/* Paneles colapsables del agente (thinking + tool calls) — sistema 4d3 */

.agent-panel {
  margin: 0.5rem 0;
  border: 1px solid var(--border);
  border-left: 3px solid var(--pastel-blue);
  border-radius: 0;
  background: var(--bg-sunken);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  overflow: hidden;
}

.agent-panel.collapsed .agent-panel-body {
  display: none;
}

.agent-panel-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.8rem;
  border: none;
  background: transparent;
  font: inherit;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-align: left;
  cursor: pointer;
  color: var(--fg);
}

.agent-panel-header:hover {
  background: var(--bg-elev);
}

.agent-panel-header .caret {
  display: inline-block;
  width: 1em;
  text-align: center;
}

.agent-panel-header .label {
  flex: 1;
}

.agent-panel-header .duration {
  color: var(--fg-subtle);
  font-size: 0.9em;
}

.agent-panel-body {
  padding: 0.6rem 0.8rem;
  max-height: 220px;
  overflow: auto;
  font-family: var(--font-sans);
  white-space: pre-wrap;
  word-break: break-word;
  border-top: 1px solid var(--border);
}

/* -------------------------------------------------------------------------- */
/* Thinking                                                                    */
/* -------------------------------------------------------------------------- */
.thinking-panel { border-left-color: var(--pastel-green); }
.thinking-panel .thinking-text {
  color: var(--fg-muted);
  font-style: italic;
}

.thinking-cursor {
  display: inline-block;
  margin-left: 2px;
  width: 6px;
  height: 6px;
  background: var(--pastel-green);
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  animation: blink 1s steps(1, end) infinite;
  vertical-align: middle;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* -------------------------------------------------------------------------- */
/* Tool call                                                                   */
/* -------------------------------------------------------------------------- */
.tool-call-panel { border-left-color: var(--pastel-coral); }

.tool-call-panel .tc-status {
  display: inline-block;
  width: 1.2em;
  text-align: center;
}

.tool-call-panel.running .tc-status {
  animation: spin 1.4s linear infinite;
  display: inline-block;
}

.tool-call-panel.ok .tc-status,
.tool-call-panel .tc-status.ok {
  color: var(--accent-normal-strong);
}

.tool-call-panel.error .tc-status,
.tool-call-panel .tc-status.err {
  color: var(--danger);
}

.tool-call-panel .tc-args {
  background: var(--bg-elev);
  border-left: 2px solid var(--border-strong);
  border-radius: 0;
  padding: 0.5rem 0.6rem;
  margin: 0 0 0.5rem 0;
  font-family: var(--font-mono);
  font-size: 0.78125rem;
  max-height: 140px;
  overflow: auto;
}

.tool-call-panel .tc-summary {
  font-weight: 500;
}

.tool-call-panel .tc-error {
  color: var(--danger);
  font-weight: 500;
}

/* -------------------------------------------------------------------------- */
/* Citas inline                                                                */
/* -------------------------------------------------------------------------- */
sup.cite {
  font-size: 0.7em;
  margin: 0 1px;
}

sup.cite a {
  text-decoration: none;
  color: var(--accent-strong);
  padding: 0 3px;
  border-radius: 0;
  border-bottom: 1px solid var(--accent);
  transition: background var(--transition);
}

sup.cite a:hover {
  background: var(--accent-soft);
}

.cite-popover {
  position: fixed;
  z-index: 1000;
  max-width: 340px;
  padding: 0.75rem 0.9rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0;
  box-shadow: var(--shadow-md);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  line-height: 1.45;
}

.cite-popover .title {
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.cite-popover .url {
  font-family: var(--font-mono);
  color: var(--fg-muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.4rem;
  word-break: break-all;
}

.cite-popover .snippet {
  color: var(--fg);
}

.bibliografia {
  margin-top: 1rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-sans);
  font-size: 0.875rem;
}

.bibliografia ol {
  margin: 0.4rem 0 0 1.2rem;
  padding: 0;
}

.bibliografia li {
  margin: 0.3rem 0;
}

.bibliografia a {
  color: var(--accent-strong);
  text-decoration: none;
}

.bibliografia a:hover {
  text-decoration: underline;
}

/* -------------------------------------------------------------------------- */
/* Drag & drop overlay                                                         */
/* -------------------------------------------------------------------------- */
.drop-zone-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.drop-zone-overlay[hidden] { display: none; }

.drop-zone-box {
  background: var(--bg-elev);
  border: 2px dashed var(--accent);
  border-radius: 0;
  padding: 2.2rem 2.6rem;
  text-align: center;
  font-family: var(--font-sans);
  font-size: 1rem;
}

.drop-zone-box .icon {
  width: 40px;
  height: 40px;
  margin: 0 auto 0.6rem;
  background: linear-gradient(
    135deg,
    var(--pastel-green) 0%,
    var(--pastel-blue) 50%,
    var(--pastel-coral) 100%
  );
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}

.drop-zone-box .hint {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--fg-muted);
  margin-top: 0.5rem;
}

/* -------------------------------------------------------------------------- */
/* Chips de attachment en el composer                                          */
/* -------------------------------------------------------------------------- */
.attachments-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 10px 4px;
}

.att-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px 4px 10px;
  max-width: 320px;
  min-width: 0;
  border: 1px solid var(--border);
  border-left: 2px solid var(--pastel-blue);
  border-radius: 0;
  background: var(--bg-elev);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  line-height: 1.2;
}

.att-chip .icon {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  color: var(--pastel-blue);
}
.att-chip .icon [data-lucide] { width: 14px; height: 14px; }

.att-chip .name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1 1 auto;
}

.att-chip .size {
  font-family: var(--font-mono);
  color: var(--fg-muted);
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex: 0 0 auto;
}

.att-chip .status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}
.att-chip .status [data-lucide] { width: 12px; height: 12px; }
.att-chip .status.ready { color: var(--accent-normal-strong); }
.att-chip .status.error { color: var(--danger); }
.att-chip .status.pending,
.att-chip .status.processing {
  color: var(--fg-muted);
  animation: spin 1.4s linear infinite;
}

.att-chip .remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
  flex: 0 0 auto;
  transition: background var(--transition), color var(--transition);
}
.att-chip .remove [data-lucide] { width: 12px; height: 12px; }
.att-chip .remove:hover {
  background: var(--bg-sunken);
  color: var(--danger);
}
