/* Shared by the two search modes: the switch between «Licitaciones» and «Leyes y documentos», and the dropdown
   that searches as you type (combobox.js). Colours come from the tokens in style.css, so both themes follow. */

/* ---------------------------------------------------------------- the two modes */
.search-modes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
  max-width: 640px;
  margin: 0 0 var(--space-4);
  padding: 4px;
  background: var(--fill);
  border: 1px solid var(--separator);
  border-radius: var(--radius-lg);
}
.search-mode {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 56px;
  padding: var(--space-2) var(--space-3);
  border-radius: calc(var(--radius-lg) - 4px);
  color: var(--label-secondary);
  text-decoration: none;
  transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.search-mode svg { flex: none; }
.search-mode span { display: grid; min-width: 0; line-height: 1.25; }
.search-mode b { font-size: var(--font-callout); font-weight: 600; color: var(--label); }
.search-mode small { font-size: var(--font-caption); color: var(--label-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-mode:hover { background: var(--fill-hover); }
.search-mode[aria-current="page"] {
  background: var(--bg-card);
  color: var(--accent);
  box-shadow: var(--shadow);
}
.search-mode[aria-current="page"] b { color: var(--accent); }
@media (max-width: 640px) {
  .search-modes { max-width: none; }
  .search-mode { min-height: 48px; gap: var(--space-2); padding: var(--space-2); }
  .search-mode small { display: none; }
}

/* A step back inside the Licitaciones mode: «Actos» / «Dentro de los documentos». */
.search-submodes { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0 0 var(--space-3); }
.search-submodes a, .search-submodes span {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 var(--space-3);
  border: 1px solid var(--separator); border-radius: 999px; font-size: var(--font-callout);
  color: var(--label-secondary); text-decoration: none; background: var(--bg-card);
}
.search-submodes a:hover { background: var(--fill-hover); color: var(--label); }
.search-submodes [aria-current="page"] { background: var(--accent-light); border-color: transparent; color: var(--accent); font-weight: 600; }

/* ---------------------------------------------------------------- combobox */
.cbx { position: relative; min-width: 0; }
.cbx-filter { display: inline-flex; align-items: stretch; max-width: 100%; }
.cbx-trigger {
  display: inline-flex; align-items: center; gap: var(--space-2);
  min-height: var(--control-h); max-width: 100%; padding: 0 var(--space-3);
  border: 1px solid var(--field-border); border-radius: var(--radius);
  background: var(--bg-card); color: var(--label); font: inherit; font-size: var(--font-callout); cursor: pointer;
}
.cbx-trigger:hover { background: var(--fill-hover); }
.cbx-trigger-label { color: var(--label-secondary); white-space: nowrap; }
.cbx-trigger-value { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 22ch; }
.cbx-trigger-value:empty { display: none; }
.cbx[data-has-value="true"] .cbx-trigger { border-color: var(--accent); background: var(--accent-light); border-top-right-radius: 0; border-bottom-right-radius: 0; }
.cbx[data-has-value="true"] .cbx-trigger-label::after { content: ":"; }
.cbx[data-has-value="true"] .cbx-caret { display: none; }
.cbx-caret { flex: none; color: var(--label-secondary); }
.cbx-clear {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  min-width: var(--control-h); min-height: var(--control-h);
  border: 1px solid var(--accent); border-left: 0; border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--accent-light); color: var(--accent); cursor: pointer;
}
.cbx-clear:hover { background: var(--fill-hover); }
.cbx-clear[hidden] { display: none; }

.cbx-pop {
  position: absolute; z-index: 40; top: calc(100% + 6px); left: 0;
  width: max(100%, 340px); max-width: min(440px, calc(100vw - 32px));
  padding: var(--space-2);
  background: var(--bg-elevated); border: 1px solid var(--separator); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}
.cbx-pop[hidden] { display: none; }
.cbx-filter .cbx-input {
  width: 100%; min-height: var(--control-h); padding: 0 var(--space-3); margin: 0 0 var(--space-2);
  border: 1px solid var(--field-border); border-radius: var(--radius);
  background: var(--bg-card); color: var(--label); font: inherit;
}
.cbx-hint { margin: var(--space-1) var(--space-2); font-size: var(--font-caption); font-weight: 600; letter-spacing: .02em; text-transform: uppercase; color: var(--label-secondary); }
.cbx-hint[hidden], .cbx-status[hidden] { display: none; }
.cbx-list { list-style: none; margin: 0; padding: 0; max-height: min(48vh, 340px); overflow-y: auto; overscroll-behavior: contain; }
.cbx-option {
  display: grid; gap: 2px; padding: var(--space-2) var(--space-3); border-radius: var(--radius);
  cursor: pointer; line-height: 1.3;
}
.cbx-option.is-active { background: var(--accent-light); }
.cbx-option-label { color: var(--label); font-size: var(--font-callout); overflow-wrap: anywhere; }
.cbx-option-label mark { background: none; color: inherit; font-weight: 700; }
.cbx-option-meta { color: var(--label-secondary); font-size: var(--font-caption); }
.cbx-status { margin: 0; padding: var(--space-3); color: var(--label-secondary); font-size: var(--font-callout); }

/* The search-field form: a labelled field with its list under it (Empresas, Entidades). */
.cbx-field { display: block; }
.cbx-label { display: block; margin: 0 0 var(--space-2); font-weight: 600; color: var(--label); }
.cbx-inputwrap {
  display: flex; align-items: center; gap: var(--space-2); min-height: 48px; padding: 0 var(--space-3);
  border: 1px solid var(--field-border); border-radius: var(--radius-lg); background: var(--bg-card);
}
.cbx-inputwrap:focus-within { border-color: var(--focus-ring); outline: 2px solid var(--focus-ring); outline-offset: 1px; }
.cbx-field .cbx-input:focus, .cbx-field .cbx-input:focus-visible { outline: 0; box-shadow: none; }
.cbx-icon { flex: none; color: var(--label-secondary); }
.cbx-field .cbx-input { flex: 1; min-width: 0; min-height: 44px; border: 0; outline: 0; background: transparent; color: var(--label); font: inherit; font-size: var(--font-body); }
.cbx-field .cbx-clear { border: 0; border-radius: var(--radius); background: transparent; color: var(--label-secondary); min-width: 36px; min-height: 36px; }
.cbx-field .cbx-pop { width: 100%; max-width: none; }

@media (pointer: coarse) { .cbx-option { padding: var(--space-3); } }
@media (max-width: 640px) {
  /* On a phone the list opens in place, under its control, instead of floating over the page. */
  .cbx-filter { display: flex; flex-wrap: wrap; }
  .cbx-filter .cbx-trigger { flex: 1; justify-content: space-between; }
  .cbx-filter .cbx-pop { position: static; width: 100%; max-width: none; margin-top: var(--space-2); box-shadow: none; }
}

/* The page of #/search in each mode: the laws' side shows its publishers; inside tender documents it shows neither
   the publishers nor the laws' examples. */
.search-app[data-source="panamacompra"] .search-sources,
.search-app[data-source="panamacompra"] .only-laws,
.search-app:not([data-source="panamacompra"]) .only-tenders { display: none; }

/* On a phone the search comes first: a short page header, and the finder's first-use hint (which finder.js places
   under the search card) as four titles in two columns. */
@media (max-width: 640px) {
  #analizar-section .licit-lead, #comparar-section .licit-lead { display: none; }
  #analizar-hint .licit-hint-head { flex-direction: row; align-items: baseline; }
  #analizar-hint .licit-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2) var(--space-3); }
  #analizar-hint .licit-steps li span, #analizar-hint .licit-hint-more { display: none; }
}

/* «¿Busca una empresa o una entidad?» outside the finder (combobox.js ForsetiNameHints): the same strip, as links. */
a.finder-suggestion { text-decoration: none; }
.products-hints, .search-hints { margin: 0 0 var(--space-4); }

/* The phone's tab bar has room for one short word under each icon: «Licitaciones», not «Buscar licitaciones». */
.nav-short { display: none; }
@media (max-width: 768px) {
  .sidebar-nav .nav-label { display: none; }
  .sidebar-nav .nav-short { display: inline; }
}
