/* =========================================================================
   Didáctico — Empresas colaboradoras (plugin WordPress)
   Estilos autocontenidos: todo bajo .dce con tokens locales y prefijo dce-
   para no interferir con el tema. Hereda la tipografía del sitio.
   ========================================================================= */
.dce {
  --navy-900: #0f2750;
  --navy: #15356b;
  --navy-600: #1b4080;
  --blue: #245abb;
  --accent-600: #e0af00;
  --ink: #1b2336;
  --muted: #5a6478;
  --soft: #8b95c9;
  --soft-2: #858a97;
  --line: #e7e9f0;
  --surface: #ffffff;
  --surface-2: #f5f6f9;
  --r: 12px;
  --r-lg: 16px;
  --r-pill: 999px;
  --sh-sm: 0 6px 16px -8px rgba(15, 39, 80, .25);
  --sh: 0 16px 40px -28px rgba(15, 39, 80, .32);
  --ease: cubic-bezier(.22, .61, .36, 1);

  color: var(--ink);
  font-family: inherit;
  line-height: 1.5;
}
.dce *, .dce *::before, .dce *::after { box-sizing: border-box; }

.dce-intro {
  margin: 0 0 22px;
  font-size: 16px;
  line-height: 1.6;
  color: var(--muted);
  max-width: 760px;
}

/* Barra superior: buscador + recuento */
.dce-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 18px;
}

/* Buscador */
.dce-search { position: relative; flex: 1; min-width: 240px; max-width: 440px; }
.dce-search__icon {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--soft); pointer-events: none;
}
.dce-search__input {
  width: 100%; font: inherit; font-size: 15px; color: var(--ink);
  background: #fff; border: 1.5px solid var(--line); border-radius: var(--r-pill);
  padding: 13px 18px 13px 46px; margin: 0;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.dce-search__input::placeholder { color: var(--soft-2); }
.dce-search__input:hover { border-color: var(--soft); }
.dce-search__input:focus {
  outline: none; border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(36, 90, 187, .15);
}
.dce-count { font-size: 14px; color: var(--muted); white-space: nowrap; margin: 0; }
.dce-count strong { color: var(--navy); font-weight: 700; }

/* Filtro por ciclo */
.dce-filters {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin: 0 0 clamp(22px, 3.5vw, 32px);
}
.dce-filter {
  display: inline-flex; align-items: center; gap: 9px;
  font: inherit; font-size: 14px; font-weight: 600;
  color: var(--muted); background: var(--surface);
  border: 1.5px solid var(--line); padding: 10px 18px;
  border-radius: var(--r-pill); cursor: pointer;
  transition: background .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}
.dce-filter:hover { transform: translateY(-2px); border-color: var(--soft); }
.dce-filter.is-active {
  background: var(--c, var(--navy)); border-color: var(--c, var(--navy)); color: #fff;
}
.dce-filter__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--soft)); flex-shrink: 0; }
.dce-filter.is-active .dce-filter__dot { background: #fff; }
.dce-filter__count {
  font-size: 12px; font-weight: 700; color: var(--soft);
  background: var(--surface-2); border-radius: var(--r-pill); padding: 1px 8px;
}
.dce-filter.is-active .dce-filter__count { background: rgba(255, 255, 255, .2); color: #fff; }

/* Listado agrupado por ciclo */
.dce-list { display: flex; flex-direction: column; gap: clamp(30px, 4.5vw, 46px); }
.dce-group.is-hidden { display: none; }

/* Fila separadora: tipo (eyebrow) + nombre de ciclo, teñida con el color del ciclo */
.dce-group__head {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 18px; padding: 14px 18px;
  border-radius: var(--r-lg);
  background: var(--surface-2);
  background: color-mix(in srgb, var(--c, var(--navy)) 8%, var(--surface));
  border: 1px solid var(--line);
  border: 1px solid color-mix(in srgb, var(--c, var(--navy)) 22%, transparent);
  border-left: 5px solid var(--c, var(--navy));
}
.dce-group__icon {
  width: 44px; height: 44px; border-radius: var(--r); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--c, var(--navy)); color: #fff;
}
.dce-group__icon svg { width: 23px; height: 23px; }
.dce-group__titles { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.dce-group__tipo {
  font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
  color: var(--navy);
  color: color-mix(in srgb, var(--c, var(--navy)) 75%, var(--ink));
}
.dce-group__ciclo {
  margin: 0; padding: 0;
  font-size: clamp(16px, 2.1vw, 20px); font-weight: 800; line-height: 1.2;
  color: var(--navy); text-transform: uppercase;
}
.dce-group__count {
  flex-shrink: 0; font-size: 13px; font-weight: 800; color: #fff;
  background: var(--c, var(--navy)); border-radius: var(--r-pill);
  min-width: 30px; padding: 3px 11px; text-align: center;
}

/* Rejilla de empresas */
.dce-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.dce-card {
  display: flex; align-items: flex-start; gap: 15px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 16px 18px; box-shadow: var(--sh-sm);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease);
}
.dce-card:hover { transform: translateY(-3px); box-shadow: var(--sh); border-color: transparent; }
.dce-card.is-hidden { display: none; }
.dce-card__icon {
  width: 46px; height: 46px; border-radius: var(--r); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: #eef1fb;
  background: color-mix(in srgb, var(--c, var(--navy)) 12%, #fff);
  color: var(--c, var(--navy));
}
.dce-card__icon svg { width: 23px; height: 23px; }
.dce-card__body { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.dce-card__name { margin: 0; padding: 0; font-size: 15px; font-weight: 700; color: var(--ink); line-height: 1.3; text-transform: uppercase; }
.dce-card__cif { font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: .02em; }

/* Estados vacío / error */
.dce-empty {
  margin-top: 24px; text-align: center; font-size: 15px; color: var(--muted);
  background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r);
  padding: 30px;
}
.dce-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; text-align: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: clamp(32px, 5vw, 52px);
}
.dce-state svg { width: 44px; height: 44px; color: var(--muted); }
.dce-state--error svg { color: var(--accent-600); }
.dce-state h2 { margin: 0; color: var(--navy); }
.dce-state p { margin: 6px 0 0; font-size: 15px; line-height: 1.6; color: var(--muted); max-width: 460px; }
.dce-state__debug { font-size: 13px; color: var(--soft-2); word-break: break-word; }

@media (max-width: 900px) {
  .dce-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .dce-grid { grid-template-columns: 1fr; }
  .dce-toolbar { flex-direction: column; align-items: stretch; }
  .dce-search { max-width: none; }
  .dce-group__head { gap: 12px; padding: 12px 14px; }
  .dce-group__icon { width: 38px; height: 38px; }
  .dce-group__icon svg { width: 20px; height: 20px; }
}
