/* === View dropdown (Table / List picker) === */

.view-dropdown {
  position: relative;
  display: inline-block;
}

.view-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.view-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 240px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.10), 0 2px 6px rgba(0,0,0,0.04);
  padding: 6px;
  z-index: 200;
  animation: vdMenuIn 0.12s ease-out;
}
@keyframes vdMenuIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.view-dropdown-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 8px 10px 6px;
}

.view-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  background: transparent;
  border-radius: 7px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  color: var(--text-1);
  transition: background 0.1s;
}
.view-dropdown-item:hover { background: var(--surface-2); }
.view-dropdown-item.active { background: var(--surface-2); }
.view-dropdown-item .icon { color: var(--text-2); flex-shrink: 0; }

.vdi-stack { flex: 1; min-width: 0; }
.vdi-label { font-size: 13px; font-weight: 500; line-height: 1.3; }
.vdi-desc  { font-size: 11px; color: var(--text-3); margin-top: 1px; line-height: 1.3; }

/* === TroveAI: trigger button + side panel === */

.troveai-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px 6px 8px;
  background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 100%);
  border: 1px solid #BFDBFE;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: #1D4ED8;
  transition: all 0.15s;
}
.troveai-trigger:hover {
  background: linear-gradient(135deg, #DBEAFE 0%, #BFDBFE 100%);
  border-color: #93C5FD;
  transform: translateY(-1px);
}
.troveai-trigger.active {
  background: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
  border-color: transparent;
  color: white;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}
.troveai-logo {
  width: 22px;
  height: 22px;
  position: relative;
  flex-shrink: 0;
}
.troveai-logo svg { width: 100%; height: 100%; display: block; }
.troveai-logo .ta-core { animation: taPulse 2.4s ease-in-out infinite; transform-origin: 50% 50%; }
.troveai-logo .ta-star { animation: taTwinkle 2.4s ease-in-out infinite; transform-origin: center; }
.troveai-logo .ta-star-1 { animation-delay: 0s; }
.troveai-logo .ta-star-2 { animation-delay: 0.6s; }
.troveai-logo .ta-star-3 { animation-delay: 1.2s; }
@keyframes taPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.06); }
}
@keyframes taTwinkle {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50%      { opacity: 1;   transform: scale(1.15); }
}

/* Panel — absolute within its .app variant container so it works in
   multi-variant design canvas as well as single-app mode. The .app element
   uses height:100% and is the offsetParent. */
.troveai-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: 400px;
  height: 100%;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 32px rgba(0,0,0,0.06);
  z-index: 300;
  display: flex;
  flex-direction: column;
  animation: taPanelIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes taPanelIn {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

.ta-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.ta-panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'DM Sans', -apple-system, sans-serif;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-1);
}
.ta-panel-title .troveai-logo { width: 24px; height: 24px; }
.ta-panel-actions { display: flex; align-items: center; gap: 4px; }
.ta-icon-btn {
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-3);
  transition: background 0.1s;
}
.ta-icon-btn:hover { background: var(--surface-2); color: var(--text-2); }

.ta-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Context strip */
.ta-context {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-2);
}
.ta-context-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #10B981;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
}
.ta-context strong { color: var(--text-1); font-weight: 600; }

/* Suggestion chips */
.ta-suggestions { display: flex; flex-direction: column; gap: 6px; }
.ta-suggestions-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0 2px 2px;
}
.ta-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  color: var(--text-2);
  transition: all 0.15s;
}
.ta-chip:hover {
  border-color: #ECBFA0;
  background: #FFFAF6;
  color: var(--text-1);
}
.ta-chip .icon { color: #D97757; flex-shrink: 0; }

/* Chat bubbles */
.ta-bubbles { display: flex; flex-direction: column; gap: 14px; }
.ta-bubble-wrap { display: flex; flex-direction: column; max-width: 88%; }
.ta-bubble-wrap.user { align-self: flex-end; align-items: flex-end; }
.ta-bubble-wrap.ai { align-self: flex-start; align-items: flex-start; }
.ta-bubble-author {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  margin-bottom: 4px;
  padding: 0 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.ta-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-1);
}
.ta-bubble-wrap.user .ta-bubble {
  background: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
  color: white;
  border-top-right-radius: 4px;
}
.ta-bubble-wrap.ai .ta-bubble {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-top-left-radius: 4px;
}

/* Source citations within AI bubble */
.ta-sources {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}
.ta-source {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 11px;
  color: var(--text-2);
  text-decoration: none;
  transition: background 0.1s;
}
.ta-source:hover { background: var(--surface); color: var(--text-1); }
.ta-source-num {
  width: 16px; height: 16px;
  font-size: 9px;
  font-weight: 600;
  color: #D97757;
  background: rgba(217, 119, 87, 0.12);
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ta-source-title {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ta-source-domain {
  color: var(--text-4);
  font-size: 10px;
  flex-shrink: 0;
}

/* Composer */
.ta-composer {
  flex-shrink: 0;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.ta-composer-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--surface-4);
  border-radius: 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.ta-composer-box:focus-within {
  border-color: #D97757;
  box-shadow: 0 0 0 3px rgba(217, 119, 87, 0.12);
}
.ta-input {
  width: 100%;
  border: none;
  background: transparent;
  outline: none;
  resize: none;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-1);
  min-height: 20px;
  max-height: 120px;
}
.ta-input::placeholder { color: var(--text-4); }
.ta-composer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.ta-composer-tools { display: flex; align-items: center; gap: 2px; }
.ta-composer-tools .ta-icon-btn { width: 26px; height: 26px; }
.ta-composer-tools .ta-icon-btn .icon { width: 14px; height: 14px; }
.ta-send-btn {
  width: 30px;
  height: 30px;
  border: none;
  background: linear-gradient(135deg, #D97757 0%, #C95F3D 100%);
  color: white;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.1s;
}
.ta-send-btn:hover { transform: translateY(-1px); }
.ta-composer-hint {
  font-size: 10px;
  color: var(--text-4);
  text-align: center;
  margin-top: 8px;
}
.ta-composer-hint kbd {
  padding: 1px 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 9px;
  font-family: ui-monospace, monospace;
  color: var(--text-3);
}

/* When panel is open, the .app container needs position:relative for absolute child */
.app { position: relative; }

/* Optional: pad content area so it doesn't sit underneath panel */
body.has-troveai .content-area {
  padding-right: 400px;
}

/* Processing steps (Claude-style tool-call indicators) */
.ta-processing {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
  padding: 8px 10px;
  background: rgba(37, 99, 235, 0.04);
  border-left: 2px solid rgba(37, 99, 235, 0.3);
  border-radius: 4px;
}
.ta-processing-step {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-2);
}
.ta-processing-step .icon {
  width: 12px;
  height: 12px;
  color: #2563EB;
  stroke-width: 2.5;
  flex-shrink: 0;
}

/* Attachment card (Claude-style downloadable file output) */
.ta-attachment {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.ta-attachment:hover {
  background: var(--surface-3);
  border-color: var(--surface-4);
}
.ta-attachment-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(220, 38, 38, 0.08);
  color: #DC2626;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ta-attachment-icon .icon { width: 18px; height: 18px; }
.ta-attachment-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.ta-attachment-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.005em;
}
.ta-attachment-sub {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
}
.ta-attachment-action {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s;
}
.ta-attachment:hover .ta-attachment-action {
  background: var(--surface-2);
  color: var(--text-1);
}
