@use '../global/common' as global;

.acms-dataview {
  display: flex;
  flex-direction: column;
  gap: 5px;

  > * {
    margin: 0;
  }
}

.acms-dataview-header {
  position: sticky;
  top: 0;
  left: 0;
  z-index: global.zIndex(js-acms_fix_marker);
  display: grid;
  grid-template-rows: auto;
  grid-template-columns: 1fr;
  gap: 20px;
  width: 100%;
  padding-top: 5px;
  padding-bottom: 5px;
  background: global.$acms-color-white;
}

.acms-dataview-body {
  position: relative;
}

.acms-dataview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.acms-dataview-actions > *:first-child {
  flex: 1 1 auto;
}

.acms-dataview-bulk-action {
  display: inline-flex;
  flex-flow: column wrap;
  gap: 20px;
}

.acms-dataview-bulk-action-form {
  display: flex;
  column-gap: 8px;
  align-items: flex-start;
}

.acms-dataview-bulk-action-form > *:nth-child(2) {
  flex: 1 1 auto;
}

.acms-dataview-row-selection-info {
  display: inline-flex;
  gap: 8px;
}

.acms-dataview-pagination {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  align-self: flex-end;
}

.acms-dataview-row-actions {
  display: inline-flex;
  gap: 8px;
}

.acms-dataview-row-actions-tertiary {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.acms-dataview-footer {
  padding: 10px 0;
}

.acms-dataview-column-list {
  padding: 0;
  margin: 0;
  list-style: none;

  > li {
    position: relative;
    box-sizing: border-box;
    width: 100%;
    padding: 8px 24px;
    border-radius: 6px;
  }

  @media (any-hover: hover) {
    > li:has(input[type='checkbox']:checked):hover {
      background-color: global.$acms-color-gray20;
    }
  }
}

.acms-dataview-filter {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
}

.acms-dataview-filter-header {
  display: none;
}

.acms-dataview-filter-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.acms-dataview-filter-row {
  display: grid;
  grid-template-rows: repeat(3, auto);
  grid-template-columns: 1fr auto;
  gap: 4px 8px;
}

.acms-dataview-filter-row > .acms-dataview-filter-cell {
  grid-column: span 1;
}

.acms-dataview-filter-row > .acms-dataview-filter-cell:last-child {
  grid-row: 1 / 4; /* ボタンを縦に合わせる */
  grid-column: 2 / 3; /* ボタンを右寄せ */
  align-self: end;
}

@include global.media-breakpoint-up(md) {
  .acms-dataview-header {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px 8px;
  }

  .acms-dataview-filter-row {
    grid-template-rows: auto;
    grid-template-columns: repeat(3, minmax(0, 220px)) auto;
    gap: 12px 8px;
  }

  .acms-dataview-filter-row > .acms-dataview-filter-cell {
    grid-column: auto;
  }

  .acms-dataview-filter-row > .acms-dataview-filter-cell:last-child {
    grid-row: auto;
    grid-column: auto;
  }
}
