
/* ============ RESOURCE PICKER (как модалка «Прототипы») ============ */
.design-modal.resource-picker-modal {
  display: flex;
  flex-direction: column;
}
.design-modal.resource-picker-modal > .design-modal-body.resource-picker-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.resource-picker-body {
  display: flex;
  padding: 0;
}
.resource-picker-sidebar {
  width: 288px;
  border-right: 1px solid var(--border);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 12px 10px;
  gap: 8px;
  box-sizing: border-box;
}
.resource-picker-all-files {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.resource-picker-all-files:hover {
  background: var(--highlight);
}
.resource-picker-all-files.active {
  background: rgba(13, 148, 136, 0.06);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}
.resource-picker-tree-search {
  width: 100%;
  box-sizing: border-box;
  font-size: 13px;
}
.resource-picker-tree-wrap {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.resource-picker-sidebar .materials-tree {
  height: 100%;
  margin: 0;
}
.resource-picker-sidebar .materials-tree > li {
  display: block;
}
.resource-picker-sidebar .materials-tree-children {
  display: block;
}
.resource-picker-sidebar .materials-tree-children > li {
  display: block;
}
.resource-picker-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.resource-picker-toolbar {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.resource-picker-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 16px;
  align-content: start;
}
.resource-picker-item {
  display: flex;
  flex-direction: column;
  background: none;
  border: 1px solid var(--border);
  padding: 4px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.2s;
  text-align: left;
  position: relative;
}
.resource-picker-item:hover {
  border-color: var(--accent);
}
.resource-picker-item img {
  width: 100%;
  height: 100px;
  object-fit: contain;
  background: var(--bg);
  border-radius: 2px;
  margin-bottom: 8px;
}
/* Без картинки — та же высота превью, что у img, иначе угловые кнопки перекрывают иконку и название */
.resource-picker-audio-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100px;
  margin-bottom: 8px;
  background: var(--bg);
  color: var(--muted, #78716c);
  font-size: 2rem;
  line-height: 1;
  border-radius: 2px;
  box-sizing: border-box;
}
.resource-picker-item-name {
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 4px 4px;
}
.resource-picker-item-checkbox-btn {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.9);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
  font-size: 16px;
  line-height: 1;
  color: var(--text, #222);
}
.resource-picker-item-checkbox-btn:hover {
  background: var(--surface);
  border-color: var(--accent);
}
.resource-picker-item--selected .resource-picker-item-checkbox-btn {
  opacity: 1;
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.resource-picker-item--selected:hover .resource-picker-item-checkbox-btn {
  opacity: 1;
}
.resource-picker-item-rename {
  position: absolute;
  bottom: 8px;
  left: 8px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.9);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
  font-size: 16px;
  line-height: 1;
  color: var(--text, #222);
}
.resource-picker-item-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.9);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
  font-size: 18px;
  line-height: 1;
  color: var(--text, #222);
}
.resource-picker-item:hover .resource-picker-item-checkbox-btn,
.resource-picker-item:hover .resource-picker-item-rename,
.resource-picker-item:hover .resource-picker-item-delete,
.resource-picker-item:hover .resource-picker-item-download {
  opacity: 1;
}
.resource-picker-item-rename:hover {
  background: var(--surface);
  border-color: var(--accent);
}
.resource-picker-item-delete:hover {
  background: #fee;
  border-color: #c62828;
  color: #c62828;
}
.resource-picker-item-download {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.9);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
  font-size: 16px;
  line-height: 1;
  color: var(--text, #222);
}
.resource-picker-item-download:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.resource-picker-empty {
  padding: 24px;
  text-align: center;
}

/* Selection bar */
.resource-picker-selection-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  padding: 6px 10px;
  background: color-mix(in srgb, var(--accent, #0d9488) 10%, transparent);
  border-radius: var(--radius, 6px);
  font-size: 13px;
}
.resource-picker-selection-bar[hidden] {
  display: none;
}
.resource-picker-selection-count {
  font-weight: 500;
  flex: 1;
}

/* Selected item */
.resource-picker-item--selected {
  border-color: var(--accent, #0d9488);
  background: color-mix(in srgb, var(--accent, #0d9488) 8%, transparent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent, #0d9488) 30%, transparent);
}

/* Drag & drop hover on sidebar project */
.resource-picker-drop-hover {
  background: color-mix(in srgb, var(--accent, #0d9488) 15%, transparent) !important;
  outline: 2px dashed var(--accent, #0d9488);
  outline-offset: -2px;
  border-radius: var(--radius, 6px);
}

/* Storage quota bar inside resource picker */
.resource-picker-quota {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted, #78716c);
}
.resource-picker-quota[hidden] {
  display: none !important;
}
.resource-picker-quota-label {
  display: block;
  margin: 0 0 4px;
}
.rp-quota-bar {
  width: 100%;
  height: 4px;
  background: var(--border, #e7e5e4);
  border-radius: 999px;
  overflow: hidden;
}
.rp-quota-fill {
  height: 100%;
  background: var(--accent, #0d9488);
  border-radius: 999px;
  transition: width 0.4s ease;
}
