/* inventory page results */
/* ====================== */

/* --- Filters row (sits above results) --- */
/* Use FLEX outside so fields size to content and never overlap */
.ara-inv-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;           /* align baselines of inputs */
  gap: 1rem 2rem;                  /* row/column gaps */
  margin-bottom: 1.25rem;
  background: #f4f5f6;
  padding: 1rem;
  border-radius: 12px;
}

/* --- Field blocks: label + control(s) inline --- */
.ara-inv-filter-field {
  display: grid;
  grid-template-columns: max-content auto;  /* [Label] [Controls] */
  align-items: end;
  column-gap: .75rem;
  /* size to content, don’t force a width that could clip */
  flex: 0 0 auto;
  min-width: max-content;                   /* prevents internal wrap from crushing */
}

/* Filter labels */
.ara-inv-filter-field > label {
  margin: 0;
  white-space: nowrap;
  font-size: .95rem;
  font-weight: 600;
  color: #495057;
}

/* Text & number inputs */
.ara-inv-filter .regular-text,
.ara-inv-filter input[type="text"],
.ara-inv-filter input[type="search"],
.ara-inv-filter input[type="number"] {
  width: 100%;
  padding: 0.55rem 0.7rem !important;
  border: 1px solid #cfd4da;
  border-radius: 8px;
  background: #fff;
  font-size: 0.95rem;
  transition: box-shadow .15s ease, border-color .15s ease;
}

/* Number range inline: "Min [input]  Max [input]" */
.ara-inv-filter .ara-type-number {
  display: grid;
  grid-template-columns: max-content 80px max-content 80px; /* Min, input, Max, input */
  column-gap: .5rem;
  align-items: end;
}
.ara-inv-filter .ara-type-number input[type="number"] {
  width: 120px;   /* consistent width for alignment */
  min-width: 0;
}

/* Dropdown/selects (don’t stretch to 100% so they align inline) */
.ara-inv-filter select {
  width: auto;                       /* important: avoid 100% stretching */
  min-width: 180px;
  padding: 0.55rem 2rem 0.55rem 0.7rem !important;
  border: 1px solid #cfd4da;
  border-radius: 8px;
  background: #fff;
  font-size: 0.95rem;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #9097a1 50%),
    linear-gradient(135deg, #9097a1 50%, transparent 50%),
    linear-gradient(to right, #fff, #fff);
  background-position:
    calc(100% - 18px) calc(50% - 4px),
    calc(100% - 13px) calc(50% - 4px),
    100% 0;
  background-size: 5px 5px, 5px 5px, 2.5rem 100%;
  background-repeat: no-repeat;
}

/* Filter / Reset buttons */
.ara-inv-filter .button,
.ara-inv-filter .button-primary,
.ara-inv-filter button[type="submit"],
.ara-inv-filter input[type="submit"] {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  transition: background-color .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.ara-inv-filter .button-primary {
  background: #00a0e0;
  color: #fff;
  border-color: #00a0e0;
}
.ara-inv-filter .button-primary:hover {
  background: #0b5ed7;
  border-color: #0b5ed7;
}
.ara-inv-filter .button:not(.button-primary) {
  background: #fff;
  color: #212529;
  border-color: #dee2e6;
}
.ara-inv-filter .button:not(.button-primary):hover {
  background: #f1f3f5;
  border-color: #cfd4da;
}

/* Buttons wrapper — inline with fields, not full width */
.ara-inv-filter > p {
  display: inline-flex;
  gap: .6rem;
  margin: 0;
  width: auto;                        /* ensure it doesn’t span full row */
  align-self: end;
  flex: 0 0 auto;
}

/* Pagination (WordPress paginate_links outputs a list) */
.ara-inv-pagination {
  margin-top: 1.25rem;
  display: flex;
  justify-content: center;
}
.ara-inv-pagination .page-numbers {
  display: inline-flex;
  gap: 0.25rem;
  list-style: none;
  padding: 0;
  margin: 0;
}
.ara-inv-pagination .page-numbers li a,
.ara-inv-pagination .page-numbers li span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 0.6rem;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  background: #fff;
  color: #212529;
  text-decoration: none;
  font-weight: 600;
}
.ara-inv-pagination .page-numbers .current {
  background: #0d6efd;
  color: #fff;
  border-color: #0d6efd;
}

/* ====================== */
/* Responsive adjustments */
/* ====================== */
@media (max-width: 768px) {
  /* Stack fields on small screens for readability */
  .ara-inv-filter { gap: .75rem 1rem; }

  /* label above controls on small screens */
  .ara-inv-filter-field {
    grid-template-columns: 1fr;
    row-gap: .25rem;
    min-width: 0;
  }

  /* Min/Max becomes two cols: Min [____]  Max [____] */
  .ara-inv-filter .ara-type-number {
    grid-template-columns: max-content 1fr;
    row-gap: .5rem;
  }
  .ara-inv-filter .ara-type-number input[type="number"] {
    width: 100%;
  }

  /* Buttons drop under fields */
  .ara-inv-filter > p {
    width: 100%;
    justify-content: flex-start;
  }
}
/* ===========================
   Responsive layout helpers
   =========================== */

/* Large desktops: give everything room, keep one tidy row when possible */
@media (min-width: 1280px){
  .ara-inv-filter{
    gap: 1rem 2rem;
    justify-content: flex-start;
  }
  /* slightly wider inputs for nicer alignment */
  .ara-inv-filter .ara-type-number input[type="number"]{ width: 140px; }
  .ara-inv-filter select{ min-width: 200px; }
}

/* Tablets / small laptops */
@media (max-width: 1024px){
  /* tighten control widths so more items fit per row */
  .ara-inv-filter .ara-type-number input[type="number"]{ width: 120px; }
  .ara-inv-filter select{ min-width: 170px; }
  .ara-inv-filter{ gap: .75rem 1.25rem; }
}

/* Phones / narrow tablets */
@media (max-width: 768px){
  /* stack fields full-width for readability */
  .ara-inv-filter{
    gap: .75rem 1rem;
  }
  .ara-inv-filter-field{
    flex: 1 1 100%;               /* take full row on mobile */
    min-width: 0;                  /* allow shrinking inside flex row */
    grid-template-columns: 1fr;    /* label above controls */
    row-gap: .25rem;
  }

  /* Min/Max becomes two columns per row: "Min [____]" then "Max [____]" */
  .ara-inv-filter .ara-type-number{
    grid-template-columns: max-content 1fr;
    row-gap: .5rem;
    column-gap: .5rem;
  }
  .ara-inv-filter .ara-type-number input[type="number"]{
    width: 100%;
  }

  /* Buttons drop underneath, left-aligned */
  .ara-inv-filter > p{
    width: 100%;
    justify-content: flex-start;
  }
}

/* Very small phones */
@media (max-width: 480px){
  /* let selects and inputs use the full width */
  .ara-inv-filter select{
    min-width: 0;
    width: 100%;
  }
  .ara-inv-filter .ara-type-number input[type="number"]{
    width: 100%;
  }

  /* a little extra touch area for buttons */
  .ara-inv-filter .button,
  .ara-inv-filter .button-primary{
    padding: .7rem 1rem;
  }
}
/* Toggle button (hidden on desktop) */
.ara-filter-toggle{
  display:none;
  background:#00a0e0; color:#fff; font-weight:600;
  border:0; border-radius:6px; padding:.6rem 1.1rem;
  margin-bottom:.75rem; cursor:pointer;
}
.ara-filter-toggle .txt-hide{ display:none; }

/* Collapsible wrapper */
.ara-filter-wrap{
  overflow:hidden;
}

/* Mobile behavior */
@media (max-width:768px){
  .ara-filter-toggle{ display:inline-block; }

  /* collapsed by default */
  .ara-filter-wrap{
    max-height:0; opacity:0;
    transition:max-height .3s ease, opacity .25s ease;
  }
  /* when checkbox is checked, expand */
  .ara-filter-checkbox:checked ~ .ara-filter-wrap{
    max-height:1000px; /* big enough to fit form */
    opacity:1;
  }
  /* swap button text */
  .ara-filter-checkbox:checked + .ara-filter-toggle .txt-show{ display:none; }
  .ara-filter-checkbox:checked + .ara-filter-toggle .txt-hide{ display:inline; }
}

/* Desktop: always open, ignore checkbox */
@media (min-width:769px){
  .ara-filter-wrap{ max-height:none; opacity:1; overflow:visible; }
  .ara-filter-toggle{ display:none; }
}
