/* Plugins (public/assets/js/designer/plugins/): a plugin's panel (its sandboxed frame in a popover, a bottom sheet
   on phones) and the Plugins window. Everything else a plugin shows lives inside its own frame. */

/* The hidden frames plugins' code runs in (never shown). */
.dz-plugin-holder,
.dz-plugin-code {
  display: none;
}

/* ---------- a plugin's panel ---------- */
.dz-plugin-panel {
  width: var(--dz-plugin-w, 300px);
  max-width: calc(100vw - 16px);
}

.dz-plugin-head {
  justify-content: flex-start;
  padding: 8px 6px 4px 12px;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.dz-plugin-head:active {
  cursor: grabbing;
}

.dz-plugin-head > .dz-btn {
  margin-left: auto;
  cursor: var(--nc-hand, pointer);
}

.dz-plugin-mark {
  flex: none;
  display: inline-grid;
  place-items: center;
  color: var(--accent);
}

.dz-plugin-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dz-plugin-body {
  padding: 0 0 2px;
}

.dz-plugin-frame {
  display: block;
  width: 100%;
  height: var(--dz-plugin-h, 96px);
  border: 0;
  background: transparent;
  color-scheme: dark;
}

.dz-plugin-frame:focus-visible {
  outline: none;
}

/* Phones: a bottom sheet across the width (its own title and handle). */
.dz-sheet.is-plugin .dz-plugin-panel {
  width: auto;
  max-width: none;
}

.dz-sheet.is-plugin .dz-plugin-frame {
  max-height: 64dvh;
}

/* ---------- the Plugins window and the add / update question ---------- */
.dz-plugins-window,
.dz-plugins-confirm {
  display: grid;
  gap: 10px;
}

.dz-plugins-list {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.dz-plugins-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 6px 6px 6px 8px;
  border-radius: 10px;
}

.dz-plugins-item:hover {
  background: var(--dz-hover-bg);
}

.dz-plugins-icon,
.dz-plugins-empty-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
}

.dz-plugins-text {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
}

.dz-plugins-name {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  margin: 0;
  color: var(--text);
  font-weight: 700;
}

.dz-plugins-name > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dz-plugins-version {
  flex: none;
  color: var(--text-3);
  font-size: var(--dz-fs-sm);
  font-weight: 600;
}

.dz-plugins-meta {
  margin: 0;
  color: var(--text-3);
  font-size: var(--dz-fs-sm);
}

.dz-plugins-actions {
  flex: none;
  display: flex;
  align-items: center;
  gap: 2px;
}

.dz-plugins-empty {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  color: var(--text-2);
}

.dz-plugins-empty > p {
  margin: 0;
}

.dz-plugins-desc {
  margin: 0;
  color: var(--text-2);
}

.dz-plugins-confirm > .dz-plugins-meta {
  font-size: var(--dz-fs);
}

.dz-plugins-perms {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--ok-line);
  border-radius: 10px;
  background: var(--ok-soft);
  color: var(--text);
  font-weight: 650;
}

.dz-plugins-perms-icon {
  flex: none;
  display: inline-grid;
  place-items: center;
  color: var(--ok);
}

.dz-plugins-new {
  margin: 0;
  color: var(--warn);
  font-weight: 650;
}

.dz-plugins-confirm > .dz-hint,
.dz-plugins-window > .dz-hint {
  margin: 0;
}

/* Phones and touch screens: big enough to tap. */
@media (pointer: coarse) {
  .dz-plugins-item {
    min-height: 56px;
  }

  .dz-plugins-actions .dz-btn {
    min-width: 44px;
    min-height: 44px;
  }
}

.designer[data-layout="phone"] .dz-plugins-item {
  flex-wrap: wrap;
}

.designer[data-layout="phone"] .dz-plugins-actions {
  width: 100%;
  justify-content: flex-end;
}
