.process-container {
  height: 100%;
  padding: 0;
}

// ── Stats Row ────────────────────────────────────────
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 16px 16px 0;

  @media (max-width: 900px) {
    grid-template-columns: repeat(2, 1fr);
  }

  @media (max-width: 500px) {
    grid-template-columns: 1fr;
  }
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-surface);
  border-radius: 10px;
  padding: 16px 20px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
  border: 1px solid var(--border-subtle);
}

.stat-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  flex-shrink: 0;

  mat-icon {
    font-size: 22px;
    width: 22px;
    height: 22px;
  }

  &--total {
    background: #eef2ff;
    mat-icon { color: #4f6fd4; }
  }

  &--active {
    background: #f0fdf4;
    mat-icon { color: #22c55e; }
  }

  &--dept {
    background: #fff7ed;
    mat-icon { color: #f97316; }
  }

  &--filtered {
    background: #f5f3ff;
    mat-icon { color: #7c3aed; }
  }
}

.stat-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-number {
  font-size: 26px;
  font-weight: 700;
  color: var(--action-primary-default, #7068b1);
  line-height: 1;
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

// ── 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;

  .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: 150px;
    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-process {
  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;
  overflow: hidden;
  margin: 16px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.process-table {
  width: 100%;
  border-collapse: collapse;

  thead tr {
    background: var(--bg-subtle);
    border-bottom: 1px solid var(--border-subtle);

    th {
      padding: 12px 16px;
      text-align: left;
      font-size: 12px;
      font-weight: 600;
      color: var(--text-secondary);
      letter-spacing: 0.5px;
      white-space: nowrap;
    }
  }

  tbody tr {
    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-alternate { background: var(--bg-subtle); }
    &.row-alternate:hover { background: var(--bg-muted); }

    td {
      padding: 12px 16px;
      font-size: 13px;
      color: var(--text-primary);
      vertical-align: middle;

      strong {
        font-weight: 600;
        color: var(--text-primary);
      }
    }
  }
}

// ── Cell Styles ───────────────────────────────────────
.process-code {
  background: #eef4ff;
  color: #3b6fd4;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.desc-cell {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
  font-size: 12px;
}

.status-active {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid #2e7d32;
  color: #2e7d32;
  background: #f1fdf3;
}

.status-inactive {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid #e53935;
  color: #e53935;
  background: #fff5f5;
}

// ── Empty State ──────────────────────────────────────
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  text-align: center;

  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;
  }
}

// ── Modal ─────────────────────────────────────────────
.modal {
  display: none;
  position: fixed;
  z-index: 999;
  padding-top: 100px;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.4);
}

.modal-content-wrapper {
  display: flex;
  justify-content: center;
  margin-top: -40px;
}

.modal-content {
  background-color: #fefefe;
  margin: auto;
  padding: 21px;
  border: 1px solid #888;
  width: 712px;
  min-height: 420px;
  border-radius: 8px;
  gap: 20px;
}

// ── Modal Title Bar ───────────────────────────────────
.titlecontainer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.buttfilter {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-weight: 700;
  font-style: normal;
  font-size: 18px;
  line-height: 150%;
  margin: 0;
  color: #333333;
}

.icons {
  display: flex;
  gap: 24px;
  align-items: center;
}

.action {
  display: flex;
  gap: 16px;
  align-items: center;
}

// ── Modal Action Buttons ──────────────────────────────
.save {
  display: flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 48px;
  padding: 0 12px;
  gap: 6px;
  height: 40px;
  border-radius: 8px;
  background: #1EAE8A;
  cursor: pointer;
  transition: all 0.3s ease;

  mat-icon {
    color: #ffffff;
    font-size: 20px;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
  }

  .save-label {
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
  }

  &:hover {
    background: #189b7a;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(30, 174, 138, 0.3);
  }

  &:active { transform: translateY(0); }
}

.delete {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid #E63946;
  background: transparent;
  cursor: pointer;
  transition: all 0.3s ease;

  mat-icon {
    color: #E63946;
    font-size: 20px;
    width: 20px;
    height: 20px;
  }

  &:hover {
    background: rgba(230, 57, 70, 0.1);
    transform: translateY(-1px);
  }

  &:active { transform: translateY(0); }
}

.add {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid #818181;
  background: transparent;
  cursor: pointer;
  transition: all 0.3s ease;

  mat-icon {
    color: #818181;
    font-size: 20px;
    width: 20px;
    height: 20px;
  }

  &:hover {
    background: rgba(129, 129, 129, 0.1);
    border-color: #666666;
    transform: translateY(-1px);
  }

  &:active { transform: translateY(0); }
}

.closeicon {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.3s ease;

  mat-icon {
    width: 27px;
    height: 27px;
    font-size: 27px;
    color: #666666;
  }

  &:hover {
    transform: scale(1.1);

    mat-icon { color: #333333; }
  }
}

// ── Modal Form Container ──────────────────────────────
.container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ---- 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);
  }
}
