@use 'tokens' as *;

.gmbpu-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap;
  &__title { display: flex; align-items: center; gap: 12px; h1 { margin: 0; padding: 0; font-size: 22px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; } p { margin: 2px 0 0; color: $muted; } }
  &__actions { display: flex; gap: 8px; } }
.gmbpu-logo { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, $primary, #7c3aed); box-shadow: 0 4px 12px rgba($primary, .35); }

.gmbpu-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: $white; border: 1px solid $line; border-radius: $radius $radius 0 0; padding: 10px 12px; box-shadow: $shadow; }
.gmbpu-search { position: relative; flex: 0 1 280px; min-width: 200px; color: $muted;
  .gmbpu-ic { position: absolute; left: 10px; top: 9px; }
  input { width: 100%; height: 34px; padding: 0 10px 0 32px; border: 1px solid $line; border-radius: $radius-sm; font: inherit; background: $bg; &:focus { outline: none; background: $white; border-color: $primary; box-shadow: 0 0 0 3px rgba($primary, .18); } } }
.gmbpu-chiprow { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px 12px; background: $white; border: 1px solid $line; border-top: 0; }
.gmbpu-fchip { display: inline-flex; align-items: center; gap: 4px; background: $primary-soft; color: $primary-d; border-radius: 99px; padding: 3px 4px 3px 10px; font-weight: 600; font-size: 12px; button { border: 0; background: transparent; color: inherit; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; &:hover { background: rgba($primary, .15); } } }

.gmbpu-selbar { display: flex; align-items: center; gap: 12px; padding: 8px 12px; min-height: 52px; background: $bg; border: 1px solid $line; border-top: 0; flex-wrap: wrap;
  &.is-on { background: $primary-soft; border-color: #c7d2fe; }
  .is-danger { color: $danger; }
  .gmbpu-hint { color: $muted; display: inline-flex; align-items: center; gap: 6px; } }

.gmbpu-gridwrap { background: $white; border: 1px solid $line; border-top: 0; overflow: auto; max-height: calc(100vh - 360px); min-height: 220px; position: relative; transition: opacity .15s; &.is-loading { opacity: .55; pointer-events: none; } }
.gmbpu-grid { .gmbpu-namecell { max-width: 400px; } border-collapse: separate; border-spacing: 0; width: 100%; min-width: max-content;
  th { position: sticky; top: 0; z-index: 3; background: #f8fafc; text-align: left; padding: 0 12px; height: 38px; border-bottom: 1px solid $line; font-size: 12px; font-weight: 700; color: $ink-2; white-space: nowrap; }
  td { padding: 6px 12px; border-bottom: 1px solid $line-2; vertical-align: middle; background: $white; max-width: 320px; }
  tr:hover td { background: #fafbff; }
  tr.is-selected td { background: $primary-soft; }
  tr.is-child td { background: #fcfaff; }
  .gmbpu-sel { position: sticky; left: 0; z-index: 2; width: 44px; min-width: 44px; padding: 0 0 0 14px; }
  th.gmbpu-sel { z-index: 5; }
  .gmbpu-namecell { position: sticky; left: 44px; z-index: 2; box-shadow: 1px 0 0 $line; }
  th.gmbpu-namecell { z-index: 5; } }
.gmbpu-density--compact .gmbpu-grid td { padding-top: 2px; padding-bottom: 2px; .gmbpu-meta { display: none; } .gmbpu-mini { width: 22px; height: 22px; } }
.gmbpu-th { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: default; &--sort { cursor: pointer; &:hover, &.is-on { color: $primary-d; } } }
.gmbpu-sortarrow { margin-left: 4px; opacity: .45; .is-on > & { opacity: 1; } }

.gmbpu-namewrap { display: flex; align-items: center; gap: 8px; min-width: 270px; }
.gmbpu-namebox { min-width: 0; flex: 1; }
.gmbpu-expander { border: 0; background: $line-2; color: $ink-2; width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; cursor: pointer; transition: transform .15s; &.is-open { transform: rotate(90deg); background: $primary-soft; color: $primary; } }
.gmbpu-expander-sp { width: 22px; flex: none; }
.gmbpu-mini { width: 32px; height: 32px; border-radius: 8px; background: $line-2; display: grid; place-items: center; color: #94a3b8; overflow: hidden; flex: none; img { width: 100%; height: 100%; object-fit: cover; } }
.gmbpu-meta { display: flex; gap: 8px; align-items: center; color: $muted; font-size: 11px; margin-top: 2px; flex-wrap: nowrap; white-space: nowrap;
  a, button { color: $muted; text-decoration: none; background: none; border: 0; padding: 0; font: inherit; cursor: pointer; &:hover { color: $primary; text-decoration: underline; } &.is-danger:hover { color: $danger; } }
  a, button { opacity: 0; transition: opacity .12s; } }
tr:hover .gmbpu-meta a, tr:hover .gmbpu-meta button, tr:focus-within .gmbpu-meta a, tr:focus-within .gmbpu-meta button { opacity: 1; }

.gmbpu-cell { &.is-dirty, &.gmbpu-namecell.is-dirty { background: $dirty !important; box-shadow: inset 3px 0 0 #eab308; }
  &.is-error { background: $danger-soft !important; box-shadow: inset 3px 0 0 $danger; }
  &__err { display: block; color: $danger; font-size: 11px; margin-top: 2px; white-space: normal; max-width: 200px; } }
.gmbpu-val { display: block; width: 100%; min-height: 28px; line-height: 28px; text-align: left; background: transparent; border: 1px solid transparent; border-radius: 6px; padding: 0 8px; margin: 0 -8px; font: inherit; color: $ink; cursor: text; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  &:hover:not(.is-static) { border-color: $line; background: $white; } &:focus { outline: none; border-color: $primary; } &.is-empty { color: #cbd5e1; } &.is-static { cursor: default; color: $ink-2; } }
.gmbpu-cell--price .gmbpu-val, .gmbpu-cell--number .gmbpu-val { font-variant-numeric: tabular-nums; }
.gmbpu-cell.is-locked { background: repeating-linear-gradient(135deg, #fff, #fff 6px, #f8fafc 6px, #f8fafc 12px); em { color: #cbd5e1; font-style: normal; } }
.gmbpu-cell .gmbpu-select { height: 30px; border-color: transparent; background-color: transparent; &:hover { border-color: $line; background-color: $white; } }
.gmbpu-chips { display: flex; gap: 4px; align-items: center; background: none; border: 1px solid transparent; border-radius: 6px; padding: 2px 6px; margin: 0 -6px; cursor: pointer; &:hover { border-color: $line; } }
.gmbpu-chip { background: $line-2; border-radius: 6px; padding: 2px 8px; font-size: 12px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; &--more { background: $primary-soft; color: $primary-d; font-weight: 600; } }
.gmbpu-thumb { width: 36px; height: 36px; border-radius: 8px; border: 1px dashed $line; background: $bg; display: grid; place-items: center; color: #94a3b8; overflow: hidden; cursor: pointer; padding: 0; &:hover { border-color: $primary; } img { width: 100%; height: 100%; object-fit: cover; } }
.gmbpu-switch { position: relative; display: inline-block; width: 36px; height: 20px; cursor: pointer;
  input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
  i { position: absolute; inset: 0; background: #cbd5e1; border-radius: 99px; transition: background .15s; &::after { content: ''; position: absolute; width: 16px; height: 16px; top: 2px; left: 2px; background: #fff; border-radius: 50%; transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); } }
  input:checked + i { background: $primary; &::after { transform: translateX(16px); } }
  input:focus-visible + i { box-shadow: 0 0 0 3px rgba($primary, .3); } }

.gmbpu-pager { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: $white; border: 1px solid $line; border-top: 0; border-radius: 0 0 $radius $radius; color: $ink-2; label { display: inline-flex; align-items: center; gap: 6px; } }
.gmbpu-pagenum { min-width: 100px; text-align: center; }

.gmbpu-savebar { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 99998; background: $ink; color: #fff; border-radius: 14px; padding: 10px 12px 10px 18px; display: flex; align-items: center; gap: 12px; box-shadow: $shadow-lg; animation: gmbpu-up .2s ease-out;
  .gmbpu-muted { color: #94a3b8; } .gmbpu-btn--ghost { background: transparent; color: #e2e8f0; border-color: #475569; &:hover { background: #1e293b; color: #fff; } } }
.gmbpu-dot { width: 9px; height: 9px; border-radius: 50%; background: #facc15; box-shadow: 0 0 0 4px rgba(250, 204, 21, .25); }
@keyframes gmbpu-up { from { opacity: 0; transform: translate(-50%, 12px); } }
.gmbpu-empty { text-align: center; padding: 60px 20px; background: $white; border: 1px solid $line; border-top: 0; h3 { margin: 10px 0 4px; font-size: 16px; } p { color: $muted; margin: 0; } &__ic { width: 56px; height: 56px; border-radius: 16px; background: $primary-soft; color: $primary; display: inline-grid; place-items: center; } }
