/* HARPS Version 2 — shared modal side-drawer chrome.
 *
 * Filter and Columns share one gutter, one search field, one checkbox axis,
 * and one scroll region. Surface fill, border, and elevation still come from
 * ads-theme.css; this file only corrects drawer layout that the centred-modal
 * card rules get wrong, and the input-padding collisions that made the search
 * icon sit on top of the placeholder.
 */

html[data-theme="ads"] .filter-panel,
html[data-theme="ads"] .colsel-panel,
html[data-theme="dark"] .filter-panel,
html[data-theme="dark"] .colsel-panel,
.filter-panel,
.colsel-panel {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-left: 0;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-top: 0;
  border-bottom: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

@media (prefers-reduced-motion: reduce) {
  .filter-panel,
  .colsel-panel,
  .filter-overlay,
  .colsel-overlay {
    transition: none;
  }
}

/* Shared 24px gutter — header, body, footer on both drawers. */
html[data-theme="ads"] .filter-panel-header,
html[data-theme="ads"] .colsel-header,
html[data-theme="ads"] .filter-panel-body,
html[data-theme="ads"] .colsel-body,
html[data-theme="ads"] .filter-panel-footer,
html[data-theme="ads"] .colsel-footer,
.filter-panel-header,
.colsel-header,
.filter-panel-body,
.colsel-body,
.filter-panel-footer,
.colsel-footer {
  padding-left: 24px;
  padding-right: 24px;
  box-sizing: border-box;
}

html[data-theme="ads"] .filter-panel-header,
html[data-theme="ads"] .colsel-header,
.filter-panel-header,
.colsel-header {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding-top: 16px;
  padding-bottom: 16px;
  min-height: 0;
  height: auto;
}

.filter-panel-header-top,
.colsel-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

html[data-theme="ads"] .filter-panel-body,
html[data-theme="ads"] .colsel-body,
.filter-panel-body,
.colsel-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding-top: 16px;
  padding-bottom: 16px;
}

html[data-theme="ads"] .filter-panel-footer,
html[data-theme="ads"] .colsel-footer,
.filter-panel-footer,
.colsel-footer {
  flex-shrink: 0;
  padding-top: 16px;
  padding-bottom: 16px;
  position: relative;
  z-index: 2;
  background: var(--ads-bg, #fff);
  border-top: 1px solid var(--ads-border, #d4dee3);
}

.harps-drawer-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── ADS search field (leading icon in flow) ────────────────────────────
   ads-theme paints `html[data-theme="ads"] input[type="text"]` at (0,2,2)
   with 12px padding, which outranks any padding-left meant for an overlay
   icon. The wrap is the bordered field; the input is a borderless flex
   child, matching `.edl-modal-search-box`. */
.harps-drawer-search,
html[data-theme="ads"] .harps-drawer-search,
html[data-theme="ads"] .colsel-search-wrap.harps-drawer-search,
html[data-theme="ads"] .filter-input-wrap.harps-drawer-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(15, 18, 20, 0.20);
  border-radius: var(--radius-field, 4px);
  background: var(--ads-card-bg, #fff);
  box-sizing: border-box;
}

.harps-drawer-search:focus-within,
html[data-theme="ads"] .harps-drawer-search:focus-within,
html[data-theme="ads"] .colsel-search-wrap.harps-drawer-search:focus-within,
html[data-theme="ads"] .filter-input-wrap.harps-drawer-search:focus-within {
  border-color: var(--ads-brand, var(--indigo-70, #4045c2));
  box-shadow: 0 0 0 1px var(--ads-brand, var(--indigo-70, #4045c2));
  outline: none;
}

.harps-drawer-search .edl-modal-search-icon,
.harps-drawer-search .colsel-search-icon,
.harps-drawer-search .filter-input-icon,
html[data-theme="ads"] .harps-drawer-search .edl-modal-search-icon,
html[data-theme="ads"] .harps-drawer-search .colsel-search-icon,
html[data-theme="ads"] .harps-drawer-search .filter-input-icon {
  order: -1;
  position: static;
  left: auto;
  right: auto;
  top: auto;
  transform: none;
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  pointer-events: none;
  color: var(--ads-gray-100, var(--gray-40, #9eb0bd));
}

html[data-theme="ads"] .harps-drawer-search input[type="text"],
html[data-theme="ads"] .harps-drawer-search input[type="text"]:focus,
html[data-theme="ads"] .harps-drawer-search input.colsel-search,
html[data-theme="ads"] .harps-drawer-search input.filter-input,
html[data-theme="ads"] .harps-drawer-search input.colsel-search[type="text"],
html[data-theme="ads"] .harps-drawer-search input.filter-input[type="text"],
html[data-theme="ads"] .filter-input-wrap.harps-drawer-search .filter-input,
html[data-theme="ads"] .filter-input-wrap.harps-drawer-search.has-value .filter-input,
html[data-theme="ads"] .colsel-search-wrap.harps-drawer-search .colsel-search,
.harps-drawer-search input[type="text"] {
  height: auto;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  outline: none;
  font: var(--ads-font-body-md-reg, inherit);
  color: var(--ads-gray-600, var(--gray-95));
}

.harps-drawer-search .filter-input-clear,
.harps-drawer-search .harps-drawer-search-clear,
html[data-theme="ads"] .harps-drawer-search .filter-input-clear {
  position: static;
  right: auto;
  top: auto;
  transform: none;
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: auto;
}

.harps-drawer-search.has-value .filter-input-clear,
.harps-drawer-search.has-value .harps-drawer-search-clear {
  display: flex;
}

.harps-drawer-search .filter-input-clear:focus-visible,
.harps-drawer-search .harps-drawer-search-clear:focus-visible {
  outline: 2px solid var(--ads-brand, var(--indigo-70, #4045c2));
  outline-offset: 1px;
}

.colsel-search-empty {
  margin: 8px 0 0;
  font-size: 14px;
  line-height: 21px;
  color: var(--ads-gray-100, var(--gray-50));
}

.colsel-search-empty[hidden] {
  display: none !important;
}

.colsel-required-help {
  margin: 0 0 12px;
  font-size: 12px;
  line-height: 16px;
  color: var(--ads-gray-100, var(--gray-50));
}

/* ── Checkbox axis ─────────────────────────────────────────────────────
   ads-theme `.colsel-check-row { padding: 10px 12px }` indented rows away
   from the 24px gutter and made required rows (no drag handle) look like
   a second list. Horizontal padding lives on the drawer, not the row. */
html[data-theme="ads"] .colsel-check-row,
.colsel-check-row {
  display: grid;
  grid-template-columns: 16px 16px minmax(0, 1fr) auto;
  column-gap: 8px;
  align-items: center;
  min-height: 36px;
  padding: 8px 0;
  margin: 0;
  border-radius: 4px;
  box-sizing: border-box;
  cursor: pointer;
}

html[data-theme="ads"] .colsel-check-row:hover,
.colsel-check-row:hover {
  background: transparent;
}

.colsel-check-row.hidden-by-search {
  display: none !important;
}

.colsel-drag-spacer,
.colsel-drag-handle {
  grid-column: 1;
  width: 16px;
  min-width: 16px;
  max-width: 16px;
}

.colsel-check-row > input[type="checkbox"],
.colsel-check-row .colsel-cb {
  grid-column: 2;
  margin: 0;
  flex-shrink: 0;
}

.colsel-check-label {
  grid-column: 3;
  min-width: 0;
}

.colsel-required-tag {
  grid-column: 4;
  flex-shrink: 0;
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  color: var(--ads-gray-100, var(--gray-50));
  letter-spacing: 0;
}

.colsel-check-row.required {
  cursor: default;
}

.colsel-check-row.required .colsel-drag-handle {
  display: none;
}

.colsel-check-row input[type="checkbox"]:focus-visible,
.filter-ms-option input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--ads-brand, var(--indigo-70, #4045c2));
  outline-offset: 2px;
}

/* ads-theme `:disabled` paints after `:checked` and wipes the fill, so a
   required column looks unchecked. Keep the check, dim the control. */
html[data-theme="ads"] .colsel-check-row input[type="checkbox"]:checked:disabled,
.colsel-check-row input[type="checkbox"]:checked:disabled {
  background: var(--ads-brand, var(--indigo-70, #4045c2));
  border-color: var(--ads-brand, var(--indigo-70, #4045c2));
  opacity: 0.55;
  cursor: not-allowed;
}

.colsel-check-row:focus-visible {
  outline: 2px solid var(--ads-brand, var(--indigo-70, #4045c2));
  outline-offset: 2px;
}

html[data-theme="ads"] .colsel-close,
html[data-theme="ads"] .filter-panel-close,
.colsel-close,
.filter-panel-close {
  flex-shrink: 0;
}

.filter-ms-layer {
  z-index: 10050;
  overflow-x: hidden;
  overflow-y: auto;
}

html[data-theme="ads"] .filter-ms-layer .filter-ms-option,
.filter-ms-layer .filter-ms-option {
  display: flex;
  width: 100%;
  box-sizing: border-box;
}
