/* ============================================================
   BLOCKS.CSS — Estils visuals dels blocs Scratch
   ============================================================
   Renderitza blocs d'estil Scratch 3 sense dependències externes.
   Les variables CSS --sb-bg i --sb-shadow s'injecten per JS.
   ============================================================ */

/* ---- Contenidor d'un script (grup de blocs) ---- */
.sb-script {
  display: inline-flex;
  flex-direction: column;
  gap: 1px;
  padding: 10px 12px;
  background: #d9dde8;
  border-radius: 8px;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: clamp(12px, 1vw, 16px);
  font-weight: 700;
  user-select: none;
  line-height: 1;
}

/* ---- Bloc base ---- */
.sb-block {
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 4px;
  padding: 5px 10px;
  background-color: var(--sb-bg, #888);
  color: #fff;
  border-radius: 3px;
  min-height: 28px;
  position: relative;
  white-space: nowrap;
  box-shadow: 0 2px 0 var(--sb-shadow, rgba(0,0,0,0.3));
}

/* ---- Connector superior (tab que encaixa al de dalt) ---- */
.sb-command::before,
.sb-c-cap::before {
  content: '';
  position: absolute;
  top: -7px;
  left: 12px;
  width: 20px;
  height: 7px;
  background-color: var(--sb-bg, #888);
  border-radius: 3px 3px 0 0;
  filter: brightness(0.8);
}

/* ---- Bloc hat (inici d'event) ---- */
.sb-hat {
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  padding-top: 8px;
  padding-bottom: 7px;
}

/* ---- Cos interior del bloc C (bucle/condicional) ---- */
.sb-c-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-left: 22px;
  padding: 2px 0 2px 6px;
  border-left: 5px solid var(--sb-accent, #888);
  min-height: 22px;
}
.sb-c-empty {
  height: 16px;
}

/* ---- Tapa inferior del bloc C ---- */
.sb-c-cap {
  height: 14px;
  min-height: 14px;
  padding: 0 10px;
  border-bottom-left-radius: 3px;
  border-bottom-right-radius: 3px;
}

/* ============================================================
   ENTRADES
   ============================================================ */

/* Entrada numèrica: oval blanca */
.sb-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: white;
  color: #333;
  border-radius: 100px;
  padding: 1px 7px;
  min-width: 22px;
  font-size: 11px;
  font-weight: 700;
}

/* Entrada de text: rectangle arrodonit blanc */
.sb-str {
  display: inline-flex;
  align-items: center;
  background: white;
  color: #333;
  border-radius: 2px;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 700;
}

/* Desplegable: oval semi-transparent */
.sb-drop {
  display: inline-flex;
  align-items: center;
  background: rgba(255,255,255,0.42);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 100px;
  padding: 1px 7px;
  font-size: 11px;
  gap: 2px;
  color: rgba(0,0,0,0.75);
}

/* Entrada booleana: forma hexagonal */
.sb-bool {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(0,0,0,0.15);
  padding: 3px 10px;
  clip-path: polygon(8px 0%, calc(100% - 8px) 0%, 100% 50%, calc(100% - 8px) 100%, 8px 100%, 0% 50%);
  font-size: 11px;
  white-space: nowrap;
}

/* ============================================================
   REPORTER (valor inline, sense script contenidor)
   Usat en targetes de bloc individual
   ============================================================ */
.sb-reporter {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background-color: var(--sb-bg, #888);
  color: white;
  border-radius: 100px;
  padding: 4px 10px;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 2px 0 var(--sb-shadow, rgba(0,0,0,0.3));
}

/* ============================================================
   PALETA DE BLOCS (referència visual a la secció d'interfície)
   ============================================================ */
.cat-palette {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin: 12px 0;
}
.cat-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px;
  border-radius: 100px;
  color: white;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 12px; font-weight: 700;
  box-shadow: 0 2px 0 rgba(0,0,0,0.2);
}
