/**
 * 环境配置子平台 — 资源管理等页面
 */

.main--env-resources {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--topbar-height));
  padding: 0;
  background: var(--obs-bg-page);
}

.main--env-page {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--topbar-height));
  padding: 0;
  background: var(--obs-bg-page);
}

.main--env-page .platform-empty {
  flex: 1;
  min-height: 0;
}

.env-page-title {
  flex-shrink: 0;
  height: 48px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--obs-neutral-900);
  background: var(--obs-bg-card);
  border-bottom: 1px solid var(--obs-border);
}

.env-resources {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

/* —— 左侧资源树 —— */
.env-resources__tree {
  flex-shrink: 0;
  width: 280px;
  display: flex;
  flex-direction: column;
  background: var(--obs-bg-card);
  border-right: 1px solid var(--obs-border);
}

.env-tree-tabs {
  display: flex;
  gap: 24px;
  padding: 12px 16px 0;
  border-bottom: 1px solid var(--obs-border);
}

.env-tree-tabs button {
  border: none;
  background: none;
  padding: 0 0 10px;
  font: inherit;
  font-size: var(--font-size-base);
  color: var(--obs-neutral-600);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.env-tree-tabs button:hover {
  color: var(--obs-brand);
}

.env-tree-tabs button.is-active {
  color: var(--obs-brand);
  font-weight: 500;
  border-bottom-color: var(--obs-brand);
}

.env-tree-toolbar {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
}

.env-tree-toolbar .btn {
  flex: 1;
  justify-content: center;
  padding: 0 8px;
}

.env-tree-search {
  padding: 0 16px 12px;
}

.env-tree-search .search-input {
  width: 100%;
}

.env-tree-list {
  flex: 1;
  overflow: auto;
  padding: 4px 0 8px;
}

.env-tree-node {
  user-select: none;
}

.env-tree-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 12px 0 8px;
  font-size: var(--font-size-sm);
  color: var(--obs-neutral-900);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}

.env-tree-row:hover {
  background: var(--obs-bg-table-row-hover);
}

.env-tree-row.is-selected {
  background: var(--obs-surface-selected);
  color: var(--obs-brand);
}

.env-tree-row.is-selected .env-tree-row__label {
  color: var(--obs-brand);
}

.env-tree-status {
  flex-shrink: 0;
  width: 3px;
  height: 14px;
  border-radius: 1px;
}

.env-tree-status--ok {
  background: var(--obs-success);
}

.env-tree-status--error {
  background: var(--obs-error);
}

.env-tree-status--muted {
  background: var(--obs-neutral-400);
}

.env-tree-chevron {
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  color: var(--obs-neutral-400);
  transition: transform 0.15s ease;
}

.env-tree-node.is-open > .env-tree-row .env-tree-chevron {
  transform: rotate(90deg);
}

.env-tree-icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  color: var(--obs-neutral-500);
}

.env-tree-row.is-selected .env-tree-icon {
  color: var(--obs-brand);
}

.env-tree-row__label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.env-tree-tag {
  flex-shrink: 0;
  height: 20px;
  padding: 0 6px;
  font-size: var(--font-size-xs);
  line-height: 20px;
  color: var(--obs-neutral-600);
  background: var(--obs-bg-tag-neutral);
  border-radius: 2px;
}

.env-tree-children {
  display: none;
  padding-left: 12px;
}

.env-tree-node.is-open > .env-tree-children {
  display: block;
}

.env-tree-footer {
  flex-shrink: 0;
  padding: 10px 16px;
  border-top: 1px solid var(--obs-border);
  font-size: var(--font-size-sm);
  color: var(--obs-neutral-600);
}

.env-tree-footer label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

/* —— 右侧详情 —— */
.env-resources__detail {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--obs-bg-card);
  overflow: auto;
}

.env-detail-head {
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--obs-border);
}

.env-detail-head__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.env-detail-head__title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.env-detail-head__title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--obs-neutral-900);
  margin: 0;
}

.env-detail-head__actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.env-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: var(--font-size-sm);
  color: var(--obs-neutral-500);
}

.env-detail-meta span strong {
  font-weight: 400;
  color: var(--obs-neutral-600);
}

.env-detail-body {
  flex: 1;
  padding: 16px;
}

.env-detail-section {
  margin-bottom: 20px;
}

.env-detail-section__title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--obs-neutral-900);
}

.env-detail-section__title::before {
  content: "";
  width: 3px;
  height: 14px;
  border-radius: 1px;
  background: var(--obs-brand);
}

.env-info-card {
  border: 1px solid var(--obs-border);
  border-radius: 2px;
  padding: 12px 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 24px;
  font-size: var(--font-size-sm);
}

.env-info-card__item {
  display: flex;
  gap: 4px;
  color: var(--obs-neutral-600);
}

.env-info-card__item span:first-child {
  color: var(--obs-neutral-500);
  flex-shrink: 0;
}

.env-detail-empty {
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--obs-border);
  border-radius: 2px;
  color: var(--obs-neutral-400);
  font-size: var(--font-size-sm);
  background: var(--obs-bg-page);
}

/* —— 底部日志栏 —— */
.env-resources__log-bar {
  flex-shrink: 0;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--obs-bg-card);
  border-top: 1px solid var(--obs-border);
  font-size: var(--font-size-sm);
  color: var(--obs-neutral-600);
  cursor: pointer;
  user-select: none;
}

.env-resources__log-bar:hover {
  background: var(--obs-bg-table-row-hover);
}

.env-resources__log-bar svg {
  width: 14px;
  height: 14px;
  color: var(--obs-neutral-400);
}

.tag--outline-error {
  background: rgba(245, 88, 99, 0.08);
  color: var(--obs-error);
  border: 1px solid rgba(245, 88, 99, 0.35);
}

.tag--outline-neutral {
  background: var(--obs-bg-tag-neutral);
  color: var(--obs-neutral-600);
  border: 1px solid var(--obs-border);
}

@media (max-width: 960px) {
  .env-resources {
    flex-direction: column;
  }

  .env-resources__tree {
    width: 100%;
    max-height: 40vh;
    border-right: none;
    border-bottom: 1px solid var(--obs-border);
  }

  .env-info-card {
    grid-template-columns: 1fr;
  }
}
