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

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

.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%;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.2;
  transition:
    background 140ms ease,
    border-color 140ms ease;
}

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

.lv-head {
  background: rgba(55, 53, 47, 0.04);
  color: var(--admin-muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  min-height: 45px;
  height: 45px;
  border-color: rgba(55, 53, 47, 0.08);
}

.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-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-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-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 {
  min-width: 0;
  min-height: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

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

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

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

.lv-file-cell__arrow {
  margin-left: auto;
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  color: var(--admin-muted);
}

.lv-file-editor {
  position: fixed;
  z-index: 9999;
  min-width: 420px;
  max-width: min(520px, calc(100vw - 32px));
  border: 1px solid rgba(55, 53, 47, 0.1);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--admin-shadow);
  padding: 10px;
}

.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: 10020;
  width: min(280px, calc(100vw - 20px));
  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(280px, calc(100vw - 20px));
  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:hover {
  background: rgba(55, 53, 47, 0.06);
  border-color: rgba(55, 53, 47, 0.14);
}

.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 {
  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-empty {
  color: var(--admin-muted);
  font-size: var(--admin-fs-md);
  font-weight: var(--admin-fw-medium);
  padding: 12px 0 2px;
}

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

/* 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: 9999;
  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));
  }
}
