/* ============================================================
   playground.css — Live Playground (Oatmeal & Ink theme)
   ============================================================ */

/* ---------- Section 1: URL Input Bar ---------- */

.url-input-section {
  padding: 3rem 0 1.5rem;
  text-align: center;
}

.url-input-section h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 0.35rem;
}

.url-input-section .subtitle {
  color: var(--text-secondary);
  font-size: 1.05rem;
  margin-bottom: 1.5rem;
}

.url-input-row {
  display: flex;
  gap: 0.5rem;
  max-width: 700px;
  margin: 0 auto;
}

.url-input-row input {
  flex: 1;
  padding: 0.85rem 1.2rem;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  font-size: 1rem;
  background: #fff;
  font-family: 'Inter', sans-serif;
  color: var(--text-primary);
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.url-input-row input:focus {
  border-color: var(--accent-ember);
  outline: none;
  box-shadow: 0 0 0 3px rgba(232, 97, 26, 0.1);
}

.url-input-row button {
  background: var(--accent-ember);
  color: #fff;
  border: none;
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  white-space: nowrap;
  font-family: 'Inter', sans-serif;
  transition: background var(--transition-normal);
}

.url-input-row button:hover {
  background: var(--accent-deep);
}

.url-input-row button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- Progress Bar ---------- */

.progress-section {
  margin-top: 1.5rem;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.progress-bar-track {
  height: 6px;
  background: var(--bg-secondary);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-ember), #FF7A33);
  border-radius: 3px;
  width: 0%;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

/* ---------- Stats Bar ---------- */

.stats-bar {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.stat-item {
  text-align: center;
}

.stat-value {
  display: block;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent-ember);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ---------- Section 2: Workspace ---------- */

.workspace {
  padding: 0 1rem;
}

.workspace-grid {
  display: grid;
  grid-template-columns: 250px 1fr 300px;
  gap: 1rem;
  height: calc(100vh - 350px);
  min-height: 400px;
}

/* Shared panel chrome */
.file-browser,
.detail-panel,
.graph-panel {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-soft);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.panel-header {
  padding: 0.75rem 1rem;
  font-weight: 600;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-secondary);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ---------- File Browser ---------- */

.file-tree {
  overflow-y: auto;
  padding: 0.5rem;
  flex: 1;
}

.file-item {
  padding: 0.4rem 0.6rem;
  padding-left: calc(0.6rem + var(--depth, 0) * 1rem);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.82rem;
  font-family: 'JetBrains Mono', monospace;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-secondary);
  transition: background var(--transition-normal);
}

.file-item:hover {
  background: var(--bg-secondary);
}

.file-item--active {
  background: rgba(232, 97, 26, 0.08);
  color: var(--accent-ember);
}

.file-item--dir {
  font-weight: 600;
  color: var(--text-primary);
}

/* ---------- Graph Panel ---------- */

.graph-container {
  flex: 1;
  position: relative;
}

.graph-container svg {
  width: 100%;
  height: 100%;
  display: block;
}

.graph-controls {
  display: flex;
  gap: 0.25rem;
}

.ctrl-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border-soft);
  background: #fff;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  transition: background var(--transition-normal);
}

.ctrl-btn:hover {
  background: var(--bg-secondary);
}

/* Empty states */
.empty-state {
  color: var(--text-secondary);
  font-size: 0.9rem;
  text-align: center;
  padding: 2rem;
}

.graph-empty {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  width: max-content;
  max-width: 90%;
}

/* ---------- Graph node colours (applied via JS / D3) ---------- */
/* Kept here as documentation for the data-driven palette */

.node-file   { fill: #E8611A; }
.node-function { fill: #00b894; }
.node-class  { fill: #6c5ce7; }
.node-import { fill: #fdcb6e; }

.graph-edge {
  stroke: rgba(44, 37, 32, 0.15);
  stroke-width: 1;
}

.graph-node:hover {
  stroke: #E8611A;
  stroke-width: 2;
}

/* ---------- Node Detail Panel ---------- */

.node-detail {
  padding: 1rem;
  overflow-y: auto;
  flex: 1;
}

.detail-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  word-break: break-all;
  color: var(--text-primary);
}

.detail-type {
  display: inline-block;
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.detail-type--function { background: rgba(0, 184, 148, 0.12); color: #00b894; }
.detail-type--class    { background: rgba(108, 92, 231, 0.12); color: #6c5ce7; }
.detail-type--file     { background: rgba(232, 97, 26, 0.12);  color: var(--accent-ember); }
.detail-type--import   { background: rgba(253, 203, 110, 0.2); color: #e17055; }

.detail-section {
  margin-top: 0.75rem;
}

.detail-section h4 {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
  letter-spacing: 0.04em;
}

.detail-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  background: var(--bg-secondary);
  padding: 0.5rem;
  border-radius: 6px;
  overflow-x: auto;
  white-space: pre;
  color: var(--text-primary);
}

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

.detail-list li {
  padding: 0.2rem 0;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

/* ---------- Section 3: Chat ---------- */

.chat-section {
  padding: 1.5rem 1rem;
}

.chat-panel {
  max-width: 900px;
  margin: 0 auto;
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-soft);
  overflow: hidden;
}

.chat-messages {
  height: 200px;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chat-message {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
}

.chat-message--user {
  flex-direction: row-reverse;
}

.chat-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  background: var(--bg-secondary);
  flex-shrink: 0;
}

.chat-message--user .chat-avatar {
  background: rgba(232, 97, 26, 0.12);
}

.chat-bubble {
  padding: 0.6rem 0.9rem;
  border-radius: 12px;
  font-size: 0.88rem;
  line-height: 1.5;
  max-width: 75%;
}

.chat-message--bot .chat-bubble {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.chat-message--user .chat-bubble {
  background: var(--accent-ember);
  color: #fff;
}

.chat-input-row {
  display: flex;
  border-top: 1px solid var(--border-soft);
  padding: 0.5rem;
}

.chat-input-row input {
  flex: 1;
  border: none;
  padding: 0.7rem 1rem;
  font-size: 0.9rem;
  outline: none;
  font-family: 'Inter', sans-serif;
  color: var(--text-primary);
  background: transparent;
}

.chat-input-row input:disabled {
  opacity: 0.5;
}

.chat-input-row button {
  background: var(--accent-ember);
  color: #fff;
  border: none;
  padding: 0.7rem 1.2rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius-md);
  font-family: 'Inter', sans-serif;
  transition: background var(--transition-normal);
}

.chat-input-row button:hover {
  background: var(--accent-deep);
}

.chat-input-row button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ---------- Responsive ---------- */

@media (max-width: 1024px) {
  .workspace-grid {
    grid-template-columns: 200px 1fr;
  }

  .detail-panel {
    display: none;
  }
}

@media (max-width: 768px) {
  .workspace-grid {
    grid-template-columns: 1fr;
    height: auto;
  }

  .file-browser {
    max-height: 200px;
  }

  .graph-panel {
    min-height: 350px;
  }

  .url-input-row {
    flex-direction: column;
  }

  .url-input-row input,
  .url-input-row button {
    width: 100%;
  }

  .stats-bar {
    gap: 1rem;
  }

  .chat-messages {
    height: 160px;
  }
}
