/* Fase 4 — Proyectos: sidebar, vista de proyecto, modales */

/* -------------------------------------------------------------------------- */
/* Sidebar: acciones y secciones                                               */
/* -------------------------------------------------------------------------- */
.sidebar-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.new-project-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 9px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--fg-muted);
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  transition: background var(--transition), color var(--transition);
}
.new-project-btn:hover { background: var(--bg-elev); color: var(--fg); }
.new-project-btn [data-lucide] { width: 0.9rem; height: 0.9rem; }

.search-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  color: var(--fg-muted);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  transition: border-color var(--transition);
}
.search-trigger:hover { border-color: var(--accent); color: var(--fg); }
.search-trigger [data-lucide] { width: 0.9rem; height: 0.9rem; }
.search-trigger span { flex: 1; text-align: left; }
.search-trigger kbd,
.search-head kbd,
.session-row kbd {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  padding: 2px 6px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--fg-subtle);
}

.section-label {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-subtle);
  padding: 14px 8px 6px;
}

/* -------------------------------------------------------------------------- */
/* Proyectos en la sidebar                                                     */
/* -------------------------------------------------------------------------- */
.project-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-left: 2px solid transparent;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--fg);
  cursor: pointer;
  user-select: none;
  transition: background var(--transition), border-color var(--transition);
}
.project-row:hover { background: var(--bg-elev); border-left-color: var(--pastel-green); }
.project-row.active { background: var(--bg-elev); border-left-color: var(--pastel-green); }
.project-row.drag-over {
  background: var(--accent-normal-soft);
  border-left-color: var(--pastel-green);
}
.project-row .chevron {
  display: grid;
  place-items: center;
  width: 16px;
  color: var(--fg-muted);
  transition: transform 150ms;
}
.project-row.collapsed .chevron { transform: rotate(-90deg); }
.project-row .p-icon { font-size: 1rem; line-height: 1; }
.project-row .p-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.project-row .p-count {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  color: var(--fg-subtle);
}
.project-children { margin: 0 0 6px 0; }
.project-children.collapsed { display: none; }
.project-children .conv-item { padding-left: 26px; }
.project-add-chat {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 26px;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-subtle);
  background: transparent;
  width: 100%;
}
.project-add-chat:hover { color: var(--accent-normal-strong); }
.project-empty {
  padding: 4px 10px 4px 26px;
  font-size: 0.75rem;
  color: var(--fg-subtle);
}

/* -------------------------------------------------------------------------- */
/* Badge de proyecto en la topbar                                              */
/* -------------------------------------------------------------------------- */
.project-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--pastel-green);
  border-radius: var(--radius-sm);
  background: var(--accent-normal-soft);
  color: var(--accent-normal-strong);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  cursor: pointer;
  max-width: 220px;
}
.project-badge .label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.project-badge [data-lucide] { width: 0.85rem; height: 0.85rem; }

/* -------------------------------------------------------------------------- */
/* Vista de proyecto                                                           */
/* -------------------------------------------------------------------------- */
.project-view {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px 48px;
}
.project-view .pv-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 8px;
}
.project-view .pv-icon { font-size: 2rem; line-height: 1; }
.project-view h1 {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 1.5rem;
  flex: 1;
}
.project-view .pv-actions { display: flex; gap: 8px; }
.project-view .pv-desc {
  color: var(--fg-muted);
  font-size: 0.9375rem;
  margin-bottom: 24px;
  max-width: 70ch;
}
.pv-section { margin-bottom: 28px; }
.pv-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--fg-subtle);
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
  margin-bottom: 12px;
}
.pv-section-title .spacer { flex: 1; }
.pv-section-title button {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-strong);
  background: transparent;
}
.pv-section-title button:hover { text-decoration: underline; }

.pv-instructions {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  line-height: 1.6;
}
.pv-instructions:focus { outline: none; border-color: var(--accent); }
.pv-counter {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  color: var(--fg-subtle);
  margin-top: 4px;
}
.pv-counter.over { color: var(--danger); }

.pv-files { display: flex; flex-direction: column; gap: 6px; }
.pv-file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  font-size: 0.8125rem;
}
.pv-file .f-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-file .f-size { font-family: var(--font-mono); font-size: 0.6875rem; color: var(--fg-subtle); }
.pv-file .f-status { font-size: 0.6875rem; color: var(--fg-muted); }
.pv-dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 18px;
  text-align: center;
  color: var(--fg-subtle);
  font-size: 0.8125rem;
  cursor: pointer;
  margin-top: 8px;
  transition: border-color var(--transition), background var(--transition);
}
.pv-dropzone:hover,
.pv-dropzone.drag-over {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--fg);
}
.pv-conv-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 0.875rem;
}
.pv-conv-item:hover { background: var(--bg-elev); }
.pv-conv-item .c-when {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--fg-subtle);
}
.pv-empty { color: var(--fg-subtle); font-size: 0.8125rem; padding: 8px 0; }

/* -------------------------------------------------------------------------- */
/* Modal de proyecto: campos                                                   */
/* -------------------------------------------------------------------------- */
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--fg-muted);
  margin-bottom: 5px;
}
.field input[type="text"],
.field textarea,
.field .input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 0.875rem;
}
.field textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); }
.field-hint {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  color: var(--fg-subtle);
  margin-top: 3px;
}
.emoji-picker, .color-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.emoji-picker button {
  width: 34px; height: 34px;
  font-size: 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
}
.emoji-picker button.sel { border-color: var(--accent); background: var(--accent-soft); }
.color-picker button {
  width: 28px; height: 28px;
  border: 2px solid transparent;
  border-radius: 50%;
}
.color-picker button.sel { border-color: var(--fg); }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

/* -------------------------------------------------------------------------- */
/* Responsive                                                                  */
/* -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .project-view { padding: 20px 16px 40px; }
  .project-view .pv-head { flex-wrap: wrap; }
}
