/* Global ListView (admin)
 * Based on the "Pedidos" list styling, but reusable across tabs.
 */

.lv-table.admin-panel { padding:var(--admin-panel-padding); gap:0; overflow:hidden; }
.lv-tabs { margin:0 0 var(--admin-panel-padding); }

.lv-inline-value-editor {
  position: fixed;
  z-index: var(--admin-floating-z-index, var(--admin-z-page-popover));
  box-sizing: border-box;
  padding: 10px;
  border: 1px solid var(--admin-border);
  border-radius: var(--r);
  background: #fff;
  box-shadow: var(--admin-shadow);
}

.lv-floating-cell-editor {
  position: fixed;
  z-index: var(--admin-floating-z-index, var(--admin-z-page-popover));
  box-sizing: border-box;
  width: min(300px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  padding: 10px;
  border: 1px solid var(--admin-border);
  border-radius: var(--r);
  background: #fff;
  box-shadow: var(--admin-shadow);
}

.lv-floating-cell-editor,
.lv-inline-value-editor,
.lv-date-picker-popup,
.lv-file-editor {
  width: min(300px, calc(100vw - 24px));
  min-width: 0;
  max-width: calc(100vw - 24px);
}

.lv-cell .switch.is-loading {
  opacity: .65;
  pointer-events: none;
}

.lv-floating-cell-editor textarea {
  min-height: 100px;
}

.lv-floating-cell-editor:has(textarea),
.lv-inline-value-editor:has(textarea) {
  width: min(600px, calc(100vw - 24px)) !important;
}

.lv-inline-value-editor :is(input, textarea) { box-sizing: border-box; width: 100%; }

.lv-inline-value-editor .pricing-suffix {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lv-inline-value-editor .suffix {
  color: var(--admin-muted);
  font-weight: var(--admin-fw-semibold);
  user-select: none;
}

.lv-multiselect-editor { width: min(360px, calc(100vw - 24px)); }
.lv-multiselect-editor__option input { flex: 0 0 auto; }
.lv-multiselect-editor__option span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.lv-floating-cell-editor__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.lv-floating-cell-editor__actions .btn {
  padding: 6px 10px;
  border-radius: 10px;
}

.lv {
  --lv-check-col-width: 44px;
  --lv-row-gap: 3px;
  display: grid;
  gap: 3px;
  width: 100%;
}

.lv-table,
.lv-table-head,
.lv-table-body {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.lv-table {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 3px;
}

.lv-scroll-viewport {
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  height: 100%;
  min-height: 0;
}

.lv-scroll-viewport > .admin-view-toolbar {
  grid-row: 1;
}

.lv-scroll-viewport > .lv-tabs {
  grid-row: 2;
}

.lv-scroll-viewport > .lv-table-scroll {
  grid-row: 3;
  min-height: 0;
}

.lv-scroll-viewport > .lv-pagination {
  grid-row: 4;
}

.lv-table-scroll {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

.lv-table-scroll.has-vertical-scroll {
  overflow-y: auto;
}

.lv-scroll-viewport > .lv-table-scroll {
  overflow: auto;
}

.lv-content-scroll-viewport {
  grid-template-rows: auto auto minmax(0, 1fr);
  height: 100%;
  min-height: 0;
}

.lv-content-scroll-viewport > .lv-content-body {
  min-height: 0;
  overflow: auto;
}

.lv-table-canvas {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  min-width: 100%;
}

.lv-table[data-layout="fit"] .lv-table-canvas {
  width: 100%;
}

.lv-table[data-layout="expand"] .lv-table-canvas {
  width: max-content;
}

.lv-table-head,
.lv-table-body,
.lv-table-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 100%;
}

.lv-table-head {
  padding-bottom: var(--lv-row-gap);
}

.lv-table-head.is-sticky {
  position: sticky;
  top: 0;
  z-index: 30;
  background: #fff;
  isolation: isolate;
}

.lv-table-head [data-sort-key] {
  cursor: pointer;
  user-select: none;
}

.lv-table-head [data-sort-key][data-sort-state="asc"]::after,
.lv-table-head [data-sort-key][data-sort-state="desc"]::after {
  display: inline-block;
  margin-left: 6px;
  color: var(--admin-muted);
  font-weight: 900;
}

.lv-table-head [data-sort-key][data-sort-state="asc"]::after {
  content: "\2191";
}

.lv-table-head [data-sort-key][data-sort-state="desc"]::after {
  content: "\2193";
}

.lv-table-body {
  gap: var(--lv-row-gap);
}

.lv-table-summary {
  box-sizing: border-box;
  margin-top: 0;
  padding-top: var(--lv-row-gap);
}

.lv-table-summary.is-sticky {
  position: sticky;
  bottom: 0;
  z-index: 30;
  background: #fff;
  isolation: isolate;
}

.lv-table-summary[hidden] {
  display: none;
}

.lv :where(button, [role="button"]):focus-visible {
  outline: 2px solid var(--admin-accent-focus);
  outline-offset: 2px;
}

.lv-row {
  display: grid;
  grid-template-columns: var(--lv-cols, 1fr);
  gap: 0;
  /* Stretch cells so vertical separators connect to the row border. */
  align-items: stretch;
  padding: 0;
  border: 1px solid rgba(55, 53, 47, 0.10);
  border-radius: 10px;
  min-height: 45px;
  height: 45px;
  background: #fff;
  min-width: 0;
  width: 100%;
  overflow: hidden;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.2;
  transition:
    background 140ms ease,
    border-color 140ms ease;
}

.lv-group {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-height: 32px;
  margin: 10px 0 6px;
  padding: 10px 4px 6px;
  border: 0;
  border-bottom: 1px solid rgba(55, 53, 47, 0.1);
  border-radius: 0;
  background: transparent;
  box-sizing: border-box;
}

.lv-group:first-child {
  margin-top: 0;
}

.lv-group-label {
  display: block;
  width: 100%;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--admin-muted);
}

.lv-row[hidden] {
  display: none !important;
}

.lv-head {
  background: var(--admin-view-header-background);
  color: var(--admin-muted);
  font-size: var(--admin-view-header-font-size);
  font-weight: var(--admin-view-header-font-weight);
  line-height: 1.2;
  min-height: var(--admin-view-header-height);
  height: var(--admin-view-header-height);
  border-color: var(--admin-view-header-border);
}

.lv-row > div {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 100%;
  height: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 10px;
  border-right: 1px solid rgba(55, 53, 47, 0.08);
}

.lv-row > .lv-column-frozen {
  position: sticky;
  left: var(--lv-frozen-left, 0);
  z-index: 4;
  background: inherit;
  background-clip: border-box !important;
  isolation: isolate;
}

.lv-table-head .lv-column-frozen,
.lv-table-summary .lv-column-frozen {
  z-index: 6;
}

.lv-table.is-hscrolling .lv-column-frozen-edge {
  box-shadow: 10px 0 16px -12px rgba(15, 23, 42, 0.35);
}

.lv-col-check,
.lv-check-cell {
  display: none !important;
}

.lv-check {
  display: none !important;
}

.lv-cell {
  min-width: 0;
  width: 100%;
  min-height: 100%;
  height: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 400;
}

.lv-row > .lv-cell {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  /* Células simples não passam pelo wrapper de botão: recebem mesmo respiro horizontal. */
  padding: 0 10px;
  text-align: left;
}

.lv-row > .lv-cell > :only-child:not(.tag):not(.switch) {
  min-width: 0;
  width: 100%;
}

.lv-cell-value {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lv-cell-right {
  justify-content: flex-start !important;
  text-align: left;
}

.lv-cell-muted {
  color: var(--admin-muted);
}

.lv-cell-button {
  all: unset;
  align-self: stretch;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  min-height: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 10px;
  cursor: pointer;
  border-radius: 8px;
  font: inherit;
  color: inherit;
}

.lv-cell-button > .lv-cell {
  min-width: 0;
  font-weight: 500;
}

.lv-cell-button > * {
  min-width: 0;
}

.lv-row > div.lv-cell-button-host {
  padding: 0;
  display: flex;
  align-items: stretch;
}

.lv-cell-readonly {
  cursor: default;
}

.lv-cell-editable,
.lv-cell-select-tag {
  cursor: pointer;
}

.lv-cell-switch {
  cursor: default;
  align-items: center !important;
  justify-content: flex-start !important;
  padding-block: 0 !important;
}

.lv-cell-switch > .admin-property-editor {
  width: 100%;
  min-height: 0;
  height: 100%;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 0;
}

.lv-cell-switch .admin-property-editor-switch-row {
  min-height: 0;
  height: 100%;
  align-items: center;
  justify-content: flex-start;
}

.lv-cell-switch .lv-cell-button,
.lv-cell-switch .lv-inline-cell {
  align-items: center;
  justify-content: flex-start;
}

.lv-cell-switch .switch {
  margin-left: 0;
  margin-right: auto;
}

.lv-cell-select-tag .tag {
  pointer-events: none;
}

.lv-inline-cell {
  width: 100%;
  min-width: 0;
  min-height: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
}

.lv-inline-cell-text {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lv-inline-cell-arrow {
  justify-content: space-between;
}

.lv-inline-cell-arrowicon {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  color: var(--admin-muted);
}

.lv-media-thumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  min-width: 0;
}

.lv-media-thumb {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--admin-border);
  background: linear-gradient(180deg, #fafafa, #f1f1f6);
  flex: 0 0 auto;
}

.lv-media-thumb .media-preview {
  width: 100%;
  height: 100%;
}

.lv-media-thumb img,
.lv-media-thumb video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.lv-file-cell {
  position: relative;
  width: 100%;
  box-sizing: border-box;
  padding-right: 22px;
  min-width: 0;
  min-height: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.lv-cell-editable :is(.lv-inline-cell-text, .tag, .lv-file-cell, .lv-file-cell *, .lv-media-thumbs, .lv-media-thumbs *) { pointer-events: none; }

.lv-file-cell__thumbs {
  flex: 0 0 auto;
}

.lv-file-cell .pricing-cell-text,
.lv-file-cell__text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lv-file-cell__text:empty {
  display: none;
}

.lv-file-cell__arrow {
  position: absolute;
  right: 0;
  top: 50%;
  margin: 0;
  transform: translateY(-50%);
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  color: var(--admin-muted);
}

.lv-file-editor {
  position: static;
  z-index: auto;
  width: 100%;
  min-width: 0;
  max-width: calc(100vw - 24px);
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

.lv-file-editor__title {
  font-size: 12px;
  font-weight: var(--admin-fw-semibold);
  color: var(--admin-muted);
  margin: 2px 2px 10px;
}

.lv-file-editor__list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  max-height: 320px;
  overflow: auto;
  padding-right: 2px;
}

.lv-file-editor__empty {
  padding: 14px 12px;
  border: 1px dashed rgba(96, 100, 108, 0.35);
  border-radius: 12px;
  color: var(--admin-muted);
  text-align: center;
}

.lv-file-editor__item {
  position: relative;
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

.lv-file-editor__item--thumb-only {
  border-radius: var(--r);
}

.lv-file-editor__thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  background: linear-gradient(180deg, #fafafa, #f1f1f6);
}

.lv-file-editor__thumb img,
.lv-file-editor__thumb video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.lv-file-editor__meta {
  padding: 6px 8px 8px;
}

.lv-file-editor__name {
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lv-file-editor__kind {
  font-size: 10px;
  color: var(--admin-muted);
  margin-top: 2px;
}

.lv-file-editor__remove {
  z-index: 2;
}

.lv-file-editor__tools {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.lv-file-editor__input {
  display: none;
}

.lv-file-editor__dropzone {
  border: 1px dashed rgba(96, 100, 108, 0.35);
  border-radius: 12px;
  padding: 14px 12px;
  color: var(--admin-muted);
  font-weight: 650;
  background: #fff;
  width: 100%;
  text-align: center;
  cursor: pointer;
}

.lv-file-editor__dropzone.is-dragover {
  border-color: var(--admin-accent-weak-border);
  background: var(--admin-accent-weak);
  color: var(--admin-text);
}

.lv-date-picker-popup {
  position: fixed;
  z-index: var(--admin-floating-z-index, var(--admin-z-page-popover));
  width: min(300px, calc(100vw - 24px));
  border: 1px solid var(--admin-border);
  border-radius: var(--r);
  background: #fff;
  box-shadow: var(--admin-shadow);
  padding: 10px;
  box-sizing: border-box;
}

.lv-date-picker-popup.date-cal {
  margin-top: 0;
  max-width: min(300px, calc(100vw - 24px));
  border: 1px solid var(--admin-border);
  border-radius: var(--r);
  background: #fff;
  box-shadow: var(--admin-shadow);
  padding: 10px;
  box-sizing: border-box;
}

.lv-date-picker-popup .date-cal-h {
  margin-bottom: 8px;
}

.lv-date-picker-popup .date-cal-grid {
  gap: 5px;
  padding: 8px;
}

.lv-date-picker-popup .date-cal-day {
  height: 32px;
}

.lv-row > div:last-child {
  border-right: none;
}

.lv-head > div {
  justify-content: flex-start !important;
  text-align: left;
  white-space: normal;
}

.lv-item.is-active,
.lv-item[aria-selected="true"],
.lv-item[data-selected="true"] {
  background: rgba(55, 53, 47, 0.08);
  border-color: rgba(55, 53, 47, 0.14);
}

.lv-item-interactive:hover,
.lv-item[role="button"]:hover {
  background: rgba(55, 53, 47, 0.06);
  border-color: rgba(55, 53, 47, 0.14);
}

.lv-item-interactive.lv-row-editing-cell-hover,
.lv-item[role="button"].lv-row-editing-cell-hover {
  background: #fff;
  border-color: rgba(55, 53, 47, 0.10);
}

.lv-item.is-context-menu-open {
  background: rgba(55, 53, 47, 0.06);
  border-color: rgba(55, 53, 47, 0.18);
}

.lv-item.is-context-menu-open > .lv-cell {
  background: transparent !important;
}

.lv-row > .lv-cell.lv-cell-editable:not(.lv-cell-switch):hover,
.lv-row > .lv-cell.lv-cell-switch:has(.switch:hover),
.lv-row > .lv-cell.lv-reorder-cell:has(.lv-reorder-handle:not(.is-disabled):hover) {
  background: rgba(55, 53, 47, 0.06);
}

.lv-item-interactive,
.lv-item[role="button"] {
  cursor: pointer;
}

.lv-item[role="button"] > div,
.lv-item[role="button"] .lv-cell,
.lv-item[role="button"] .tag {
  cursor: pointer;
}

.lv-item:focus-visible {
  outline: 2px solid var(--admin-accent-focus);
  outline-offset: 2px;
}

.lv-reorder-cell {
  justify-content: center !important;
  padding: 0 !important;
}

.lv-reorder-handle {
  all: unset;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--admin-muted);
  cursor: grab;
  user-select: none;
}

.lv-reorder-handle:hover {
  color: var(--admin-text);
}

.lv-reorder-handle:active {
  cursor: grabbing;
}

.lv-reorder-handle.is-disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.lv-reorder-handle:focus-visible {
  outline: 2px solid var(--admin-accent-focus);
  outline-offset: 2px;
}

.lv-item.is-lv-reordering {
  opacity: 0.52;
}

.lv-group {
  transition: background 0.16s ease, box-shadow 0.16s ease;
}

.lv-group.is-lv-reorder-target {
  background: var(--admin-accent-weak);
  box-shadow: inset 0 -1px 0 var(--admin-accent-weak-border);
}

.lv-empty {
  color: var(--admin-muted);
  font-size: var(--admin-fs-md);
  font-weight: var(--admin-fw-medium);
  padding: 12px 0 2px;
}

.lv-summary-row {
  background: var(--admin-view-header-background);
  font-weight: var(--admin-fw-semibold);
}

/* Allow consumers to keep a semantic wrapper element while still letting
 * `.lv` manage the vertical spacing between rows via `gap`.
 */
.lv-rows {
  display: contents;
}

.lv-pagination,
.admin-pagination {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 8px 0 0;
  margin: 0;
  border-top: 0;
  box-shadow: none;
}

.lv-pagination-controls,
.admin-pagination-controls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.lv-pagination-btn,
.admin-pagination-btn {
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--admin-muted);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    background 140ms ease,
    border-color 140ms ease,
    color 140ms ease;
}

.lv-pagination-btn:hover:not(:disabled),
.admin-pagination-btn:hover:not(:disabled) {
  background: rgba(55, 53, 47, 0.06);
  color: var(--admin-text);
}

.lv-pagination-btn.is-active,
.admin-pagination-btn.is-active {
  background: rgba(55, 53, 47, 0.08);
  border-color: rgba(55, 53, 47, 0.14);
  color: #37352f;
  cursor: default;
}

.lv-pagination-btn:disabled,
.admin-pagination-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.lv-pagination-ellipsis,
.admin-pagination-ellipsis {
  min-width: 20px;
  text-align: center;
  color: var(--admin-muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
}

.lv-pagination-icon {
  width: 14px;
  height: 14px;
  display: block;
}

.admin-row-context-menu {
  position: fixed;
  z-index: var(--admin-floating-z-index, var(--admin-z-page-popover));
  min-width: 160px;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.16);
}

.admin-row-context-menu-item {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: #fff;
  border-radius: 10px;
  padding: 9px 10px;
  font: inherit;
  font-size: var(--admin-fs-md);
  font-weight: var(--admin-fw-medium);
  line-height: var(--admin-lh-normal);
  color: var(--admin-text);
  cursor: pointer;
}

.admin-row-context-menu-item:hover {
  background: rgba(96, 100, 108, 0.06);
  border-color: rgba(96, 100, 108, 0.14);
}

.admin-row-context-menu-item.is-danger {
  color: #b10f0f;
}

.admin-row-context-menu-item.is-danger:hover {
  background: rgba(237, 21, 21, 0.06);
  border-color: rgba(237, 21, 21, 0.14);
}

@media (max-width: 740px) {
  /* Consumers can opt-in to hiding columns by setting [data-lv-hide-mobile="6,7"] etc.
   * We keep CSS generic here and leave the per-view behaviour to the view-specific CSS.
   */

  .lv-file-editor {
    min-width: 0;
    width: min(100vw - 24px, 420px);
  }

  .lv-file-editor__list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
