// Scoped to .map-list-view so the (unrelated) form-view panel keeps its
// normal whole-panel scroll behavior.
.map-list-view.FormOverView {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.map-container {
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

// ── Summary Cards ─────────────────────────────────────
.summary-cards {
  display: flex;
  gap: 16px;
  padding: 16px 16px 0;
  flex-wrap: wrap;
  flex-shrink: 0;

  .summary-card {
    flex: 1;
    min-width: 160px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);

    .card-icon {
      font-size: 28px;
      width: 28px;
      height: 28px;
      line-height: 28px;
      flex-shrink: 0;
      color: var(--action-primary-default, #7068b1);
    }

    .card-info {
      display: flex;
      flex-direction: column;

      .card-count {
        font-size: 24px;
        font-weight: 700;
        color: var(--text-primary);
        line-height: 1.1;
      }

      .card-label {
        font-size: 11px;
        font-weight: 600;
        color: var(--text-secondary);
        letter-spacing: 0.6px;
        text-transform: uppercase;
        margin-top: 2px;
      }
    }
  }
}

// ── Filter Bar ───────────────────────────────────────
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  gap: 12px;
  margin-top: 16px;
  flex-shrink: 0;

  .filter-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
  }
}

.filter-select-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;

  .filter-select {
    appearance: none;
    padding: 6px 32px 6px 12px;
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    min-width: 130px;
    transition: border-color 0.2s ease;

    &:focus {
      border-color: var(--action-primary-default, #7068b1);
    }
  }

  .select-arrow {
    position: absolute;
    right: 10px;
    font-size: 14px;
    color: var(--text-secondary);
    pointer-events: none;
  }
}

.filter-search-wrapper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: var(--bg-surface);
  padding: 0 10px;
  gap: 6px;
  transition: border-color 0.2s ease;

  &:focus-within {
    border-color: var(--action-primary-default, #7068b1);
  }

  .searchIcon {
    font-size: 18px;
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
    flex-shrink: 0;
  }

  .filter-search {
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 13px;
    padding: 6px 0;
    width: 180px;

    &::placeholder {
      color: var(--text-secondary);
    }
  }
}

// ── Add Button ───────────────────────────────────────
.btn-add-map {
  padding: 8px 18px;
  background: var(--action-primary-default, #7068b1);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.2s ease;

  &:hover {
    opacity: 0.9;
  }
}

// ── Table ────────────────────────────────────────────
.table-container {
  background: var(--bg-surface);
  border-radius: 8px;
  margin: 16px;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.map-table {
  width: 100%;
  border-collapse: collapse;

  thead tr {
    background-color: var(--bg-subtle);

    th {
      position: sticky;
      top: 0;
      z-index: 1;
      background-color: var(--bg-subtle);
      padding: 12px 16px;
      text-align: left;
      font-size: 11px;
      font-weight: 700;
      color: var(--text-secondary);
      letter-spacing: 0.6px;
      text-transform: uppercase;
      white-space: nowrap;
      border-bottom: 1px solid var(--border-subtle);
    }
  }

  tbody tr {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: background 0.15s ease;

    &:last-child {
      border-bottom: none;
    }

    &:hover {
      background: var(--bg-muted);
    }

    &.row-highlighted {
      background: var(--bg-muted);

      &:hover {
        background: var(--bg-muted);
        filter: brightness(0.97);
      }
    }

    td {
      padding: 12px 16px;
      font-size: 13px;
      color: var(--text-primary);
      vertical-align: middle;
    }
  }
}

// ── Cell styles ──────────────────────────────────────
.skill-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 13px;
}

.skill-code {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
}

.routing-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 13px;
}

.routing-sub {
  font-size: 11px;
  color: var(--text-secondary);
}

.op-tag {
  display: inline-block;
  background: #eef4ff;
  color: #3b6fd4;
  padding: 3px 10px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 700;
}

// ── Level Dots ───────────────────────────────────────
.level-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.level-dots {
  display: flex;
  gap: 3px;

  .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border-subtle);

    &.filled {
      background: var(--action-primary-default, #7068b1);
    }
  }
}

.level-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
}

// ── Prereq Badge ─────────────────────────────────────
.prereq-badge {
  display: inline-block;
  border: 1.5px solid var(--action-primary-default, #7068b1);
  color: var(--action-primary-default, #7068b1);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  background: transparent;
}

// ── Notes ────────────────────────────────────────────
.note-text {
  font-size: 12px;
  color: var(--action-primary-default, #7068b1);
  font-style: italic;
}

.text-muted {
  color: var(--text-secondary);
}

// ── Empty State ──────────────────────────────────────
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  text-align: center;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;

  h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px;
  }

  p {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0 0 24px;
  }
}

// ── Form Container ─────────────────────────────────────
.container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

// ── Quick-add Picklist Button ──────────────────────────
.picklist-with-btn {
  display: inline-flex;
  align-items: flex-start;
  gap: 6px;
  vertical-align: bottom;
}

.picklist-stack {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;

  gb-newpicklist {
    width: 100%;
  }
}

.quick-add-icon {
  cursor: pointer;
  color: var(--action-primary-default, #7068b1);
  font-size: 28px !important;
  width: 28px !important;
  height: 28px !important;
  flex-shrink: 0;
  margin-top: 24px;
  transition: opacity 0.15s ease, transform 0.15s ease;

  &:hover {
    opacity: 0.85;
    transform: scale(1.05);
  }
}
// ── Status Badge ─────────────────────────────────────
.status-active {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  background: rgba(30, 174, 138, 0.1);
  color: #1EAE8A;
  border: 1.5px solid #1EAE8A;
}

.status-inactive {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  background: rgba(230, 57, 70, 0.08);
  color: #E63946;
  border: 1.5px solid #E63946;
}

// ── Quick-add LOV overlay (Routing / Operation / Work Centre) ──
.FormModal {
  position: fixed;
  z-index: 9999;
  padding-top: 60px;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.4);
}

.FormModal_contentLovType {
  justify-content: center;
  background-color: var(--mat-sys-background);
  margin: auto;
  padding: 10px;
  border: 1px solid #888;
  width: 1200px;
  height: 600px;
  border-radius: 10px;
  overflow: auto;
}

.NewFormcloseicon {
  float: right;
  cursor: pointer;
  position: relative;
  top: -5px;
  left: 5px;
}

// ── Keep Picklist popup (MatDialog) above the Quick-add LOV lightbox ──
// gb-newpicklist opens its search results via MatDialog, which attaches to
// Angular's global CDK overlay container. That container's default z-index
// is lower than .FormModal's 9999, so the picklist dialog rendered behind
// the lightbox. Force the overlay stack above it.
::ng-deep .cdk-overlay-container {
  z-index: 100000 !important;
}

::ng-deep .cdk-overlay-pane {
  z-index: 100001 !important;
}

::ng-deep .mat-mdc-select-panel,
::ng-deep .mat-mdc-autocomplete-panel {
  z-index: 100002 !important;
}

::ng-deep .mat-mdc-dialog-container {
  z-index: 100003 !important;
}

/* ---- Sort Indicators ---- */
.sortable-col {
  cursor: pointer;
  user-select: none;

  &:hover {
    color: var(--text-primary);
  }
}

.sort-indicator {
  display: inline-flex;
  flex-direction: column;
  margin-left: 5px;
  gap: 1px;
  vertical-align: middle;
  line-height: 1;
}

.sort-arrow-up,
.sort-arrow-down {
  font-size: 8px;
  color: var(--border-subtle);
  line-height: 1;
  display: block;

  &.sort-active {
    color: var(--text-primary);
  }
}