/* ============================================================
   PRD STUDIO - EDITOR, MARKDOWN PREVIEW, COPILOT & TASK BOARD
   ============================================================ */

/* Step 2 View Header */
.editor-header {
  height: 56px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  flex-shrink: 0;
}

.editor-title-area {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.status-indicator {
  width: 9px;
  height: 9px;
  border-radius: var(--radius-full);
  background: var(--text-subtle);
}
.status-indicator.live {
  background: var(--primary);
  box-shadow: 0 0 8px var(--primary);
}

.doc-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  outline: none;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
}
.doc-title:focus {
  border-color: var(--border-subtle);
  background: var(--bg-surface);
}

.version-tag {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 7px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}

.editor-view-controls {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.view-modes {
  display: flex;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 2px;
}
.mode-btn {
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.mode-btn.active {
  background: var(--bg-accent);
  color: var(--text-main);
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* PRD Workspace (Split Screen Layout) */
.editor-workspace {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 360px;
  height: calc(100vh - 118px);
  overflow: hidden;
}

/* Document Column */
.document-column {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 100%;
  overflow: hidden;
  border-right: 1px solid var(--border-subtle);
  background: var(--bg-app);
}

/* View Mode variations */
.document-column.mode-preview {
  grid-template-columns: 1fr;
}
.document-column.mode-preview .raw-editor-wrap {
  display: none;
}

.document-column.mode-edit {
  grid-template-columns: 1fr;
}
.document-column.mode-edit .preview-wrap {
  display: none;
}

/* Raw Editor Wrap */
.raw-editor-wrap {
  height: 100%;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-subtle);
  background: #08080a;
}

.prd-raw-textarea {
  flex: 1;
  width: 100%;
  height: 100%;
  background: transparent;
  border: none;
  outline: none;
  padding: 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.7;
  color: #e2e8f0;
  resize: none;
}

/* Preview Wrap & Markdown Typography */
.preview-wrap {
  height: 100%;
  overflow-y: auto;
  padding: 2rem 2.5rem;
  background: var(--bg-card);
}

.markdown-body {
  max-width: 780px;
  margin: 0 auto;
  color: #e2e8f0;
  line-height: 1.75;
}

.markdown-body h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #fff;
  border-bottom: 2px solid var(--border-subtle);
  padding-bottom: 0.75rem;
  margin-bottom: 1.5rem;
}

.markdown-body h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: #fff;
  margin-top: 2rem;
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.markdown-body h2::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 18px;
  background: var(--primary);
  border-radius: 2px;
}

.markdown-body h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #cbd5e1;
  margin-top: 1.4rem;
  margin-bottom: 0.5rem;
}

.markdown-body p {
  margin-bottom: 1rem;
  color: #cbd5e1;
}

.markdown-body ul, .markdown-body ol {
  margin-bottom: 1.2rem;
  padding-left: 1.4rem;
  color: #cbd5e1;
}
.markdown-body li {
  margin-bottom: 0.35rem;
}

.markdown-body blockquote {
  border-left: 3px solid var(--primary);
  background: var(--primary-subtle);
  padding: 0.75rem 1.25rem;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin: 1.2rem 0;
  font-style: italic;
  color: #a7f3d0;
}

.markdown-body code {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  background: #1c1c24;
  padding: 2px 6px;
  border-radius: 4px;
  color: #38bdf8;
  border: 1px solid #2e2e3e;
}

.markdown-body pre {
  background: #08080c;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.2rem;
  overflow-x: auto;
  margin: 1.2rem 0;
}
.markdown-body pre code {
  background: transparent;
  padding: 0;
  border: none;
  color: #e2e8f0;
  font-size: 0.82rem;
  line-height: 1.6;
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.88rem;
}
.markdown-body th, .markdown-body td {
  border: 1px solid var(--border-subtle);
  padding: 0.65rem 0.9rem;
  text-align: left;
}
.markdown-body th {
  background: var(--bg-surface);
  color: #fff;
  font-weight: 700;
}
.markdown-body tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

/* AI Copilot Sidebar */
.copilot-sidebar {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #0e0e13;
  overflow: hidden;
}

.copilot-header {
  height: 48px;
  padding: 0 1.2rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
}
.copilot-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
}
.badge-mini {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 6px;
  background: rgba(16, 185, 129, 0.15);
  color: var(--primary);
  border-radius: var(--radius-full);
}

.copilot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 90%;
}
.chat-msg.bot {
  align-self: flex-start;
}
.chat-msg.user {
  align-self: flex-end;
}

.chat-msg .msg-bubble {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-lg);
  font-size: 0.84rem;
  line-height: 1.5;
}
.chat-msg.bot .msg-bubble {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: #cbd5e1;
  border-bottom-left-radius: 4px;
}
.chat-msg.user .msg-bubble {
  background: var(--indigo);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.quick-chips {
  padding: 0.6rem 1.2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  background: rgba(10, 10, 14, 0.8);
}
.quick-chip {
  padding: 4px 9px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.quick-chip:hover {
  background: var(--indigo-subtle);
  border-color: rgba(99, 102, 241, 0.4);
  color: #a5b4fc;
}

.copilot-input-area {
  padding: 0.85rem 1.2rem;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.copilot-input {
  flex: 1;
  height: 36px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0 0.85rem;
  font-size: 0.84rem;
  color: var(--text-main);
  outline: none;
}
.copilot-input:focus {
  border-color: var(--indigo);
}

/* ================= STEP 3: ROADMAP & TASK BREAKDOWN ================= */
.roadmap-header {
  padding: 1.8rem 2rem 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-card);
  gap: 1.5rem;
  flex-wrap: wrap;
}

.badge-phase {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--primary);
  margin-bottom: 0.2rem;
}
.roadmap-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-main);
}
.roadmap-desc {
  font-size: 0.86rem;
  color: var(--text-muted);
}

.roadmap-header-actions {
  display: flex;
  align-items: center;
  gap: 1.2rem;
}

.progress-box {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 170px;
}
.progress-bar-container {
  height: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #34d399);
  border-radius: var(--radius-full);
  transition: width 300ms ease;
}
.progress-text {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: right;
  font-family: var(--font-mono);
}

/* Checkpoint Alert Banner */
.checkpoint-banner {
  margin: 1.2rem 2rem 0;
  padding: 0.9rem 1.4rem;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: 0.85rem;
}
.checkpoint-icon {
  font-size: 1.4rem;
}
.checkpoint-info strong {
  display: block;
  font-size: 0.84rem;
  color: #fbbf24;
}
.checkpoint-info span {
  font-size: 0.82rem;
  color: #fef3c7;
}

/* Task Filters */
.task-filters {
  padding: 1rem 2rem 0.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.filter-group {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.filter-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-subtle);
  margin-right: 0.2rem;
}
.filter-pill {
  padding: 4px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.filter-pill.active {
  background: var(--primary-subtle);
  border-color: var(--primary);
  color: var(--primary);
}

/* Task Board Container */
.task-board {
  padding: 1.2rem 2rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  max-width: 1100px;
}

.phase-section {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.phase-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
}
.phase-title-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.phase-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: var(--indigo-subtle);
  color: #a5b4fc;
}
.phase-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
}

/* Task Card Item */
.task-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.4rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  transition: all var(--transition-normal);
}
.task-card:hover {
  border-color: var(--border-accent);
  box-shadow: var(--shadow-sm);
}
.task-card.completed {
  opacity: 0.65;
  background: rgba(18, 18, 23, 0.4);
}
.task-card.completed .task-title {
  text-decoration: line-through;
  color: var(--text-muted);
}

.task-checkbox {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  border: 2px solid var(--border-accent);
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  margin-top: 2px;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}
.task-card.completed .task-checkbox {
  background: var(--primary);
  border-color: var(--primary);
  color: #052e16;
}

.task-body {
  flex: 1;
}
.task-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}
.task-title {
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--text-main);
}
.task-layer-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}
.task-layer-badge.frontend {
  background: rgba(14, 165, 233, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(14, 165, 233, 0.25);
}
.task-layer-badge.backend {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.25);
}
.task-layer-badge.database {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.task-desc {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 0.6rem;
}
.task-files {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.4rem;
}
.file-tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  background: #09090d;
  border: 1px solid var(--border-subtle);
  padding: 2px 6px;
  border-radius: 4px;
  color: #93c5fd;
}

/* Agent Setup Prompt Modal Components */
.agent-tabs {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.6rem;
}
.agent-tab {
  padding: 6px 14px;
  background: transparent;
  border: none;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.agent-tab:hover {
  color: var(--text-main);
  background: var(--bg-surface);
}
.agent-tab.active {
  background: var(--primary-subtle);
  color: var(--primary);
  font-weight: 700;
}

.prompt-box-area {
  background: #060608;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.2rem;
  max-height: 380px;
  overflow-y: auto;
}
.agent-prompt-pre {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.65;
  color: #cbd5e1;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Template Cards in Modal */
.template-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}
.template-card-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.1rem;
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
}
.template-card-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--primary);
  transform: translateY(-1px);
}
.tpl-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}
.tpl-title {
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--text-main);
}
.tpl-tag {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 6px;
  background: var(--primary-subtle);
  color: var(--primary);
  border-radius: 4px;
}
.tpl-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 0.75rem;
  flex: 1;
}
.tpl-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.tpl-stack-item {
  font-size: 0.7rem;
  padding: 2px 6px;
  background: #1e1e28;
  border-radius: 4px;
  color: #9494a8;
}

@media (max-width: 900px) {
  .editor-workspace {
    grid-template-columns: 1fr;
    height: auto;
  }
  .copilot-sidebar {
    height: 380px;
    border-top: 1px solid var(--border-subtle);
  }
  .template-grid {
    grid-template-columns: 1fr;
  }
}
