/* Página de licitaciones públicas (pages/licitaciones.html).
   Mismos colores y letras que el gestor de presupuestos: fondo oscuro y naranja.
   Lo que la distingue es la "regla" de cada licitación: una barra con marcas
   que muestra a simple vista lo grande que es la obra (escala logarítmica,
   de 10.000 € a 10 millones). */

@font-face { font-family: 'Barlow Condensed'; src: url('../fonts/barlow-condensed-800-latin.woff2') format('woff2'); font-weight: 800; font-display: swap; }
@font-face { font-family: 'IBM Plex Sans'; src: url('../fonts/ibm-plex-sans-400-latin.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'IBM Plex Sans'; src: url('../fonts/ibm-plex-sans-600-latin.woff2') format('woff2'); font-weight: 600; font-display: swap; }

:root {
  --orange: #ff6b00;
  --orange2: #ff8c38;
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --surface2: #242424;
  --border: #2e2e2e;
  --text: #e8e8e8;
  --muted: #8f8f8f;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

a { color: var(--orange2); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

/* Barra superior */
.barra {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 32px; height: 64px;
  border-bottom: 2px solid var(--orange);
  background: rgba(15, 15, 15, 0.96);
  position: sticky; top: 0; z-index: 10;
}
.barra-logo { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.barra-logo img { height: 38px; border-radius: 4px; }
.barra-logo span {
  font-family: 'Barlow Condensed', sans-serif; font-weight: 800;
  font-size: 1.6rem; color: var(--orange); letter-spacing: 2px;
}
.barra-volver { font-size: .88rem; font-weight: 600; color: var(--muted); text-decoration: none; }
.barra-volver:hover { color: var(--orange); }
.barra-enlaces { display: flex; align-items: center; gap: 22px; }
.barra-inicio { color: var(--text); }

/* Contenido */
.lic { max-width: 980px; margin: 0 auto; padding: 56px 28px 72px; }

.lic-cabecera h1 {
  font-family: 'Barlow Condensed', sans-serif; font-weight: 800;
  font-size: clamp(2.6rem, 7vw, 4.4rem); line-height: .95;
  letter-spacing: .5px;
  border-left: 6px solid var(--orange); padding-left: 18px;
}
.lic-intro { max-width: 62ch; margin: 20px 0 0 24px; color: #c4c4c4; font-size: 1.02rem; }
.lic-pasos { max-width: 62ch; margin: 12px 0 0 24px; padding-left: 1.4em; color: #c4c4c4; }
.lic-pasos li { margin: 6px 0; padding-left: 4px; }
.lic-pasos li::marker { color: var(--orange); font-family: 'Barlow Condensed', sans-serif; font-weight: 800; }
.lic-pasos strong { color: var(--text); }
.lic-intro-nota { margin-top: 12px; font-size: .92rem; color: var(--muted); }
.lic-resumen { margin: 14px 0 0 24px; color: var(--muted); font-size: .95rem; }
.lic-resumen strong { color: var(--text); font-weight: 600; }

.lic-acciones { display: flex; flex-wrap: wrap; gap: 12px; margin: 26px 0 0 24px; }
.boton {
  display: inline-block; padding: 10px 16px; border-radius: 4px;
  border: 1px solid var(--border); background: var(--surface2);
  color: var(--text); text-decoration: none; font-size: .92rem; font-weight: 600;
}
.boton:hover { border-color: var(--orange); }
.boton-principal { background: var(--orange); border-color: var(--orange); color: #111; }
.boton-principal:hover { background: var(--orange2); border-color: var(--orange2); }

/* Filtros */
.lic-filtros {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px 20px;
  margin: 44px 0 8px; padding: 18px 20px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
}
.campo { display: flex; flex-direction: column; gap: 6px; font-size: .85rem; color: var(--muted); }
.campo-buscar { flex: 1 1 260px; }
.campo input, .campo select {
  font: inherit; font-size: .95rem; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: 4px;
  padding: 9px 12px;
}
.campo input:focus, .campo select:focus { border-color: var(--orange); }
.campo-check { display: flex; align-items: center; gap: 8px; font-size: .92rem; padding-bottom: 9px; cursor: pointer; }
.campo-check input { accent-color: var(--orange); width: 18px; height: 18px; }

/* Lista */
.lic-lista { list-style: none; }
.lic-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 8px 36px;
  padding: 26px 0;
  border-bottom: 1px solid var(--border);
}
.lic-item.cerca { border-left: 4px solid var(--orange); padding-left: 18px; margin-left: -22px; }

.lic-titulo { font-size: 1.08rem; font-weight: 600; line-height: 1.4; }
.lic-titulo a { color: var(--text); text-decoration: none; }
.lic-titulo a:hover { color: var(--orange2); text-decoration: underline; }
.lic-organismo { margin-top: 6px; color: #b4b4b4; font-size: .93rem; }
.lic-datos { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 6px; color: var(--muted); font-size: .85rem; }
.lic-etiqueta {
  display: inline-block; margin-bottom: 6px; padding: 1px 8px; border-radius: 3px;
  background: var(--orange); color: #111; font-size: .78rem; font-weight: 600;
}
.lic-descargas { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.lic-descargas a {
  font-size: .82rem; font-weight: 600; text-decoration: none; color: var(--text);
  padding: 4px 10px; border: 1px solid var(--border); border-radius: 3px; background: var(--surface);
}
.lic-descargas a:hover { border-color: var(--orange); color: var(--orange2); }

/* Importe y regla */
.lic-importe { text-align: right; }
.lic-importe-cifra {
  font-family: 'Barlow Condensed', sans-serif; font-weight: 800;
  font-size: 2.3rem; line-height: 1; letter-spacing: .5px;
  font-variant-numeric: tabular-nums;
}
.lic-importe-cifra small { font-size: 1.3rem; color: var(--muted); margin-left: 3px; }
.lic-importe-texto { color: var(--muted); font-size: .8rem; margin-top: 4px; }

.regla {
  position: relative; height: 14px; margin-top: 12px;
  background: var(--surface2);
  border-radius: 2px;
  overflow: hidden;
}
/* marcas de cada orden de magnitud: 10 mil, 100 mil, 1 millón, 10 millones */
.regla::after {
  content: ''; position: absolute; inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 calc(100% / 3 - 1px), #555 calc(100% / 3 - 1px) calc(100% / 3));
  pointer-events: none;
}
.regla-relleno {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: repeating-linear-gradient(90deg, var(--orange) 0 6px, var(--orange2) 6px 7px);
  width: 0;
  transition: width .7s cubic-bezier(.2, .7, .2, 1);
}
.regla-escala { display: flex; justify-content: space-between; margin-top: 3px; font-size: .68rem; color: #666; }

.lic-vacio { padding: 40px 0; color: #c4c4c4; }
.lic-nota { margin-top: 36px; max-width: 70ch; font-size: .85rem; color: var(--muted); }

/* Pie */
.pie {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px;
  padding: 28px 32px; border-top: 1px solid var(--border);
  background: #0a0a0a; color: var(--muted); font-size: .82rem;
}
.pie-enlaces { display: flex; flex-wrap: wrap; gap: 18px; }
.pie a { color: var(--muted); }
.pie a:hover { color: var(--orange); }

@media (max-width: 720px) {
  .barra { padding: 0 16px; }
  .barra-volver { font-size: .8rem; text-align: right; }
  .barra-logo span { display: none; }
  .lic { padding: 36px 18px 56px; }
  .lic-intro, .lic-pasos, .lic-resumen, .lic-acciones { margin-left: 0; }
  .lic-item { grid-template-columns: 1fr; }
  .lic-item.cerca { margin-left: -14px; padding-left: 10px; }
  .lic-importe { text-align: left; order: -1; }
  .pie { padding: 24px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .regla-relleno { transition: none; }
}

/* Botón «Ver en presupuestos» (abre la licitación en el gestor) */
.lic-descargas a.lic-ver { color: #111; background: var(--orange); border-color: var(--orange); }
.lic-descargas a.lic-ver:hover { color: #111; background: var(--orange2); border-color: var(--orange2); }
