/* ============================================================
   Intelligence Panel — Floating Chat Widget
   ============================================================ */

/* FAB button — bottom right */
.intel-widget {
  position: fixed;
  bottom: 60px; /* above footer */
  right: 24px;
  z-index: 200;
}

.intel-fab {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--amber);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
}

.intel-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
}

.fab-icon {
  font-size: 20px;
  line-height: 1;
}

.fab-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: #fff;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* Drawer — opens upward from FAB */
.intel-drawer {
  display: none;
  position: absolute;
  bottom: 60px;
  right: 0;
  width: 360px;
  height: 500px;
  min-width: 280px;
  min-height: 200px;
  max-width: 90vw;
  max-height: 85vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  flex-direction: column;
  overflow: hidden;
}

.intel-drawer.open {
  display: flex;
}

/* Resize handles */
.resize-handle-left {
  position: absolute;
  left: -3px;
  top: 12px;
  bottom: 12px;
  width: 6px;
  cursor: ew-resize;
  z-index: 10;
}

.resize-handle-top {
  position: absolute;
  top: -3px;
  left: 12px;
  right: 12px;
  height: 6px;
  cursor: ns-resize;
  z-index: 10;
}

.resize-handle-corner {
  position: absolute;
  top: -4px;
  left: -4px;
  width: 12px;
  height: 12px;
  cursor: nwse-resize;
  z-index: 11;
}

.resize-handle-left:hover,
.resize-handle-top:hover,
.resize-handle-corner:hover {
  background: rgba(168, 146, 15, 0.3);
  border-radius: 3px;
}

.intel-drawer.resizing {
  user-select: none;
  transition: none;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.drawer-title {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--amber);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.drawer-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.15s;
}

.drawer-close:hover {
  color: var(--text);
}

.drawer-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
}

/* Panel sections */
.panel-section {
  margin-bottom: 16px;
}

.panel-section h3 {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 8px;
  font-weight: 500;
}

/* Observation card */
.obs-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 8px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.obs-card.highlighted {
  border-color: var(--amber);
  box-shadow: 0 0 12px rgba(168, 146, 15, 0.2);
}

.obs-type {
  font-family: var(--mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--amber);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.obs-text {
  font-family: var(--serif);
  font-size: 0.82rem;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 6px;
}

.obs-confidence {
  display: inline-block;
  font-family: var(--mono);
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.obs-confidence.high { background: rgba(74, 222, 128, 0.12); color: #4ade80; }
.obs-confidence.medium { background: rgba(251, 191, 36, 0.12); color: #fbbf24; }
.obs-confidence.low { background: var(--surface-2); color: var(--muted); }

/* Assumptions toggle */
.assumptions-toggle {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  cursor: pointer;
  margin-top: 6px;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 3px;
  transition: color 0.15s;
}

.assumptions-toggle:hover { color: var(--text); }

.assumptions-arrow {
  font-size: 8px;
  transition: transform 0.2s;
}

.assumptions-toggle.open .assumptions-arrow {
  transform: rotate(90deg);
}

.assumptions-list {
  display: none;
  padding: 4px 0 0 8px;
  border-left: 1px solid var(--border);
  margin-top: 4px;
}

.assumptions-toggle.open + .assumptions-list { display: block; }

.assumption-item {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  padding: 2px 0;
  cursor: pointer;
  transition: color 0.15s;
}

.assumption-item:hover { color: var(--text); }

.assumption-entry { color: var(--muted); }
.assumption-role {
  font-family: var(--serif);
  font-size: 0.78rem;
  color: var(--text);
}

/* Suggestion item */
.suggestion-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  margin-bottom: 6px;
  font-family: var(--serif);
  font-size: 0.8rem;
  color: var(--text);
  line-height: 1.5;
}

.suggestion-icon {
  color: var(--amber);
  margin-right: 4px;
}

/* Still relevant */
.still-relevant-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  margin-bottom: 6px;
}

.still-relevant-status {
  font-family: var(--mono);
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 3px;
  margin-bottom: 3px;
  display: inline-block;
  letter-spacing: 0.04em;
}

.still-relevant-status.confirmed { background: rgba(74, 222, 128, 0.12); color: #4ade80; }
.still-relevant-status.revised { background: rgba(251, 191, 36, 0.12); color: #fbbf24; }
.still-relevant-status.unchanged { background: var(--surface-2); color: var(--muted); }

.still-relevant-text {
  font-family: var(--serif);
  font-size: 0.78rem;
  color: var(--text);
  line-height: 1.4;
}

.still-relevant-date {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
  margin-top: 3px;
}

/* Show more button */
.obs-show-more {
  display: block;
  width: 100%;
  padding: 8px;
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--muted);
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.obs-show-more:hover {
  color: var(--text);
  border-color: var(--muted);
}

/* Signal items (bridge mode) */
.signal-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  margin-bottom: 6px;
  transition: border-color 0.15s;
}
.signal-item:hover { border-color: var(--muted); }

.signal-header {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.04em;
  margin-bottom: 3px;
}

.signal-connection {
  font-family: var(--serif);
  font-size: 0.78rem;
  color: var(--amber);
  line-height: 1.4;
}

.signal-uncovered-note {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  font-style: italic;
}

.signal-item.uncovered {
  border-style: dashed;
  opacity: 0.7;
}

/* Deep analysis link */
.panel-deep {
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  margin-top: 8px;
}

.deep-link {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--amber);
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: opacity 0.15s;
}
.deep-link:hover { opacity: 0.7; }

.deep-date {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  margin-top: 4px;
}

/* Empty state */
.panel-empty {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  padding: 8px 0;
  letter-spacing: 0.03em;
}

/* Tablet */
@media (max-width: 900px) {
  .intel-drawer {
    width: min(360px, calc(100vw - 48px));
  }
}

/* Mobile */
@media (max-width: 600px) {
  .intel-widget { right: 16px; bottom: 56px; }
  .intel-drawer {
    width: calc(100vw - 32px);
    max-height: 60vh;
  }
}
