/*
 * 中文注释：Advanced Charts v31 内置指标分类器样式；布局参考官方指标选择器并适配窄屏。
 */

.lhjy-indicator-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10110;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, .46);
  color: #d1d4dc;
  font: 14px/1.4 Arial, sans-serif;
}

.lhjy-indicator-backdrop.is-open { display: flex; }

.lhjy-indicator-dialog {
  display: flex;
  width: min(620px, 100%);
  height: min(680px, calc(100vh - 32px));
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #363a45;
  border-radius: 6px;
  background: #1f1f1f;
  box-shadow: 0 12px 36px rgba(0, 0, 0, .55);
}

.lhjy-indicator-head {
  display: flex;
  min-height: 58px;
  align-items: center;
  padding: 0 14px 0 20px;
}

.lhjy-indicator-head h2 {
  margin: 0;
  color: #f0f3fa;
  font-size: 18px;
  font-weight: 600;
}

.lhjy-indicator-close {
  display: inline-grid;
  width: 34px;
  height: 34px;
  margin-left: auto;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #b2b5be;
  cursor: pointer;
  font-size: 25px;
}

.lhjy-indicator-close:hover { background: #2b2b2b; color: #fff; }
.lhjy-indicator-search-wrap { padding: 0 20px 12px; }

.lhjy-indicator-search {
  box-sizing: border-box;
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid #4a4a4a;
  border-radius: 6px;
  outline: 0;
  background: #202020;
  color: #f0f3fa;
  font: inherit;
}

.lhjy-indicator-search:focus { border-color: #2962ff; }

.lhjy-indicator-tabs {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
  padding: 0 20px 12px;
  border-bottom: 1px solid #333;
}

.lhjy-indicator-tab {
  min-height: 30px;
  padding: 0 13px;
  border: 0;
  border-radius: 16px;
  background: #303030;
  color: #d1d4dc;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
}

.lhjy-indicator-tab:hover { background: #3a3a3a; color: #fff; }
.lhjy-indicator-tab.is-on { background: #f0f3fa; color: #131722; }

.lhjy-indicator-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 2px 12px 18px;
  scrollbar-color: #4a4a4a transparent;
}

.lhjy-indicator-section h3 {
  margin: 16px 12px 7px;
  color: #8f9199;
  font-size: 12px;
  font-weight: 500;
}

.lhjy-indicator-list { display: grid; gap: 2px; }

.lhjy-indicator-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  min-height: 38px;
  align-items: stretch;
  border-radius: 6px;
}

.lhjy-indicator-item:hover { background: #2d2d2d; }

.lhjy-indicator-favorite,
.lhjy-indicator-add {
  border: 0;
  background: transparent;
  color: #d1d4dc;
  cursor: pointer;
}

.lhjy-indicator-favorite {
  width: 34px;
  padding: 0;
  color: #787b86;
  font-size: 18px;
}

.lhjy-indicator-favorite:hover,
.lhjy-indicator-favorite.is-on { color: #f0b90b; }

.lhjy-indicator-add {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  padding: 0 12px 0 0;
  text-align: left;
  font: inherit;
}

.lhjy-indicator-add span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lhjy-indicator-add em {
  flex: 0 0 auto;
  margin-left: auto;
  color: #787b86;
  font-size: 11px;
  font-style: normal;
}

.lhjy-indicator-add:disabled { cursor: default; opacity: .65; }

.lhjy-indicator-empty,
.lhjy-indicator-error {
  padding: 44px 20px;
  color: #787b86;
  text-align: center;
}

.lhjy-indicator-error { padding-bottom: 0; color: #f23645; }

.lhjy-indicator-toast {
  position: fixed;
  top: 58px;
  right: 18px;
  z-index: 10200;
  max-width: 360px;
  padding: 9px 13px;
  border-radius: 4px;
  background: #2962ff;
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s;
}

.lhjy-indicator-toast.is-danger { background: #f23645; }
.lhjy-indicator-toast.is-on { opacity: 1; }

/* 中文注释：Pine 编辑器使用独立滚动区，避免长源码把指标弹窗撑出视口。 */
.lhjy-pine-editor { display: flex; min-height: 0; flex: 1; flex-direction: column; padding: 16px 12px 18px; }
.lhjy-pine-help { margin: 0 8px 10px; color: #b2b5be; font-size: 12px; }
.lhjy-pine-scripts { margin: 0 8px 12px; max-height: 130px; overflow: auto; }
.lhjy-pine-scripts h3 { margin: 0 0 6px; color: #8f9199; font-size: 12px; font-weight: 500; }
.lhjy-pine-script {
  display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 30px; padding: 0 8px; border: 0; border-radius: 4px;
  background: transparent; color: #d1d4dc; cursor: pointer; text-align: left; font: 12px/1.3 Arial, sans-serif;
}
.lhjy-pine-script:hover { background: #2d2d2d; color: #fff; }
.lhjy-pine-script span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lhjy-pine-script em { flex: 0 0 auto; color: #787b86; font-style: normal; }
/* 中文注释：平台自营列表保持官方指标行密度，名称和主/副图状态不会互相遮挡。 */
.lhjy-platform-scripts { padding: 10px 8px 18px; }
.lhjy-platform-scripts h3 { margin: 8px 8px 7px; color: #8f9199; font-size: 12px; font-weight: 500; }
.lhjy-platform-list { display: grid; gap: 2px; }
.lhjy-platform-script {
  display: flex; width: 100%; min-height: 40px; align-items: center; gap: 12px; padding: 0 12px;
  border: 0; border-radius: 5px; background: transparent; color: #d1d4dc; cursor: pointer;
  text-align: left; font: 14px/1.35 Arial, sans-serif;
}
.lhjy-platform-script:hover { background: #2d2d2d; color: #fff; }
.lhjy-platform-script:disabled { cursor: default; opacity: .65; }
.lhjy-platform-script span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lhjy-platform-script em { flex: 0 0 auto; margin-left: auto; color: #787b86; font-size: 11px; font-style: normal; }
.lhjy-pine-source {
  box-sizing: border-box; width: 100%; min-height: 280px; flex: 1; resize: vertical;
  padding: 12px; border: 1px solid #4a4a4a; border-radius: 5px; outline: 0;
  background: #131722; color: #f0f3fa; font: 13px/1.55 Consolas, "Courier New", monospace;
}
.lhjy-pine-source:focus { border-color: #2962ff; }
.lhjy-pine-source.has-inputs { min-height: 180px; flex: 0 0 210px; }
/* 中文注释：Pine 参数按官方 input 分组呈现，控件高度固定，避免源码与按钮区被动态内容挤压。 */
.lhjy-pine-inputs {
  display: grid; max-height: 230px; margin-top: 10px; gap: 10px; overflow: auto;
  padding-right: 3px; scrollbar-color: #4a4a4a transparent;
}
.lhjy-pine-input-group { min-width: 0; margin: 0; padding: 9px 10px 10px; border: 1px solid #363a45; border-radius: 5px; }
.lhjy-pine-input-group legend { padding: 0 5px; color: #b2b5be; font-size: 12px; }
.lhjy-pine-input-row {
  display: grid; grid-template-columns: minmax(110px, 1fr) minmax(130px, 1.25fr);
  min-height: 34px; align-items: center; gap: 10px;
}
.lhjy-pine-input-row + .lhjy-pine-input-row { margin-top: 5px; }
.lhjy-pine-input-row > label { overflow: hidden; color: #d1d4dc; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.lhjy-pine-input-control {
  box-sizing: border-box; width: 100%; min-width: 0; height: 30px; padding: 0 8px;
  border: 1px solid #4a4a4a; border-radius: 4px; outline: 0; background: #1e222d; color: #f0f3fa; font-size: 12px;
}
.lhjy-pine-input-control:focus { border-color: #2962ff; }
.lhjy-pine-input-textarea { min-height: 58px; padding: 7px 8px; resize: vertical; }
.lhjy-pine-color { width: 38px; height: 28px; justify-self: end; padding: 2px; border: 1px solid #4a4a4a; border-radius: 4px; background: #1e222d; }
.lhjy-pine-switch { position: relative; width: 34px; height: 20px; justify-self: end; }
.lhjy-pine-switch input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.lhjy-pine-switch span { position: absolute; inset: 0; border-radius: 10px; background: #4a4a4a; cursor: pointer; transition: background .15s; }
.lhjy-pine-switch span::after {
  position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff;
  content: ""; transition: transform .15s;
}
.lhjy-pine-switch input:checked + span { background: #2962ff; }
.lhjy-pine-switch input:checked + span::after { transform: translateX(14px); }
.lhjy-pine-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 0 0; }
.lhjy-pine-button {
  min-height: 34px; padding: 0 14px; border: 0; border-radius: 4px;
  background: #2962ff; color: #fff; cursor: pointer; font: 13px/1 Arial, sans-serif;
}
.lhjy-pine-button.secondary { background: #363a45; }
.lhjy-pine-button:hover { filter: brightness(1.12); }
.lhjy-pine-button:disabled { cursor: default; opacity: .55; }
.lhjy-pine-message {
  margin: 10px 0 0;
  color: #b2b5be;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}
.lhjy-pine-message.is-success { color: #089981; }
.lhjy-pine-message.is-error { color: #f23645; }
.lhjy-pine-diagnostic-title {
  margin-top: 9px;
  color: #f0b90b;
  font-size: 11px;
  font-weight: 600;
}
.lhjy-pine-diagnostic-title.is-error { color: #f23645; }
.lhjy-pine-errors {
  max-height: 132px;
  margin: 7px 0 0;
  padding: 0 8px 0 22px;
  overflow: auto;
  color: #d1d4dc;
  font: 11px/1.45 Consolas, "Courier New", monospace;
  scrollbar-color: #4a4a4a transparent;
}
.lhjy-pine-errors li { margin: 3px 0; }
.lhjy-pine-warnings {
  max-height: 132px;
  margin: 5px 0 0;
  padding: 0 8px 0 22px;
  overflow: auto;
  color: #d1d4dc;
  font: 11px/1.45 Consolas, "Courier New", monospace;
  scrollbar-color: #4a4a4a transparent;
}
.lhjy-pine-warnings li { margin: 3px 0; }

@media (max-width: 560px) {
  .lhjy-indicator-backdrop { align-items: flex-end; padding: 0; }
  .lhjy-indicator-dialog { width: 100%; height: 90vh; border-radius: 6px 6px 0 0; }
  .lhjy-indicator-head { min-height: 54px; padding: 0 10px 0 16px; }
  .lhjy-indicator-search-wrap { padding: 0 16px 10px; }
  .lhjy-indicator-tabs { gap: 5px; padding: 0 16px 10px; overflow-x: auto; }
  .lhjy-indicator-tab { flex: 0 0 auto; min-height: 32px; }
  .lhjy-indicator-body { padding-right: 8px; padding-left: 8px; }
  .lhjy-indicator-item { min-height: 42px; }
  .lhjy-pine-source { min-height: 230px; }
  .lhjy-pine-input-row { grid-template-columns: minmax(92px, 1fr) minmax(120px, 1.25fr); }
}
