/* Grid trading strategy — Strategy Tree pane */

.strategy-tree-pane .grid-sim-scene-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  width: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.grid-sim-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(320px, 1.15fr);
  gap: 12px;
  flex: 1;
  min-height: 0;
  height: 100%;
  align-items: stretch;
  overflow: hidden;
}

@media (max-width: 900px) {
  .grid-sim-layout {
    grid-template-columns: 1fr;
    overflow: auto;
  }
}

.grid-sim-panel {
  position: relative;
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0.85rem 0.9rem 0.95rem;
  background: rgba(8, 10, 14, 0.2);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.grid-sim-panel.raiders-scroll {
  overflow-y: auto;
}

.app--alpha .grid-sim-panel {
  background: rgba(8, 10, 14, 0.2);
}

.grid-sim-panel-title {
  margin: 0 0 0.85rem;
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(200, 210, 230, 0.72);
}

.grid-sim-field {
  margin-bottom: 0.85rem;
}

.grid-sim-field label,
.grid-sim-field-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(200, 210, 230, 0.58);
}

.grid-sim-asset-tabs,
.grid-sim-period-tabs,
.grid-sim-direction-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.grid-sim-tab {
  padding: 0.38rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 500;
  font-family: inherit;
  color: rgba(220, 228, 245, 0.72);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.grid-sim-tab:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.grid-sim-tab.is-active {
  background: rgba(143, 220, 255, 0.12);
  border-color: rgba(143, 220, 255, 0.45);
  color: #8fdcff;
}

.grid-sim-input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.grid-sim-input {
  width: 100%;
  padding: 0.45rem 0.6rem;
  font-size: 0.85rem;
  font-family: inherit;
  color: #eef2fa;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-sizing: border-box;
}

.grid-sim-input:focus {
  outline: none;
  border-color: rgba(143, 220, 255, 0.5);
}

.grid-sim-spacing-row {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.grid-sim-radio {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: rgba(220, 228, 245, 0.82);
  cursor: pointer;
}

.grid-sim-radio input {
  accent-color: #8fdcff;
}

.grid-sim-autofill-btn {
  margin-top: 0.35rem;
  padding: 0.25rem 0;
  font-size: 0.72rem;
  font-family: inherit;
  color: rgba(143, 220, 255, 0.85);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.grid-sim-autofill-btn:hover {
  color: #8fdcff;
}

.grid-sim-run-btn {
  width: 100%;
  margin-top: auto;
  padding: 0.65rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 0.04em;
  color: #081018;
  background: linear-gradient(135deg, #8fdcff 0%, #6ec8f0 100%);
  border: none;
  cursor: pointer;
  transition: opacity 0.15s;
}

.grid-sim-run-btn:hover:not(:disabled) {
  opacity: 0.92;
}

.grid-sim-run-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.grid-sim-results-empty {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 2rem;
  text-align: center;
  color: rgba(200, 210, 230, 0.45);
  font-size: 0.88rem;
}

.grid-sim-summary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
  flex: 0 0 auto;
}

.grid-sim-summary-card {
  padding: 0.75rem 0.85rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.grid-sim-summary-label {
  display: block;
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(200, 210, 230, 0.5);
  margin-bottom: 0.25rem;
}

.grid-sim-summary-value {
  font-size: 1.05rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #eef2fa;
}

.grid-sim-summary-value.is-up {
  color: #4ade80;
}

.grid-sim-summary-value.is-down {
  color: #f87171;
}

.grid-sim-chart-wrap {
  position: relative;
  width: 100%;
  height: 240px;
  flex: 0 0 240px;
  margin-bottom: 0.75rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.grid-sim-chart {
  display: block;
  width: 100%;
  height: 100%;
}

.grid-sim-trades-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.grid-sim-trades-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.grid-sim-trades-table th,
.grid-sim-trades-table td {
  padding: 0.4rem 0.6rem;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.grid-sim-trades-table th {
  position: sticky;
  top: 0;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(200, 210, 230, 0.5);
  background: rgba(8, 10, 16, 0.95);
}

.grid-sim-trades-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.grid-sim-trades-table .side-buy,
.grid-sim-trades-table .side-cover {
  color: #4ade80;
}

.grid-sim-trades-table .side-sell,
.grid-sim-trades-table .side-short {
  color: #f87171;
}

.grid-sim-meta {
  margin-top: 0.75rem;
  font-size: 0.72rem;
  color: rgba(200, 210, 230, 0.42);
}

.grid-sim-loading {
  padding: 2rem;
  text-align: center;
  color: rgba(200, 210, 230, 0.55);
  font-size: 0.85rem;
}

#gridSimResults {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

#gridSimResults.hidden {
  display: none;
}

@media (max-width: 640px) {
  .grid-sim-panel {
    padding: 0.85rem 0.8rem 1rem;
    height: auto;
  }

  .grid-sim-asset-tabs,
  .grid-sim-period-tabs,
  .grid-sim-direction-tabs {
    width: 100%;
  }

  .grid-sim-tab {
    flex: 1 1 auto;
    text-align: center;
  }

  .grid-sim-trades-wrap {
    overflow-x: auto;
  }
}
