@use "../abstracts/variables" as *;
@use "../abstracts/mixins" as *;

.no-explorer-modal-open {
  overflow: hidden;
}

.no-explorer-modal {
  position: fixed;
  inset: 0;
  z-index: 9998;
}

.no-explorer-modal__backdrop {
  position: absolute;
  inset: 0;
  background: $color-overlay;
}

.no-explorer-modal__dialog {
  position: relative;
  z-index: 1;
  display: flex;
  overflow: hidden;
  flex-direction: column;
  width: min(1420px, calc(100vw - 24px));
  height: min(94vh, 980px);
  margin: 12px auto;
  border: 1px solid $color-border;
  border-radius: $radius-modal;
  background: $color-card-bg;
  box-shadow: $shadow-modal;
}

.no-explorer-modal__header {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1rem 1rem 0.5rem;
  gap: $spacing-md;
}

.no-explorer-modal__heading {
  min-width: 0;
}

.no-explorer-modal__title {
  margin: 0;
  word-break: normal;
  color: $color-text-strong;
  font-size: 1.8rem;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.no-explorer-modal__subtitle,
.no-explorer-modal__detail-description {
  margin: 0.3rem 0 0;
  color: $color-text-muted;
  font-size: $font-size-sm;
  line-height: 1.45;
}

.no-explorer-modal__close {
  @include button-secondary;

  flex: 0 0 auto;
  min-width: 42px;
  min-height: 42px;
  padding: 0;
  border-radius: $radius-pill;
  font-size: 1.25rem;
}

.no-explorer-modal__top {
  flex: 0 0 auto;
  padding: 0 1rem 0.85rem;
}

.no-explorer-modal__summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
}

.no-explorer-modal__summary-card {
  @include card;

  align-items: flex-start;
  min-width: 0;
  gap: 0.7rem;
}

.no-explorer-modal__summary-icon {
  display: inline-flex;
  flex: 0 0 28px;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: $color-blue-strong;
  border-radius: $radius-pill;
  background: $color-blue-tint-08;
  font-size: 14px;
  font-weight: 700;
}

.no-explorer-modal__summary-content {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.no-explorer-modal__summary-label,
.no-explorer-modal__payload-label {
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: $color-text-muted;
  font-size: 11px;
  font-weight: 700;
}

.no-explorer-modal__summary-value {
  word-break: normal;
  color: $color-text;
  font-size: 1rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.no-explorer-modal__content {
  display: grid;
  overflow: hidden;
  flex: 1 1 auto;
  grid-template-columns: minmax(0, 1.7fr) minmax(370px, 0.9fr);
  min-width: 0;
  min-height: 0;
  padding: 0 1rem 1rem;
  gap: 1rem;
}

.no-explorer-modal__table-panel,
.no-explorer-modal__detail-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  min-height: 0;
}

.no-explorer-modal__table-header {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-start;
  justify-content: space-between;
  padding-bottom: 0.75rem;
  gap: 0.75rem;
}

.no-explorer-modal__table-heading,
.no-explorer-modal__detail-heading {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  gap: 0.2rem;
}

.no-explorer-modal__table-caption {
  color: $color-text-muted;
  font-size: $font-size-sm;
  line-height: 1.45;
}

.no-explorer-modal__panel-title {
  color: $color-text-strong;
  font-size: 1.05rem;
  font-weight: 700;
}

.no-explorer-modal__table-controls {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  padding-bottom: 0.75rem;
  gap: 0.5rem;
}

.no-explorer-modal__search-wrap {
  display: flex;
  align-items: center;
  min-width: 0;
}

.no-explorer-modal__search {
  @include control;

  width: 100%;
  min-width: 0;
  height: 40px;
  min-height: 40px;
  padding: 0 0.9rem;
  border-radius: 12px;
  font-size: $font-size-sm;
}

.no-explorer-modal__toolbar-button,
.no-explorer-modal__pager {
  @include button-secondary;

  min-width: 118px;
  height: 40px;
  min-height: 40px;
  padding: 0 0.85rem;
  border-radius: 12px;
  font-size: $font-size-sm;
}

.no-explorer-modal__table-shell {
  display: flex;
  overflow: hidden;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

.no-explorer-modal__table-wrap {
  @include scrollable-panel;

  flex: 1 1 auto;
  min-height: 0;
  border: 1px solid $color-border-soft;
  border-radius: 16px;
  background: $color-panel-bg;
}

.no-explorer-modal__table {
  width: 100%;
  border-collapse: collapse;

  th,
  td {
    padding: 0.8rem 0.85rem;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid $color-border-soft;
    font-size: $font-size-sm;
  }

  th {
    position: sticky;
    z-index: 1;
    top: 0;
    white-space: nowrap;
    color: $color-text-soft;
    background: $color-surface-muted;
    font-weight: 700;
  }

  td {
    color: $color-text;
  }
}

.no-explorer-modal__row {
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    box-shadow 0.2s ease;

  &:hover {
    background: $color-blue-tint-05;
  }

  &.is-active {
    background: $color-blue-tint-08;
    box-shadow: inset 3px 0 0 $color-blue-strong;
  }
}

.no-explorer-modal__pagination {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  padding-top: 0.8rem;
  gap: 0.75rem;
}

.no-explorer-modal__page-label {
  color: $color-text-muted;
  font-size: $font-size-sm;
}

.no-explorer-modal__detail-panel {
  padding-left: 1rem;
  border-left: 1px solid $color-border-soft;
}

.no-explorer-modal__detail-header {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-start;
  justify-content: space-between;
  padding-bottom: 0.75rem;
  gap: 0.75rem;
}

.no-explorer-modal__scroll-hint {
  @include subtle-pill;

  color: $color-blue-strong;
  background: $color-blue-tint-08;
  font-weight: 800;
}

.no-explorer-modal__detail-shell {
  display: flex;
  overflow: hidden;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  gap: 0.75rem;
}

.no-explorer-modal__detail-topbar {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-start;
}

.no-explorer-modal__dataset-badge {
  @include subtle-pill;

  flex: 0 0 auto;
  color: $color-text-muted;
  border: 1px solid $color-border-soft;
  background: $color-panel-bg;
  font-weight: 800;
}

.no-explorer-modal__dataset-badge[data-dataset-type="slow_endpoints"] {
  color: $color-dataset-slow-text;
  background: $color-dataset-slow-bg;
}

.no-explorer-modal__dataset-badge[data-dataset-type="ajax_endpoints"] {
  color: $color-dataset-ajax-text;
  background: $color-dataset-ajax-bg;
}

.no-explorer-modal__dataset-badge[data-dataset-type="external_requests"] {
  color: $color-dataset-external-text;
  background: $color-dataset-external-bg;
}

.no-explorer-modal__detail-meta-wrap {
  @include scrollable-panel;

  flex: 0 0 auto;
  min-height: 0;
  max-height: 44%;
  border: 1px solid $color-border-soft;
  border-radius: 16px;
  background: $color-panel-bg;
}

.no-explorer-modal__detail-meta {
  display: flex;
  flex-direction: column;
}

.no-explorer-modal__meta-row {
  display: grid;
  grid-template-columns: 152px minmax(0, 1fr);
  border-bottom: 1px solid $color-border-soft;
}

.no-explorer-modal__meta-row:last-child {
  border-bottom: 0;
}

.no-explorer-modal__meta-label-cell,
.no-explorer-modal__meta-value-cell {
  padding: 0.75rem 0.85rem;
  font-size: $font-size-sm;
  line-height: 1.45;
}

.no-explorer-modal__meta-label-cell {
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: $color-text-soft;
  background: $color-surface-muted;
  font-size: 11px;
  font-weight: 700;
}

.no-explorer-modal__meta-value-cell {
  word-break: normal;
  color: $color-text;
  overflow-wrap: anywhere;
}

.no-explorer-modal__meta-value-cell.is-route {
  color: $color-blue-strong;
  font-weight: 700;
}

.no-explorer-modal__payload-section {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  gap: 0.45rem;
}

.no-explorer-modal__payload-wrap {
  flex: 1 1 auto;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 0;
  padding: 0.65rem;
  border: 1px solid $color-border-soft;
  border-radius: 16px;
  background: $color-payload-bg;
}

.no-explorer-modal__payload {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  height: 100%;
  min-height: 100%;
  padding: 0.9rem;
  resize: none;
  color: $color-payload-text;
  border: 0;
  border-radius: 12px;
  background: $color-payload-bg;
  font-family:
    ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    monospace;
  font-size: 12px;
  line-height: 1.55;
}

.no-explorer-modal__status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  padding: 0.3rem 0.55rem;
  border-radius: $radius-pill;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.no-explorer-modal__status.is-success {
  color: $color-status-success-text;
  background: $color-status-success-bg;
}

.no-explorer-modal__status.is-info {
  color: $color-status-info-text;
  background: $color-status-info-bg;
}

.no-explorer-modal__status.is-warning {
  color: $color-status-warning-text;
  background: $color-status-warning-bg;
}

.no-explorer-modal__status.is-error {
  color: $color-status-error-text;
  background: $color-status-error-bg;
}

.no-explorer-modal__path-route {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: 0;
}

.no-explorer-modal__path-value {
  word-break: normal;
  color: $color-text;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.no-explorer-modal__path-divider {
  width: 100%;
  height: 1px;
  background: $color-border-soft;
}

.no-explorer-modal__route-value {
  word-break: normal;
  color: $color-blue-strong;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.no-explorer-modal__empty,
.no-explorer-modal__empty-inline {
  padding: 1rem;
  color: $color-text-muted;
  font-size: $font-size-sm;
}

@media (max-width: 1180px) {
  .no-explorer-modal__summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .no-explorer-modal__content {
    overflow: auto;
    grid-template-columns: 1fr;
  }

  .no-explorer-modal__detail-panel {
    padding-left: 0;
    border-left: 0;
  }

  .no-explorer-modal__detail-meta-wrap {
    max-height: 280px;
  }
}

@media (max-width: 720px) {
  .no-explorer-modal__dialog {
    width: calc(100vw - 12px);
    height: calc(100vh - 12px);
    margin: 6px auto;
  }

  .no-explorer-modal__summary {
    grid-template-columns: 1fr;
  }

  .no-explorer-modal__table-controls {
    grid-template-columns: 1fr;
  }

  .no-explorer-modal__toolbar-button,
  .no-explorer-modal__pager {
    width: 100%;
    min-width: 0;
  }

  .no-explorer-modal__meta-row {
    grid-template-columns: 1fr;
  }

  .no-explorer-modal__meta-label-cell {
    border-bottom: 1px solid $color-border-soft;
  }
}

.no-explorer-modal__meta-row.is-primary .no-explorer-modal__meta-label-cell {
  background: $color-surface-muted;
}
