/* =====================================================
   ARCHIVO GENERAL SAN JUAN — buscador.css
   Estilos exclusivos de la pantalla de resultados (buscador.html).
   Requiere shared.css cargado antes.
   ===================================================== */

/* ─── Results page wrapper ───────────────────────────────────────────── */
.pg-results {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ─── Results bar (sticky) ───────────────────────────────────────────── */
.results-bar {
  background: var(--csurf);
  border-bottom: 1px solid var(--cbrd);
  position: sticky;
  top: var(--header-h, 55px);
  z-index: 100;
}

.results-bar-inner {
  width: 100%;
  max-width: 1108px;
  margin: 0 auto;
  padding: 12px 24px 0;
}

.results-bar-top {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

/* Compact pill override for results bar */
.search-pill.compact {
  flex: 1;
  max-width: 580px;
  transition: opacity 0.2s, background 0.2s;
}

.search-pill.compact.disabled {
  opacity: 0.5;
  pointer-events: none;
  background: var(--csurf);
}

.search-pill.compact input {
  font-size: 15px;
  padding: 10px 0;
}

/* ─── Tab strip ──────────────────────────────────────────────────────── */
.tab-strip {
  display: flex;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.tab-strip::-webkit-scrollbar { display: none; }

.tab-item {
  padding: 10px 16px;
  font-family: var(--fu);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ct2);
  border: none;
  background: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
  min-height: 44px;
}

.tab-item:hover { color: var(--ct); }

.tab-item.active {
  color: var(--cp-dk);
  border-bottom-color: var(--cp-dk);
  font-weight: 700;
}

/* Tab strip + filter button en la misma fila */
.tab-filter-row {
  display: flex;
  align-items: center;
}

.tab-filter-row .tab-strip {
  flex: 1;
  min-width: 0;
}

/* ─── Responsive label spans ─────────────────────────────────────────── */
.seg-label-short,
.tab-label-short { display: inline; }

.seg-label-full,
.tab-label-full  { display: none; }

@media (min-width: 540px) {
  .seg-label-short,
  .tab-label-short { display: none; }

  .seg-label-full,
  .tab-label-full  { display: inline; }
}

/* ─── Active filter chips (below tabs) ───────────────────────────────── */
.active-chips {
  display: none;
}

.active-chips:not(:empty) {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 0 10px;
  overflow-x: auto;
  scrollbar-width: none;
}

.active-chips::-webkit-scrollbar { display: none; }

.filter-badge {
  background: var(--cp-btn, oklch(55% 0.19 40));
  color: var(--cton);
  font-size: 9px;
  font-weight: 700;
  border-radius: 9999px;
  min-width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  line-height: 1;
  flex-shrink: 0;
}

.chip-active {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px 5px 11px;
  background: oklch(from var(--cp) l c h / 0.09);
  border: 1.5px solid oklch(from var(--cp) l c h / 0.5);
  border-radius: 9999px;
  font-family: var(--fu);
  font-size: 12px;
  font-weight: 600;
  color: var(--cp-act);
  white-space: nowrap;
  flex-shrink: 0;
}

.chip-rm {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--cp-act);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1px;
  border-radius: 50%;
  opacity: 0.7;
  transition: opacity 0.12s, background 0.12s;
  min-width: 32px;
  min-height: 32px;
  margin: -5px -2px;
}

.chip-rm:hover {
  opacity: 1;
  background: oklch(from var(--cp) l c h / 0.15);
}

.chip-rm svg {
  width: 11px;
  height: 11px;
}

/* ─── Context chips (results bar, segunda fila) ───────────────────────── */
.context-chip-label {
  font-family: var(--fu);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ct3);
}

.context-chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 10px 14px 10px 16px;
  border-radius: 9999px;
  border: 1.5px solid var(--cbrd2);
  background: var(--csurf);
  color: var(--cp-dk);
  font-family: var(--fu);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  white-space: nowrap;
  min-height: 44px;
}

.context-chip-btn:hover {
  border-color: var(--cp);
  background: oklch(from var(--cp) l c h / 0.04);
}

.context-chip-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.results-context-chips {
  display: none;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 4px 0 8px;
}

.results-context-chips.visible { display: flex; }

/* ─── Sidebar top offset (results bar más alta que solo header) ───────── */
/* Excepción al top de shared.css: acá hay 75px más de cosas fijas arriba
   (el buscador compacto y la fila de pestañas de .results-bar). */
.results-sidebar { top: calc(var(--header-h, 55px) + 75px); }

/* ─── Empty state ────────────────────────────────────────────────────── */
.empty-state {
  padding: 0 0 24px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
}

.empty-icon {
  color: var(--cbrd2);
  margin-bottom: 20px;
}

.empty-icon svg {
  width: 52px;
  height: 52px;
}

.empty-title {
  font-family: var(--fu);
  font-size: 20px;
  font-weight: 600;
  color: var(--ct);
  margin-bottom: 8px;
}

.empty-title span {
  color: var(--ct3);
  font-weight: 400;
}

.empty-body {
  font-family: var(--fb);
  font-size: 16px;
  color: var(--ct2);
  line-height: 1.7;
  max-width: 54ch;
  margin-bottom: 24px;
}

.empty-tips {
  list-style: none;
  font-family: var(--fb);
  font-size: 16px;
  color: var(--ct2);
  line-height: 1.7;
  padding: 0;
  margin: 0 0 28px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.empty-tips li::before {
  content: '—';
  margin-right: 8px;
  color: var(--ct3);
}

.empty-divider {
  width: 100%;
  max-width: 420px;
  height: 1px;
  background: var(--cbrd);
  margin-bottom: 20px;
}

.empty-cta-label {
  font-family: var(--fu);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ct3);
  margin-bottom: 12px;
}

.empty-cta {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--csurf);
  border: 1px solid var(--cbrd2);
  border-radius: 12px;
  text-decoration: none;
  max-width: 380px;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.empty-cta:hover {
  border-color: var(--cp);
  box-shadow: 0 2px 8px oklch(from var(--cp) l c h / 0.12);
}

.empty-cta-icon {
  width: 38px;
  height: 38px;
  background: var(--cp);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cton);
  flex-shrink: 0;
}

.empty-cta-icon svg {
  width: 18px;
  height: 18px;
}

.empty-cta-text-title {
  font-family: var(--fu);
  font-size: 14px;
  font-weight: 700;
  color: var(--cp-act);
}

.empty-cta-text-sub {
  font-family: var(--fb);
  font-size: 12px;
  color: var(--ct3);
  margin-top: 2px;
}

/* ─── Simulation toggle ──────────────────────────────────────────────── */
.sim-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--fu);
  font-size: 12px;
  color: var(--ct3);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-left: 12px;
  transition: color 0.15s;
  vertical-align: middle;
}

.sim-toggle:hover { color: var(--cp-dk); }

.sim-toggle svg {
  width: 12px;
  height: 12px;
}

/* ─── Pagination ─────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 36px;
  flex-wrap: wrap;
}

.pg-num {
  min-width: 44px;
  min-height: 44px;
  border: none;
  background: none;
  font-family: var(--fu);
  font-size: 14px;
  color: var(--ct2);
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  transition: background 0.15s, color 0.15s;
}

.pg-num:hover {
  background: var(--cmuted);
  color: var(--ct);
}

.pg-num.active {
  background: var(--cp-btn, oklch(55% 0.19 40));
  color: var(--cton);
  font-weight: 700;
}

.pg-num.dots {
  cursor: default;
  pointer-events: none;
  color: var(--ct3);
}

.pg-arrow {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--fu);
  font-size: 14px;
  font-weight: 600;
  color: var(--cp-dk);
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: 8px;
  transition: background 0.15s;
}

.pg-arrow:hover { background: var(--cmuted); }

.pg-arrow svg {
  width: 15px;
  height: 15px;
}

.pg-arrow[aria-disabled="true"] {
  opacity: 0.38;
  cursor: default;
  pointer-events: none;
}


/* ─── Todo tab (federated results) ───────────────────────────────────── */
.todo-section {
  padding: 20px 0 4px;
}

.todo-section + .todo-section { padding-top: 4px; }

.todo-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 12px;
}

.todo-section-label {
  font-family: var(--fu);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ct3);
}

.todo-section-count {
  font-family: var(--fu);
  font-size: 11px;
  color: var(--ct3);
}

.todo-ver-mas {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 6px;
}

.todo-ver-mas::before,
.todo-ver-mas::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--cbrd);
}

.todo-cta-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--fu);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ct2);
  text-decoration: none;
  padding: 9px 22px;
  border-radius: 9999px;
  border: 1px solid var(--cbrd2);
  background: var(--csurf);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  cursor: pointer;
  white-space: nowrap;
}

.todo-cta-link:hover {
  border-color: var(--cp);
  color: var(--cp-dk);
  background: oklch(from var(--cp) l c h / 0.04);
}

.todo-cta-link svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.todo-summary {
  font-family: var(--fb);
  font-size: 13px;
  color: var(--ct3);
  margin-bottom: 20px;
}

.todo-summary strong {
  color: var(--ct2);
  font-weight: 400;
}

.todo-summary .todo-sum-count {
  font-weight: 700;
  color: var(--ct);
  font-family: var(--fu);
}

/* ─── Satisfaction survey card ───────────────────────────────────────── */
.survey-card {
  margin-top: 0;
  padding: 18px 0 6px;
  border-top: 1px solid var(--cbrd);
}

.survey-q-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.survey-dismiss {
  background: none; border: none;
  color: var(--ct3); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 4px; border-radius: 6px;
  min-width: 44px; min-height: 44px;
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s;
}
.survey-dismiss:hover { background: var(--cmuted); color: var(--ct2); }
.survey-dismiss svg  { width: 14px; height: 14px; }

.survey-q {
  font-family: var(--fu);
  font-size: 14px;
  font-weight: 500;
  color: var(--ct3);
  margin: 0;
}

.survey-btns {
  display: flex;
  gap: 6px;
}

.survey-btn {
  font-family: var(--fu);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 9999px;
  border: 1.5px solid var(--cbrd2);
  background: transparent;
  color: var(--ct3);
  cursor: pointer;
  min-height: 44px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.survey-btn:hover {
  border-color: var(--cp);
  color: var(--cp-dk);
  background: oklch(from var(--cp) l c h / 0.04);
}
.survey-btn--yes {
  background: oklch(from var(--cok) l c h / 0.07);
  border-color: oklch(from var(--cok) l c h / 0.25);
  color: var(--cok-dk);
}
.survey-btn--yes:hover {
  background: oklch(from var(--cok) l c h / 0.13);
  border-color: var(--cok);
  color: var(--cok);
}

.survey-label {
  font-family: var(--fu);
  font-size: 13px;
  font-weight: 600;
  color: var(--ct2);
  display: block;
  margin-bottom: 8px;
}
.survey-opt { font-weight: 400; color: var(--ct3); }

.survey-textarea {
  width: 100%;
  resize: vertical;
  min-height: 72px;
  font-size: 16px;
  font-family: var(--fb);
  box-sizing: border-box;
}

.survey-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}
.survey-char {
  font-family: var(--fu);
  font-size: 12px;
  color: var(--ct3);
}
.survey-card .btn-apply { width: auto; padding: 10px 24px; }

.survey-thanks {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.survey-thanks-icon {
  width: 36px; height: 36px; flex-shrink: 0;
  background: oklch(from var(--cok) l c h / 0.1);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--cok);
}
.survey-thanks-icon svg { width: 18px; height: 18px; }
.survey-thanks-title {
  font-family: var(--fu);
  font-size: 16px; font-weight: 600;
  color: var(--ct); margin: 0 0 4px;
}
.survey-thanks-sub {
  font-family: var(--fb);
  font-size: 14px;
  color: var(--ct2); margin: 0;
}

.survey-expand { animation: surveyExpand 0.22s var(--ease) forwards; }
@keyframes surveyExpand {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .survey-expand { animation: none; }
}

/* ─── Responsive buscador ────────────────────────────────────────────── */
@media (min-width: 861px) {
  .btn-filter-open { display: none; }
  .active-chips    { display: none !important; }
}

/* ─── CTA al final de la lista (sólo mobile y tablet) ─────────────────────
   Por debajo de 1024px no hay sidebar, así que el ofrecimiento de búsqueda
   manual quedaba escondido adentro del panel de filtros: nadie abre
   "Filtros" para pedir ayuda. Acá aparece donde el usuario termina de
   mirar los resultados. En desktop lo tapa el CSS porque ya está al lado. */
.list-cta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 28px;
  padding: 16px 18px;
  background: var(--csurf);
  border: 1px solid var(--cbrd2);
  border-radius: 12px;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}

.list-cta:hover {
  border-color: var(--cp);
  background: oklch(from var(--cp) l c h / 0.04);
  text-decoration: none;
}

.list-cta-q {
  font-family: var(--fu);
  font-size: 14px;
  color: var(--ct2);
}

.list-cta-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--fu);
  font-size: 16px;
  font-weight: 700;
  color: var(--cp-act);
}

.list-cta-action svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

@media (min-width: 861px) {
  /* 861px es donde shared.css vuelve a mostrar .results-sidebar: arriba de
     ese ancho el acceso ya está al costado y repetirlo sería duplicarlo. */
  .list-cta { display: none; }
}

/* ─── Salida de la encuesta ──────────────────────────────────────────────
   Aparece cuando el usuario respondió que NO encontró lo que buscaba. */
.survey-cta {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 14px;
  padding: 12px;
  background: var(--csurf);
  border: 1px solid var(--cbrd2);
  border-radius: 12px;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}

.survey-cta:hover {
  border-color: var(--cp);
  background: oklch(from var(--cp) l c h / 0.04);
  text-decoration: none;
}

.survey-cta--thanks { margin-top: 10px; }

.survey-cta-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--cp);
  color: var(--cton);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.survey-cta-icon svg {
  width: 17px;
  height: 17px;
}

.survey-cta-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.survey-cta-title {
  font-family: var(--fu);
  font-size: 15px;
  font-weight: 700;
  color: var(--cp-act);
}

.survey-cta-sub {
  font-family: var(--fb);
  font-size: 13px;
  color: var(--ct3);
}

/* ─── Tarjeta de resultado en pantalla angosta ───────────────────────────
   Medido a 386px: la tarjeta promediaba 239px, de los cuales ~143 eran
   marco (padding, márgenes, fuente) y sólo ~96 información del documento.
   Veinte tarjetas eran 9 pantallas de swipe, y al final de esa lista viven
   la salida a búsqueda manual y la encuesta. Esto la baja a ~180px sin
   achicar la tipografía ni sacar nada que sirva para decidir.
   Desktop queda intacto: todo vive dentro del media query.               */
@media (max-width: 860px) {
  /* Repite "archivogeneral.sanjuan.gob.ar › …" veinte veces por página.
     El único dato propio es el año, que ya está en título y metadatos. */
  .result-source { display: none; }

  .result-item { padding: 14px 0; }

  /* 1.65 es interlineado de lectura larga; para un extracto de 2 o 3
     renglones sobra. A 1.45 se ahorran 4px por renglón. */
  .result-snippet {
    line-height: 1.45;
    margin-bottom: 8px;
    /* Los extractos van de 43 a 143 caracteres: los más largos ocupaban
       5 renglones. Tres alcanzan para decidir si es el documento. */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .result-title    { margin-bottom: 5px; }
  .result-meta-row { margin-bottom: 8px; }
}

/* ─── Período disponible (microtexto bajo la caja, compartido con home) ── */
.results-periodo {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 6px 0 0;
  font-family: var(--fu);
  font-size: 13px;
  color: var(--ct3);
  min-height: 1.2em;
}

.results-periodo svg {
  width: 14px;
  height: 14px;
  opacity: 0.8;
  flex-shrink: 0;
}

/* ─── Estado de llegada sin búsqueda ─────────────────────────────────────
   Sin query no hay filtros que mostrar: se oculta la columna del sidebar
   (si no, el .sidebar-panel vacío queda como una caja blanca fantasma). */
.results-body--welcome { grid-template-columns: 1fr; }
.results-body--welcome .results-sidebar { display: none; }
