/* ============================================================
   PROJECTS.CSS — Projectes guiats de robòtica
   ============================================================ */

/* ── Ítem del sidebar ─────────────────────────────────────── */
.proj-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  min-height: var(--touch-min, 52px);
  color: var(--sidebar-text);
  font-size: var(--font-nav, 15px);
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
  user-select: none; -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.proj-nav-item:hover  { background: rgba(255,255,255,0.05); color: #cbd5e1; }
.proj-nav-item.active {
  background: rgba(255,255,255,0.1); color: #fff;
  border-left-color: var(--proj-color, #9966FF);
}
.proj-nav-dot   { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.proj-nav-icon  { font-size: 1rem; flex-shrink: 0; }
.proj-nav-title { flex: 1; }

/* Separador dalt de l'acordió Projectes */
.sidebar-group-btn--proj {
  border-top: 1px solid rgba(255,255,255,0.06);
}

/* ── Contenidor arrel ────────────────────────────────────── */
#projects-root { max-width: 860px; }
#projects-root[hidden] { display: none; }

/* ── Vista principal del projecte ────────────────────────── */
.proj-view {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── Capçalera del projecte ──────────────────────────────── */
.proj-top-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  border-top: 4px solid var(--proj-color);
}
.proj-title-row {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap; margin-bottom: 10px;
}
.proj-icon     { font-size: 1.8rem; flex-shrink: 0; }
.proj-title    { font-size: 1.25rem; font-weight: 700; flex: 1; min-width: 0; }
.proj-category {
  font-size: 0.72rem; font-weight: 700; color: #fff;
  background: var(--proj-color);
  padding: 3px 10px; border-radius: 100px;
  white-space: nowrap;
}
.proj-intro { font-size: 0.88rem; color: var(--text-2); line-height: 1.7; }

/* ── Etiquetes de secció ─────────────────────────────────── */
.proj-section-label {
  font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-3);
  padding: 0 2px;
}

/* ── Targetes de robots ──────────────────────────────────── */
.proj-robots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.proj-robot-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  border-top: 4px solid var(--robot-color);
  cursor: pointer;
  display: flex; flex-direction: column; gap: 10px;
  transition: box-shadow .18s, transform .18s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.proj-robot-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.proj-robot-card:active,
.proj-robot-card.tocat { transform: scale(0.98); box-shadow: var(--shadow-sm); }

.proj-robot-card-head {
  display: flex; align-items: flex-start; gap: 10px;
}
.proj-robot-icon { font-size: 1.6rem; flex-shrink: 0; }
.proj-robot-info { flex: 1; min-width: 0; }
.proj-robot-title    { font-weight: 700; font-size: 1rem; color: var(--text-1); }
.proj-robot-subtitle { font-size: 0.78rem; color: var(--text-2); }
.proj-robot-diff  {
  font-size: 0.7rem; white-space: nowrap;
  color: var(--text-3); flex-shrink: 0; align-self: flex-start;
}

.proj-robot-intro {
  font-size: 0.83rem; color: var(--text-2); line-height: 1.6;
  flex: 1;
}

.proj-robot-progress {
  display: flex; align-items: center; gap: 8px;
}
.proj-robot-progress-bar {
  flex: 1; height: 5px; background: var(--border);
  border-radius: 5px; overflow: hidden;
}
.proj-robot-progress-fill {
  height: 100%; border-radius: 5px;
  transition: width .4s ease;
}
.proj-robot-progress-label {
  font-size: 0.72rem; color: var(--text-3); white-space: nowrap; flex-shrink: 0;
}

.proj-robot-btn {
  align-self: flex-end;
  padding: 8px 18px;
  border-radius: 6px;
  background: var(--robot-color);
  color: #fff;
  font-size: 0.85rem; font-weight: 600;
  border: none; cursor: pointer;
  transition: filter .15s;
  min-height: 40px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.proj-robot-btn:hover { filter: brightness(1.1); }

/* ── Recursos descarregables ─────────────────────────────── */
.proj-resources-panel {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
@media (max-width: 640px) {
  .proj-resources-panel { grid-template-columns: 1fr; }
}

.proj-resources-subtitle {
  font-size: 0.78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-3);
  margin-bottom: 12px;
}

.proj-resource-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.proj-resource-item:last-child { border-bottom: none; }

.proj-resource-info { flex: 1; min-width: 0; }
.proj-resource-name {
  font-size: 0.85rem; font-weight: 600; color: var(--text-1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.proj-resource-desc {
  font-size: 0.75rem; color: var(--text-3); line-height: 1.4;
}

.proj-resource-btn {
  flex-shrink: 0;
  padding: 7px 12px;
  min-height: 40px;
  border-radius: 6px;
  background: var(--body-bg);
  border: 1px solid var(--border);
  font-size: 0.78rem; font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  transition: background .15s, color .15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  white-space: nowrap;
}
.proj-resource-btn:hover { background: #e2e8f0; color: var(--text-1); }

/* ── Fila de navegació superior a la vista de passos ─────── */
.proj-step-nav-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.proj-step-breadcrumb {
  font-size: 0.8rem; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── Dark mode ───────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  .proj-resource-btn { background: #0f172a; }
  .proj-resource-btn:hover { background: #1e293b; color: #f1f5f9; }
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 600px) {
  .proj-robots-grid { grid-template-columns: 1fr; }
  .proj-top-card    { padding: 16px; }
  .proj-title       { font-size: 1.05rem; }
  .proj-resources-panel { padding: 14px; }
}
