/*
 * Listes historiques (factures, Pro-Forma) : boutons de filtres et barre de
 * recherche instantanee placee sous les filtres, juste au-dessus du tableau.
 * Meme design que la barre du catalogue produits (product_list.css).
 */
/* Seul titre de la page (le bandeau du haut est retire pour eviter le doublon). */
.history-page-title {
  font-size: 1.15rem;
  font-weight: 700;
}

.history-filter-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding-top: 0.35rem;
}

.history-filter-action-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.history-search-section {
  width: calc(100% - 3rem);
  margin: 1.25rem auto 0;
  text-align: center;
}

.history-search-box {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 58px;
  padding: 5px 5px 5px 3.25rem;
  border: 1px solid var(--bs-border-color, #d9e2ef);
  border-radius: 999px;
  background: var(--bs-body-bg, #fff);
  box-shadow: 0 12px 32px rgba(15, 23, 42, .09);
  transition: border-color .18s ease, box-shadow .18s ease;
}

.history-search-box:focus-within {
  border-color: var(--bs-primary, #4154f1);
  box-shadow: 0 0 0 4px rgba(65, 84, 241, .12), 0 14px 34px rgba(15, 23, 42, .12);
}

.history-search-icon {
  position: absolute;
  left: 1.2rem;
  color: var(--bs-secondary-color, #6c757d);
  font-size: 1.2rem;
  pointer-events: none;
}

.history-search-input {
  min-width: 0;
  height: 46px;
  padding: 0 .75rem;
  border: 0;
  background: transparent;
  box-shadow: none !important;
  font-size: 1rem;
}

.history-search-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

.history-search-shortcut {
  margin-right: .6rem;
  padding: .15rem .5rem;
  border: 1px solid var(--bs-border-color, #d9e2ef);
  border-radius: 6px;
  color: var(--bs-secondary-color, #6c757d);
  background: var(--bs-tertiary-bg, #f3f5f9);
  box-shadow: none;
  font-size: .75rem;
  line-height: 1.4;
}

.history-search-box:focus-within .history-search-shortcut,
.history-search-input:not(:placeholder-shown) ~ .history-search-shortcut {
  display: none;
}

.history-search-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  color: var(--bs-secondary-color, #6c757d);
  background: transparent;
}

.history-search-clear:hover,
.history-search-clear:focus-visible {
  color: var(--bs-body-color, #1f2937);
  background: var(--bs-tertiary-bg, #eef1f5);
}

.history-search-clear[hidden] {
  display: none;
}

.history-search-submit {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: .45rem;
  min-height: 46px;
  padding-inline: 1.4rem;
  border-radius: 999px !important;
  font-weight: 600;
  white-space: nowrap;
}

.history-search-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  min-height: 28px;
  margin: .65rem 0 1.25rem;
  color: var(--bs-secondary-color, #6c757d);
  font-size: .78rem;
}

.history-search-count {
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  padding: 0.2rem 0.55rem;
  font-weight: 800;
  white-space: nowrap;
}

/* Rafraichissement AJAX (faccontrol-search-filters.js) : loupe animee, tableau estompe. */
[data-search-page][aria-busy="true"] .history-search-icon::before {
  content: "\f130";
  display: inline-block;
  animation: history-search-spin 700ms linear infinite;
}

[data-search-page][aria-busy="true"] .history-results {
  opacity: 0.58;
  transition: opacity 120ms ease;
}

@keyframes history-search-spin {
  to { transform: rotate(360deg); }
}

:where(body.theme-dark, html[data-faccontrol-theme="dark"] body) .history-search-box {
  border-color: #475569;
  background: #111827;
  box-shadow: none;
}

:where(body.theme-dark, html[data-faccontrol-theme="dark"] body) .history-search-input {
  color: #f8fafc;
}

:where(body.theme-dark, html[data-faccontrol-theme="dark"] body) .history-search-clear {
  color: #cbd5e1;
}

:where(body.theme-dark, html[data-faccontrol-theme="dark"] body) .history-search-shortcut {
  border-color: #475569;
  background: #1e293b;
  color: #cbd5e1;
}

:where(body.theme-dark, html[data-faccontrol-theme="dark"] body) .history-search-count {
  border-color: #1e40af;
  background: #172554;
  color: #bfdbfe;
}

@media (max-width: 767.98px) {
  .history-search-meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.35rem;
    text-align: left;
  }

  .history-filter-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .history-filter-action-group {
    width: 100%;
  }

  .history-filter-action-group .btn {
    flex: 1 1 auto;
  }
}

@media (max-width: 575.98px) {
  .history-search-section {
    width: 100%;
  }

  .history-search-box {
    min-height: 54px;
    padding-left: 2.7rem;
  }

  .history-search-icon {
    left: 1rem;
  }

  .history-search-shortcut,
  .history-search-submit span {
    display: none;
  }

  .history-search-submit {
    width: 44px;
    min-width: 44px;
    padding: 0;
    justify-content: center;
  }
}
