/* Study Studio Interactive Mindmap + Honest Chart Drawer (Phase 5) */
.smm-launch-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.smm-launch-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--sk-line-strong, rgba(148, 163, 184, 0.28));
  background: var(--sk-surface, var(--bg-secondary));
  color: var(--sk-ink, var(--text-primary));
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.16s ease, background-color 0.16s ease, color 0.16s ease;
}

.smm-launch-btn svg {
  width: 15px;
  height: 15px;
  color: var(--sk-ink-2, var(--text-secondary));
  flex-shrink: 0;
}

.smm-launch-btn:hover {
  border-color: var(--sk-accent, #2563eb);
  color: var(--sk-accent, #2563eb);
  background: var(--sk-accent-soft, rgba(37, 99, 235, 0.06));
}

.smm-launch-btn:hover svg {
  color: var(--sk-accent, #2563eb);
}

.smm-launch-btn.secondary {
  border-color: var(--sk-line-strong, rgba(148, 163, 184, 0.28));
  background: var(--sk-surface, var(--bg-secondary));
}

body.light-mode .smm-launch-btn,
body:not(.dark-mode):not(.galaxy-mode) .smm-launch-btn {
  color: var(--sk-ink, #111318);
  background: var(--sk-surface, #ffffff);
}

/* Fullscreen Interactive Modal Shell */
.smm-overlay {
  position: fixed;
  inset: 0;
  z-index: 12000;
  background: rgba(6, 8, 18, 0.72);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.smm-overlay[hidden] {
  display: none !important;
}

.smm-modal {
  width: min(1320px, 100%);
  height: min(860px, calc(100vh - 32px));
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: var(--bg-secondary, #0f1320);
  color: var(--text-primary, #f1f5f9);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

body.light-mode .smm-modal,
body:not(.dark-mode):not(.galaxy-mode) .smm-modal {
  background: #ffffff;
  color: #0f172a;
  border-color: rgba(15, 23, 42, 0.14);
}

.smm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  flex-wrap: wrap;
}

.smm-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.smm-title {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.smm-tabs {
  display: inline-flex;
  gap: 6px;
  background: rgba(148, 163, 184, 0.12);
  padding: 4px;
  border-radius: 10px;
}

.smm-tab {
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 7px;
  cursor: pointer;
  opacity: 0.78;
}

.smm-tab.active {
  background: #6366f1;
  color: #ffffff;
  opacity: 1;
}

.smm-close {
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: transparent;
  color: inherit;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 1.1rem;
  cursor: pointer;
}

.smm-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 280px 1fr 340px;
  overflow: hidden;
}

.smm-body.chart-mode {
  grid-template-columns: 1fr 1fr;
}

.smm-col {
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 14px;
  border-right: 1px solid rgba(148, 163, 184, 0.16);
}

.smm-col:last-child {
  border-right: 0;
}

.smm-section-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.68;
  margin: 0 0 8px;
}

.smm-input,
.smm-textarea,
.smm-select {
  width: 100%;
  box-sizing: border-box;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(148, 163, 184, 0.08);
  color: inherit;
  padding: 9px 11px;
  font-size: 0.86rem;
  font-family: inherit;
}

.smm-textarea {
  min-height: 110px;
  resize: vertical;
  line-height: 1.45;
}

.smm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid rgba(148, 163, 184, 0.26);
  background: rgba(148, 163, 184, 0.12);
  color: inherit;
  padding: 8px 12px;
  border-radius: 9px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.smm-btn.primary {
  border-color: transparent;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #ffffff;
}

.smm-btn.emerald {
  border-color: transparent;
  background: linear-gradient(135deg, #059669, #10b981);
  color: #ffffff;
}

.smm-btn.sm {
  padding: 5px 9px;
  font-size: 0.76rem;
}

.smm-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.smm-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.smm-saved-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.smm-saved-item {
  text-align: left;
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(148, 163, 184, 0.06);
  color: inherit;
  border-radius: 10px;
  padding: 9px 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.smm-saved-item.active {
  border-color: #6366f1;
  background: rgba(99, 102, 241, 0.14);
}

.smm-saved-item b {
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.smm-saved-item small {
  font-size: 0.74rem;
  opacity: 0.7;
}

/* Interactive Mindmap Tree */
.smm-canvas-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}

.smm-meta-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.smm-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.73rem;
  font-weight: 600;
  background: rgba(99, 102, 241, 0.16);
  color: #a5b4fc;
}

body.light-mode .smm-badge,
body:not(.dark-mode):not(.galaxy-mode) .smm-badge {
  color: #4338ca;
  background: rgba(99, 102, 241, 0.12);
}

.smm-tree {
  list-style: none;
  margin: 0;
  padding: 0;
}

.smm-tree ul {
  list-style: none;
  margin: 4px 0 4px 18px;
  padding-left: 12px;
  border-left: 2px solid rgba(99, 102, 241, 0.28);
}

.smm-node-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border-radius: 9px;
  border: 1px solid transparent;
  margin-bottom: 4px;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease;
}

.smm-node-row:hover {
  background: rgba(99, 102, 241, 0.1);
}

.smm-node-row.selected {
  background: rgba(99, 102, 241, 0.18);
  border-color: rgba(99, 102, 241, 0.55);
}

.smm-toggle {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 0;
  background: rgba(148, 163, 184, 0.18);
  color: inherit;
  font-size: 0.72rem;
  cursor: pointer;
  flex-shrink: 0;
}

.smm-node-label {
  flex: 1;
  font-size: 0.88rem;
  font-weight: 500;
  word-break: break-word;
}

.smm-node-row.depth-0 .smm-node-label {
  font-weight: 700;
  font-size: 0.96rem;
}

.smm-node-cite-dot {
  font-size: 0.7rem;
  opacity: 0.72;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.16);
}

/* Inspector + Mira Deep-Ask Panel */
.smm-card {
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(148, 163, 184, 0.06);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
}

.smm-excerpt {
  font-size: 0.81rem;
  line-height: 1.5;
  opacity: 0.88;
  background: rgba(15, 23, 42, 0.22);
  padding: 9px 10px;
  border-radius: 8px;
  border-left: 3px solid #10b981;
  margin-top: 6px;
  white-space: pre-wrap;
  word-break: break-word;
}

body.light-mode .smm-excerpt,
body:not(.dark-mode):not(.galaxy-mode) .smm-excerpt {
  background: rgba(15, 23, 42, 0.05);
}

.smm-mira-answer {
  margin-top: 10px;
  font-size: 0.84rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 10px;
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.26);
}

.smm-honest-empty {
  border: 1px dashed rgba(245, 158, 11, 0.55);
  background: rgba(245, 158, 11, 0.1);
  border-radius: 12px;
  padding: 16px;
  line-height: 1.55;
  font-size: 0.88rem;
}

.smm-status {
  font-size: 0.8rem;
  min-height: 18px;
  margin-top: 6px;
  opacity: 0.85;
}

@media (max-width: 980px) {
  .smm-body,
  .smm-body.chart-mode {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }
  .smm-col {
    border-right: 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
    overflow-y: visible;
  }
}
